Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/TurnManager.h
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
void EnableTimeWarpRecording(size_t numTurns); | void EnableTimeWarpRecording(size_t numTurns); | ||||
/** | /** | ||||
* Jumps back to the latest recorded state snapshot (if any). | * Jumps back to the latest recorded state snapshot (if any). | ||||
*/ | */ | ||||
void RewindTimeWarp(); | void RewindTimeWarp(); | ||||
void QuickSave(JS::HandleValue GUIMetadata); | |||||
void QuickLoad(); | |||||
u32 GetCurrentTurn() const { return m_CurrentTurn; } | u32 GetCurrentTurn() const { return m_CurrentTurn; } | ||||
/** | /** | ||||
* @return how many turns are ready to be computed. | * @return how many turns are ready to be computed. | ||||
* (used to detect players/observers that fall behind the live game. | * (used to detect players/observers that fall behind the live game. | ||||
*/ | */ | ||||
u32 GetPendingTurns() const { return m_ReadyTurn - m_CurrentTurn; } | u32 GetPendingTurns() const { return m_ReadyTurn - m_CurrentTurn; } | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | protected: | ||||
float m_DeltaSimTime; | float m_DeltaSimTime; | ||||
IReplayLogger& m_Replay; | IReplayLogger& m_Replay; | ||||
// The number of the last turn that is allowed to be executed (used for replays) | // The number of the last turn that is allowed to be executed (used for replays) | ||||
u32 m_FinalTurn; | u32 m_FinalTurn; | ||||
private: | private: | ||||
static const CStr EventNameSavegameLoaded; | |||||
size_t m_TimeWarpNumTurns; // 0 if disabled | size_t m_TimeWarpNumTurns; // 0 if disabled | ||||
std::list<std::string> m_TimeWarpStates; | std::list<std::string> m_TimeWarpStates; | ||||
std::string m_QuickSaveState; // TODO: should implement a proper disk-based quicksave system | |||||
JS::PersistentRootedValue m_QuickSaveMetadata; | |||||
}; | }; | ||||
#endif // INCLUDED_TURNMANAGER | #endif // INCLUDED_TURNMANAGER |
Wildfire Games · Phabricator