OpenRCT2/src/openrct2/scenario/ScenarioRepository.h

84 lines
2.5 KiB
C
Raw Normal View History

2016-10-12 13:36:30 +02:00
/*****************************************************************************
2020-07-21 15:04:34 +02:00
* Copyright (c) 2014-2020 OpenRCT2 developers
2016-10-12 13:36:30 +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
*
* 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"
2016-10-12 13:36:30 +02:00
2018-06-22 23:14:50 +02:00
#include <memory>
struct rct_object_entry;
2016-10-12 13:36:30 +02:00
struct scenario_highscore_entry
2016-10-12 13:36:30 +02:00
{
2018-06-22 23:14:50 +02:00
utf8* fileName;
utf8* name;
money32 company_value;
datetime64 timestamp;
};
2016-10-12 13:36:30 +02:00
struct scenario_index_entry
2016-10-12 13:36:30 +02:00
{
2018-06-22 23:14:50 +02:00
utf8 path[MAX_PATH];
uint64_t timestamp;
2016-10-12 13:36:30 +02:00
// Category / sequence
2018-06-22 23:14:50 +02:00
uint8_t category;
uint8_t source_game;
int16_t source_index;
uint16_t sc_id;
2016-10-12 13:36:30 +02:00
// Objective
2018-06-22 23:14:50 +02:00
uint8_t objective_type;
uint8_t objective_arg_1;
int32_t objective_arg_2;
int16_t objective_arg_3;
scenario_highscore_entry* highscore;
utf8 internal_name[64]; // Untranslated name
utf8 name[64]; // Translated name
2016-10-12 13:36:30 +02:00
utf8 details[256];
};
2016-10-12 13:36:30 +02:00
2017-06-11 13:53:37 +02:00
namespace OpenRCT2
{
2020-07-30 22:18:23 +02:00
INTERFACE IPlatformEnvironment;
2017-06-11 13:53:37 +02:00
}
2020-07-30 22:18:23 +02:00
INTERFACE IScenarioRepository
2016-10-12 13:36:30 +02:00
{
virtual ~IScenarioRepository() = default;
/**
* Scans the scenario directories and grabs the metadata for all the scenarios.
*/
virtual void Scan(int32_t language) abstract;
2016-10-12 13:36:30 +02:00
virtual size_t GetCount() const abstract;
2018-06-22 23:14:50 +02:00
virtual const scenario_index_entry* GetByIndex(size_t index) const abstract;
virtual const scenario_index_entry* GetByFilename(const utf8* filename) const abstract;
/**
* Does not return custom scenarios due to the fact that they may have the same name.
*/
virtual const scenario_index_entry* GetByInternalName(const utf8* name) const abstract;
virtual const scenario_index_entry* GetByPath(const utf8* path) const abstract;
virtual bool TryRecordHighscore(int32_t language, const utf8* scenarioFileName, money32 companyValue, const utf8* name)
abstract;
2016-10-12 13:36:30 +02:00
};
std::unique_ptr<IScenarioRepository> CreateScenarioRepository(const std::shared_ptr<OpenRCT2::IPlatformEnvironment>& env);
2018-06-22 23:14:50 +02:00
IScenarioRepository* GetScenarioRepository();
2016-10-12 13:36:30 +02:00
2018-06-22 23:14:50 +02:00
void scenario_repository_scan();
size_t scenario_repository_get_count();
const scenario_index_entry* scenario_repository_get_by_index(size_t index);
bool scenario_repository_try_record_highscore(const utf8* scenarioFileName, money32 companyValue, const utf8* name);
2018-08-29 23:29:45 +02:00
void scenario_translate(scenario_index_entry* scenarioEntry);