2023-02-13 21:30:16 +01:00
|
|
|
|
2016-10-12 13:36:30 +02:00
|
|
|
/*****************************************************************************
|
2023-01-01 11:58:01 +01:00
|
|
|
* Copyright (c) 2014-2023 OpenRCT2 developers
|
2016-10-12 13:36:30 +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-10-12 13:36:30 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-10-12 13:36:30 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-12-14 13:13:52 +01:00
|
|
|
#include "../common.h"
|
2023-02-16 18:38:00 +01:00
|
|
|
#include "../core/String.hpp"
|
2020-08-08 14:38:43 +02:00
|
|
|
#include "../scenario/Scenario.h"
|
2016-10-12 13:36:30 +02:00
|
|
|
|
2018-06-22 23:14:50 +02:00
|
|
|
#include <memory>
|
|
|
|
|
2023-01-20 06:24:44 +01:00
|
|
|
struct RCTObjectEntry;
|
2016-10-12 13:36:30 +02:00
|
|
|
|
2023-01-20 21:58:55 +01:00
|
|
|
struct ScenarioHighscoreEntry
|
2016-10-12 13:36:30 +02:00
|
|
|
{
|
2023-02-16 18:38:00 +01:00
|
|
|
u8string fileName;
|
2023-02-16 18:52:13 +01:00
|
|
|
u8string name;
|
2023-02-16 21:48:21 +01:00
|
|
|
money64 company_value{};
|
|
|
|
datetime64 timestamp{};
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2016-10-12 13:36:30 +02:00
|
|
|
|
2021-08-26 13:54:38 +02:00
|
|
|
enum class ScenarioSource : uint8_t
|
|
|
|
{
|
|
|
|
RCT1,
|
|
|
|
RCT1_AA,
|
|
|
|
RCT1_LL,
|
|
|
|
RCT2,
|
|
|
|
RCT2_WW,
|
|
|
|
RCT2_TT,
|
2022-11-22 15:18:55 +01:00
|
|
|
UCES,
|
2021-08-26 13:54:38 +02:00
|
|
|
Real,
|
2022-09-25 12:59:35 +02:00
|
|
|
Extras,
|
2021-08-26 13:54:38 +02:00
|
|
|
Other
|
|
|
|
};
|
|
|
|
|
2023-02-13 21:30:16 +01:00
|
|
|
struct ScenarioIndexEntry
|
2016-10-12 13:36:30 +02:00
|
|
|
{
|
2023-02-13 21:30:16 +01:00
|
|
|
utf8 Path[MAX_PATH];
|
|
|
|
uint64_t Timestamp;
|
2016-10-12 13:36:30 +02:00
|
|
|
|
|
|
|
// Category / sequence
|
2023-02-13 21:30:16 +01:00
|
|
|
uint8_t Category;
|
|
|
|
ScenarioSource SourceGame;
|
|
|
|
int16_t SourceIndex = -1;
|
|
|
|
uint16_t ScenarioId;
|
2016-10-12 13:36:30 +02:00
|
|
|
|
|
|
|
// Objective
|
2023-02-13 21:30:16 +01:00
|
|
|
uint8_t ObjectiveType;
|
|
|
|
uint8_t ObjectiveArg1;
|
|
|
|
int64_t ObjectiveArg2;
|
|
|
|
int16_t ObjectiveArg3;
|
|
|
|
ScenarioHighscoreEntry* Highscore = nullptr;
|
|
|
|
|
|
|
|
utf8 InternalName[64]; // Untranslated name
|
|
|
|
utf8 Name[64]; // Translated name
|
|
|
|
utf8 Details[256];
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2016-10-12 13:36:30 +02:00
|
|
|
|
2017-06-11 13:53:37 +02:00
|
|
|
namespace OpenRCT2
|
|
|
|
{
|
2020-07-30 23:19:53 +02:00
|
|
|
struct IPlatformEnvironment;
|
2017-06-11 13:53:37 +02:00
|
|
|
}
|
2016-12-10 20:20:32 +01:00
|
|
|
|
2020-07-30 23:19:53 +02:00
|
|
|
struct IScenarioRepository
|
2016-10-12 13:36:30 +02:00
|
|
|
{
|
|
|
|
virtual ~IScenarioRepository() = default;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scans the scenario directories and grabs the metadata for all the scenarios.
|
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
virtual void Scan(int32_t language) abstract;
|
2016-10-12 13:36:30 +02:00
|
|
|
|
|
|
|
virtual size_t GetCount() const abstract;
|
2023-02-13 21:30:16 +01:00
|
|
|
virtual const ScenarioIndexEntry* GetByIndex(size_t index) const abstract;
|
|
|
|
virtual const ScenarioIndexEntry* GetByFilename(u8string_view filename) const abstract;
|
2018-06-22 23:14:50 +02:00
|
|
|
/**
|
|
|
|
* Does not return custom scenarios due to the fact that they may have the same name.
|
|
|
|
*/
|
2023-02-13 21:30:16 +01:00
|
|
|
virtual const ScenarioIndexEntry* GetByInternalName(const utf8* name) const abstract;
|
|
|
|
virtual const ScenarioIndexEntry* GetByPath(const utf8* path) const abstract;
|
2018-06-22 23:14:50 +02:00
|
|
|
|
2020-07-30 23:19:53 +02:00
|
|
|
virtual bool TryRecordHighscore(
|
2021-04-10 17:00:50 +02:00
|
|
|
int32_t language, const utf8* scenarioFileName, money64 companyValue, const utf8* name) abstract;
|
2016-10-12 13:36:30 +02:00
|
|
|
};
|
|
|
|
|
2021-08-23 20:09:43 +02:00
|
|
|
[[nodiscard]] std::unique_ptr<IScenarioRepository> CreateScenarioRepository(
|
|
|
|
const std::shared_ptr<OpenRCT2::IPlatformEnvironment>& env);
|
|
|
|
[[nodiscard]] IScenarioRepository* GetScenarioRepository();
|
2016-10-12 13:36:30 +02:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
void ScenarioRepositoryScan();
|
|
|
|
[[nodiscard]] size_t ScenarioRepositoryGetCount();
|
2023-02-13 21:30:16 +01:00
|
|
|
[[nodiscard]] const ScenarioIndexEntry* ScenarioRepositoryGetByIndex(size_t index);
|
2023-01-17 20:46:55 +01:00
|
|
|
[[nodiscard]] bool ScenarioRepositoryTryRecordHighscore(const utf8* scenarioFileName, money64 companyValue, const utf8* name);
|
2023-02-13 21:30:16 +01:00
|
|
|
void ScenarioTranslate(ScenarioIndexEntry* scenarioEntry);
|