1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00
Files
OpenRCT2/src/openrct2/GameState.h
2024-01-25 09:34:47 +00:00

93 lines
2.3 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "Date.h"
#include "management/Finance.h"
#include "scenario/Scenario.h"
#include "world/Climate.h"
#include "world/Location.hpp"
#include <array>
#include <chrono>
#include <memory>
#include <unordered_map>
namespace OpenRCT2
{
class Park;
struct GameState_t
{
uint32_t CurrentTicks{};
uint64_t ParkFlags;
uint16_t ParkRating;
money64 ParkEntranceFee;
uint32_t ParkSize;
ClimateType Climate;
ClimateState ClimateCurrent;
ClimateState ClimateNext;
uint16_t ClimateUpdateTimer;
money64 Cash;
money64 InitialCash;
money64 GuestInitialCash;
uint8_t GuestInitialHappiness;
uint8_t GuestInitialHunger;
uint8_t GuestInitialThirst;
uint32_t NextGuestNumber;
money64 WeeklyProfitAverageDividend;
uint16_t WeeklyProfitAverageDivisor;
money64 WeeklyProfitHistory[FINANCE_GRAPH_SIZE];
Objective ScenarioObjective;
uint16_t ScenarioParkRatingWarningDays;
money64 ScenarioCompletedCompanyValue;
money64 ScenarioCompanyValueRecord;
SCENARIO_CATEGORY ScenarioCategory;
std::string ScenarioName;
std::string ScenarioDetails;
std::string ScenarioCompletedBy;
};
GameState_t& GetGameState();
/**
* Class to update the state of the map and park.
*/
class GameState final
{
private:
std::unique_ptr<Park> _park;
Date _date;
public:
GameState();
GameState(const GameState&) = delete;
Date& GetDate()
{
return _date;
}
Park& GetPark()
{
return *_park;
}
void InitAll(const TileCoordsXY& mapSize);
void Tick();
void UpdateLogic();
void SetDate(Date newDate);
void ResetDate();
private:
void CreateStateSnapshot();
};
} // namespace OpenRCT2