2016-05-04 19:24:41 +02:00
|
|
|
/*****************************************************************************
|
2018-06-15 14:07:34 +02:00
|
|
|
* Copyright (c) 2014-2018 OpenRCT2 developers
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-04 19:24:41 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2016-04-17 16:21:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-31 00:08:04 +01:00
|
|
|
#include "common.h"
|
2018-01-02 20:36:42 +01:00
|
|
|
#include "object/Object.h"
|
2017-06-06 15:34:30 +02:00
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
enum PARK_LOAD_ERROR
|
2017-07-01 02:26:23 +02:00
|
|
|
{
|
|
|
|
PARK_LOAD_ERROR_OK,
|
|
|
|
PARK_LOAD_ERROR_MISSING_OBJECTS,
|
|
|
|
PARK_LOAD_ERROR_INVALID_EXTENSION,
|
2017-10-30 16:11:45 +01:00
|
|
|
PARK_LOAD_ERROR_UNSUPPORTED_RCTC_FLAG,
|
2017-07-01 02:26:23 +02:00
|
|
|
PARK_LOAD_ERROR_UNKNOWN = 255
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2017-01-31 20:15:48 +01:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
#include "core/String.hpp"
|
|
|
|
|
2018-04-20 23:16:37 +02:00
|
|
|
#include <memory>
|
2017-01-31 20:15:48 +01:00
|
|
|
#include <string>
|
2017-07-01 02:26:23 +02:00
|
|
|
#include <vector>
|
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;
|
2018-03-13 13:14:02 +01:00
|
|
|
struct scenario_index_entry;
|
2017-01-30 23:58:48 +01:00
|
|
|
|
2017-07-01 02:26:23 +02:00
|
|
|
struct ParkLoadResult final
|
|
|
|
{
|
|
|
|
public:
|
2018-05-21 01:11:42 +02:00
|
|
|
std::vector<rct_object_entry> const RequiredObjects;
|
|
|
|
|
|
|
|
explicit ParkLoadResult(std::vector<rct_object_entry>&& requiredObjects)
|
|
|
|
: RequiredObjects(requiredObjects)
|
|
|
|
{
|
|
|
|
}
|
2017-07-01 02:26:23 +02:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2018-06-22 23:25:16 +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, const utf8* path = String::Empty) abstract;
|
2017-07-01 02:26:23 +02:00
|
|
|
|
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
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
std::unique_ptr<IParkImporter> Create(const std::string& hintPath);
|
2018-04-20 23:16:37 +02:00
|
|
|
std::unique_ptr<IParkImporter> CreateS4();
|
2018-07-21 11:50:45 +02:00
|
|
|
std::unique_ptr<IParkImporter> CreateS6(
|
2018-08-29 00:52:10 +02:00
|
|
|
IObjectRepository& objectRepository, IObjectManager& objectManager);
|
2017-01-31 20:15:48 +01:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
bool ExtensionIsRCT1(const std::string& extension);
|
|
|
|
bool ExtensionIsScenario(const std::string& extension);
|
|
|
|
} // namespace ParkImporter
|
2017-01-31 20:15:48 +01:00
|
|
|
|
2018-05-21 20:06:21 +02:00
|
|
|
class ObjectLoadException : public std::exception
|
2018-05-21 01:11:42 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::vector<rct_object_entry> const MissingObjects;
|
|
|
|
|
|
|
|
explicit ObjectLoadException(std::vector<rct_object_entry>&& missingObjects)
|
|
|
|
: MissingObjects(missingObjects)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-21 20:06:21 +02:00
|
|
|
class UnsupportedRCTCFlagException : public std::exception
|
2018-05-21 01:11:42 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t const Flag;
|
2018-05-21 01:11:42 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
explicit UnsupportedRCTCFlagException(uint8_t flag)
|
2018-05-21 01:11:42 +02:00
|
|
|
: Flag(flag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|