2016-05-04 19:24:41 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 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-06-22 23:25:16 +02:00
|
|
|
#include "core/String.hpp"
|
2020-08-05 04:26:59 +02:00
|
|
|
#include "object/Object.h"
|
2021-09-12 21:25:22 +02:00
|
|
|
#include "object/ObjectList.h"
|
2018-06-22 23:25:16 +02:00
|
|
|
|
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
|
|
|
|
2020-07-30 23:19:53 +02:00
|
|
|
struct IObjectManager;
|
|
|
|
struct IObjectRepository;
|
2021-09-12 21:25:22 +02:00
|
|
|
|
2020-07-30 23:01:22 +02:00
|
|
|
namespace OpenRCT2
|
|
|
|
{
|
2020-07-30 23:19:53 +02:00
|
|
|
struct IStream;
|
2020-07-30 23:01:22 +02:00
|
|
|
}
|
2020-07-30 23:19:53 +02:00
|
|
|
|
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:
|
2021-09-12 21:25:22 +02:00
|
|
|
ObjectList RequiredObjects;
|
2018-05-21 01:11:42 +02:00
|
|
|
|
2021-09-12 21:25:22 +02:00
|
|
|
explicit ParkLoadResult(ObjectList&& requiredObjects)
|
2020-04-16 13:13:13 +02:00
|
|
|
: RequiredObjects(std::move(requiredObjects))
|
2018-05-21 01:11:42 +02:00
|
|
|
{
|
|
|
|
}
|
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
|
|
|
*/
|
2020-07-30 23:19:53 +02:00
|
|
|
struct 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(
|
2020-07-30 23:19:53 +02:00
|
|
|
OpenRCT2::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;
|
2020-07-30 23:19:53 +02: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
|
|
|
|
{
|
2021-08-23 20:09:43 +02:00
|
|
|
[[nodiscard]] std::unique_ptr<IParkImporter> Create(const std::string& hintPath);
|
|
|
|
[[nodiscard]] std::unique_ptr<IParkImporter> CreateS4();
|
|
|
|
[[nodiscard]] std::unique_ptr<IParkImporter> CreateS6(IObjectRepository& objectRepository);
|
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:
|
2021-09-12 21:25:22 +02:00
|
|
|
std::vector<ObjectEntryDescriptor> const MissingObjects;
|
2018-05-21 01:11:42 +02:00
|
|
|
|
2021-09-12 21:25:22 +02:00
|
|
|
explicit ObjectLoadException(std::vector<ObjectEntryDescriptor>&& missingObjects)
|
2021-01-11 22:14:15 +01:00
|
|
|
: MissingObjects(std::move(missingObjects))
|
2018-05-21 01:11:42 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2020-11-01 14:49:43 +01:00
|
|
|
|
|
|
|
class UnsupportedRideTypeException : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ObjectEntryIndex const Type;
|
|
|
|
|
|
|
|
explicit UnsupportedRideTypeException(ObjectEntryIndex type)
|
|
|
|
: Type(type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|