2017-06-01 21:55:10 +02:00
|
|
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
2016-05-04 19:24:41 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
|
|
|
*****************************************************************************/
|
|
|
|
#pragma endregion
|
|
|
|
|
2016-04-17 16:21:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-31 00:08:04 +01:00
|
|
|
#include "common.h"
|
2017-01-31 20:15:48 +01:00
|
|
|
|
2017-09-18 17:05:28 +02:00
|
|
|
#include "object.h"
|
2017-06-06 15:34:30 +02:00
|
|
|
|
2017-07-01 02:26:23 +02:00
|
|
|
typedef enum PARK_LOAD_ERROR
|
|
|
|
{
|
|
|
|
PARK_LOAD_ERROR_OK,
|
|
|
|
PARK_LOAD_ERROR_MISSING_OBJECTS,
|
|
|
|
PARK_LOAD_ERROR_INVALID_EXTENSION,
|
|
|
|
PARK_LOAD_ERROR_UNKNOWN = 255
|
|
|
|
} PARK_LOAD_ERROR;
|
|
|
|
|
2017-01-31 20:15:48 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <string>
|
2017-07-01 02:26:23 +02:00
|
|
|
#include <vector>
|
2017-01-31 00:08:04 +01:00
|
|
|
#include "scenario/ScenarioRepository.h"
|
2016-04-17 16:21:35 +02:00
|
|
|
|
2017-06-22 19:57:25 +02:00
|
|
|
interface IObjectManager;
|
|
|
|
interface IObjectRepository;
|
2017-01-30 23:58:48 +01:00
|
|
|
interface IStream;
|
|
|
|
|
2017-07-01 02:26:23 +02:00
|
|
|
struct ParkLoadResult final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const PARK_LOAD_ERROR Error;
|
|
|
|
const std::vector<rct_object_entry> MissingObjects;
|
|
|
|
|
|
|
|
static ParkLoadResult CreateOK();
|
|
|
|
static ParkLoadResult CreateInvalidExtension();
|
|
|
|
static ParkLoadResult CreateMissingObjects(const std::vector<rct_object_entry> &missingObjects);
|
|
|
|
static ParkLoadResult CreateUnknown();
|
|
|
|
|
|
|
|
private:
|
|
|
|
ParkLoadResult(PARK_LOAD_ERROR error);
|
|
|
|
ParkLoadResult(PARK_LOAD_ERROR error, const std::vector<rct_object_entry> &missingObjects);
|
|
|
|
};
|
|
|
|
|
2016-04-17 16:21:35 +02:00
|
|
|
/**
|
2017-01-31 00:08:04 +01:00
|
|
|
* Interface to import scenarios and saved games.
|
2016-04-17 16:21:35 +02:00
|
|
|
*/
|
2017-01-31 00:08:04 +01:00
|
|
|
interface IParkImporter
|
2016-04-17 16:21:35 +02:00
|
|
|
{
|
|
|
|
public:
|
2017-01-31 00:08:04 +01:00
|
|
|
virtual ~IParkImporter() = default;
|
2017-07-01 02:26:23 +02:00
|
|
|
|
|
|
|
virtual ParkLoadResult Load(const utf8 * path) abstract;
|
|
|
|
virtual ParkLoadResult LoadSavedGame(const utf8 * path, bool skipObjectCheck = false) abstract;
|
|
|
|
virtual ParkLoadResult LoadScenario(const utf8 * path, bool skipObjectCheck = false) abstract;
|
|
|
|
virtual ParkLoadResult LoadFromStream(IStream * stream, bool isScenario, bool skipObjectCheck = false) abstract;
|
|
|
|
|
2016-09-08 22:31:46 +02:00
|
|
|
virtual void Import() abstract;
|
2017-01-30 22:32:58 +01:00
|
|
|
virtual bool GetDetails(scenario_index_entry * dst) abstract;
|
2016-04-17 16:21:35 +02:00
|
|
|
};
|
2016-09-08 22:31:46 +02:00
|
|
|
|
2017-01-31 20:15:48 +01:00
|
|
|
namespace ParkImporter
|
|
|
|
{
|
|
|
|
IParkImporter * Create(const std::string &hintPath);
|
|
|
|
IParkImporter * CreateS4();
|
2017-06-22 19:57:25 +02:00
|
|
|
IParkImporter * CreateS6(IObjectRepository * objectRepository, IObjectManager * objectManager);
|
2017-01-31 20:15:48 +01:00
|
|
|
|
|
|
|
bool ExtensionIsRCT1(const std::string &extension);
|
|
|
|
bool ExtensionIsScenario(const std::string &extension);
|
|
|
|
}
|
|
|
|
|
2017-07-01 02:26:23 +02:00
|
|
|
#else
|
|
|
|
|
|
|
|
typedef struct ParkLoadResult ParkLoadResult;
|
|
|
|
|
2017-01-31 20:15:48 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
void park_importer_load_from_stream(void * stream, const utf8 * hintPath);
|
|
|
|
bool park_importer_extension_is_scenario(const utf8 * extension);
|
|
|
|
|
2017-07-01 02:26:23 +02:00
|
|
|
PARK_LOAD_ERROR ParkLoadResult_GetError(const ParkLoadResult * t);
|
|
|
|
size_t ParkLoadResult_GetMissingObjectsCount(const ParkLoadResult * t);
|
|
|
|
const rct_object_entry * ParkLoadResult_GetMissingObjects(const ParkLoadResult * t);
|
|
|
|
void ParkLoadResult_Delete(ParkLoadResult * t);
|
|
|
|
ParkLoadResult * ParkLoadResult_CreateInvalidExtension();
|
2017-01-31 20:15:48 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|