1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-14 19:42:38 +01:00

Remove GameState class

This commit is contained in:
Gymnasiast
2024-03-26 15:08:17 +01:00
parent 28451027b1
commit fef1a27342
18 changed files with 306 additions and 359 deletions

View File

@@ -714,9 +714,7 @@ public:
{ {
if (_titleSequencePlayer == nullptr) if (_titleSequencePlayer == nullptr)
{ {
auto context = GetContext(); _titleSequencePlayer = OpenRCT2::Title::CreateTitleSequencePlayer();
auto gameState = context->GetGameState();
_titleSequencePlayer = OpenRCT2::Title::CreateTitleSequencePlayer(*gameState);
} }
return _titleSequencePlayer.get(); return _titleSequencePlayer.get();
} }

View File

@@ -46,8 +46,6 @@ namespace OpenRCT2::Title
class TitleSequencePlayer final : public ITitleSequencePlayer class TitleSequencePlayer final : public ITitleSequencePlayer
{ {
private: private:
GameState& _gameState;
std::unique_ptr<TitleSequence> _sequence; std::unique_ptr<TitleSequence> _sequence;
int32_t _position = 0; int32_t _position = 0;
int32_t _waitCounter = 0; int32_t _waitCounter = 0;
@@ -57,8 +55,7 @@ namespace OpenRCT2::Title
ScreenCoordsXY _previousViewPosition = {}; ScreenCoordsXY _previousViewPosition = {};
public: public:
explicit TitleSequencePlayer(GameState& gameState) explicit TitleSequencePlayer()
: _gameState(gameState)
{ {
} }
@@ -248,7 +245,7 @@ namespace OpenRCT2::Title
{ {
if (Update()) if (Update())
{ {
_gameState.UpdateLogic(); gameStateUpdateLogic();
} }
else else
{ {
@@ -431,8 +428,8 @@ namespace OpenRCT2::Title
} }
}; };
std::unique_ptr<ITitleSequencePlayer> CreateTitleSequencePlayer(GameState& gameState) std::unique_ptr<ITitleSequencePlayer> CreateTitleSequencePlayer()
{ {
return std::make_unique<TitleSequencePlayer>(gameState); return std::make_unique<TitleSequencePlayer>();
} }
} // namespace OpenRCT2::Title } // namespace OpenRCT2::Title

View File

@@ -17,10 +17,8 @@ struct IScenarioRepository;
namespace OpenRCT2 namespace OpenRCT2
{ {
class GameState;
namespace Title namespace Title
{ {
[[nodiscard]] std::unique_ptr<ITitleSequencePlayer> CreateTitleSequencePlayer(GameState& gameState); [[nodiscard]] std::unique_ptr<ITitleSequencePlayer> CreateTitleSequencePlayer();
} // namespace Title } // namespace Title
} // namespace OpenRCT2 } // namespace OpenRCT2

View File

@@ -123,7 +123,6 @@ namespace OpenRCT2
// Game states // Game states
std::unique_ptr<TitleScreen> _titleScreen; std::unique_ptr<TitleScreen> _titleScreen;
std::unique_ptr<GameState> _gameState;
DrawingEngine _drawingEngineType = DrawingEngine::Software; DrawingEngine _drawingEngineType = DrawingEngine::Software;
std::unique_ptr<IDrawingEngine> _drawingEngine; std::unique_ptr<IDrawingEngine> _drawingEngine;
@@ -221,11 +220,6 @@ namespace OpenRCT2
} }
#endif #endif
GameState* GetGameState() override
{
return _gameState.get();
}
std::shared_ptr<IPlatformEnvironment> GetPlatformEnvironment() override std::shared_ptr<IPlatformEnvironment> GetPlatformEnvironment() override
{ {
return _env; return _env;
@@ -477,14 +471,13 @@ namespace OpenRCT2
InputResetPlaceObjModifier(); InputResetPlaceObjModifier();
ViewportInitAll(); ViewportInitAll();
_gameState = std::make_unique<GameState>(); gameStateInitAll(GetGameState(), DEFAULT_MAP_SIZE);
_gameState->InitAll(DEFAULT_MAP_SIZE);
#ifdef ENABLE_SCRIPTING #ifdef ENABLE_SCRIPTING
_scriptEngine.Initialise(); _scriptEngine.Initialise();
#endif #endif
_titleScreen = std::make_unique<TitleScreen>(*_gameState); _titleScreen = std::make_unique<TitleScreen>();
_uiContext->Initialise(); _uiContext->Initialise();
return true; return true;
@@ -1199,7 +1192,7 @@ namespace OpenRCT2
} }
else else
{ {
_gameState->Tick(); gameStateTick();
} }
#ifdef __ENABLE_DISCORD__ #ifdef __ENABLE_DISCORD__

View File

@@ -81,7 +81,6 @@ class NetworkBase;
namespace OpenRCT2 namespace OpenRCT2
{ {
class AssetPackManager; class AssetPackManager;
class GameState;
struct IPlatformEnvironment; struct IPlatformEnvironment;
struct IReplayManager; struct IReplayManager;
@@ -125,7 +124,6 @@ namespace OpenRCT2
[[nodiscard]] virtual std::shared_ptr<Audio::IAudioContext> GetAudioContext() abstract; [[nodiscard]] virtual std::shared_ptr<Audio::IAudioContext> GetAudioContext() abstract;
[[nodiscard]] virtual std::shared_ptr<Ui::IUiContext> GetUiContext() abstract; [[nodiscard]] virtual std::shared_ptr<Ui::IUiContext> GetUiContext() abstract;
virtual GameState* GetGameState() abstract;
[[nodiscard]] virtual std::shared_ptr<IPlatformEnvironment> GetPlatformEnvironment() abstract; [[nodiscard]] virtual std::shared_ptr<IPlatformEnvironment> GetPlatformEnvironment() abstract;
virtual Localisation::LocalisationService& GetLocalisationService() abstract; virtual Localisation::LocalisationService& GetLocalisationService() abstract;
virtual IObjectManager& GetObjectManager() abstract; virtual IObjectManager& GetObjectManager() abstract;

View File

@@ -105,7 +105,7 @@ namespace Editor
auto& gameState = GetGameState(); auto& gameState = GetGameState();
Audio::StopAll(); Audio::StopAll();
ObjectListLoad(); ObjectListLoad();
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gameStateInitAll(gameState, DEFAULT_MAP_SIZE);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gameState.EditorStep = EditorStep::ObjectSelection; gameState.EditorStep = EditorStep::ObjectSelection;
gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
@@ -167,7 +167,7 @@ namespace Editor
ObjectManagerUnloadAllObjects(); ObjectManagerUnloadAllObjects();
ObjectListLoad(); ObjectListLoad();
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gameStateInitAll(GetGameState(), DEFAULT_MAP_SIZE);
SetAllLandOwned(); SetAllLandOwned();
GetGameState().EditorStep = EditorStep::ObjectSelection; GetGameState().EditorStep = EditorStep::ObjectSelection;
ViewportInitAll(); ViewportInitAll();
@@ -188,7 +188,7 @@ namespace Editor
ObjectManagerUnloadAllObjects(); ObjectManagerUnloadAllObjects();
ObjectListLoad(); ObjectListLoad();
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gameStateInitAll(GetGameState(), DEFAULT_MAP_SIZE);
SetAllLandOwned(); SetAllLandOwned();
GetGameState().EditorStep = EditorStep::ObjectSelection; GetGameState().EditorStep = EditorStep::ObjectSelection;
ViewportInitAll(); ViewportInitAll();

View File

@@ -58,20 +58,14 @@ namespace OpenRCT2
{ {
return _gameState; return _gameState;
} }
} // namespace OpenRCT2
GameState::GameState()
{
}
/** /**
* Initialises the map, park etc. basically all S6 data. * Initialises the map, park etc. basically all S6 data.
*/ */
void GameState::InitAll(const TileCoordsXY& mapSize) void gameStateInitAll(GameState_t& gameState, const TileCoordsXY& mapSize)
{ {
PROFILED_FUNCTION(); PROFILED_FUNCTION();
auto& gameState = GetGameState();
gInMapInitCode = true; gInMapInitCode = true;
gameState.CurrentTicks = 0; gameState.CurrentTicks = 0;
@@ -115,7 +109,7 @@ void GameState::InitAll(const TileCoordsXY& mapSize)
* when operating as a client it may run multiple updates to catch up with the server tick, * when operating as a client it may run multiple updates to catch up with the server tick,
* another influence can be the game speed setting. * another influence can be the game speed setting.
*/ */
void GameState::Tick() void gameStateTick()
{ {
PROFILED_FUNCTION(); PROFILED_FUNCTION();
@@ -201,7 +195,7 @@ void GameState::Tick()
// Update the game one or more times // Update the game one or more times
for (uint32_t i = 0; i < numUpdates; i++) for (uint32_t i = 0; i < numUpdates; i++)
{ {
UpdateLogic(); gameStateUpdateLogic();
if (gGameSpeed == 1) if (gGameSpeed == 1)
{ {
if (InputGetState() == InputState::Reset || InputGetState() == InputState::Normal) if (InputGetState() == InputState::Reset || InputGetState() == InputState::Normal)
@@ -267,7 +261,18 @@ void GameState::Tick()
gDoSingleUpdate = false; gDoSingleUpdate = false;
} }
void GameState::UpdateLogic() static void gameStateCreateStateSnapshot()
{
PROFILED_FUNCTION();
IGameStateSnapshots* snapshots = GetContext()->GetGameStateSnapshots();
auto& snapshot = snapshots->CreateSnapshot();
snapshots->Capture(snapshot);
snapshots->LinkSnapshot(snapshot, GetGameState().CurrentTicks, ScenarioRandState().s0);
}
void gameStateUpdateLogic()
{ {
PROFILED_FUNCTION(); PROFILED_FUNCTION();
@@ -285,7 +290,7 @@ void GameState::UpdateLogic()
{ {
if (NetworkGamestateSnapshotsEnabled()) if (NetworkGamestateSnapshotsEnabled())
{ {
CreateStateSnapshot(); gameStateCreateStateSnapshot();
} }
// Send current tick out. // Send current tick out.
@@ -309,7 +314,7 @@ void GameState::UpdateLogic()
{ {
// Create snapshot from this tick so we can compare it later // Create snapshot from this tick so we can compare it later
// as we won't pause the game on this event. // as we won't pause the game on this event.
CreateStateSnapshot(); gameStateCreateStateSnapshot();
NetworkRequestGamestateSnapshot(); NetworkRequestGamestateSnapshot();
} }
@@ -381,15 +386,4 @@ void GameState::UpdateLogic()
gInUpdateCode = false; gInUpdateCode = false;
} }
} // namespace OpenRCT2
void GameState::CreateStateSnapshot()
{
PROFILED_FUNCTION();
IGameStateSnapshots* snapshots = GetContext()->GetGameStateSnapshots();
auto& snapshot = snapshots->CreateSnapshot();
snapshots->Capture(snapshot);
snapshots->LinkSnapshot(snapshot, GetGameState().CurrentTicks, ScenarioRandState().s0);
}

View File

@@ -158,20 +158,8 @@ namespace OpenRCT2
GameState_t& GetGameState(); GameState_t& GetGameState();
/** void gameStateInitAll(GameState_t& gameState, const TileCoordsXY& mapSize);
* Class to update the state of the map and park. void gameStateTick();
*/ void gameStateUpdateLogic();
class GameState final
{
public:
GameState();
GameState(const GameState&) = delete;
void InitAll(const TileCoordsXY& mapSize);
void Tick();
void UpdateLogic();
private:
void CreateStateSnapshot();
};
} // namespace OpenRCT2 } // namespace OpenRCT2

View File

@@ -59,7 +59,7 @@ static exitcode_t HandleSimulate(CommandLineArgEnumerator* argEnumerator)
Console::WriteLine("Running %d ticks...", ticks); Console::WriteLine("Running %d ticks...", ticks);
for (uint32_t i = 0; i < ticks; i++) for (uint32_t i = 0; i < ticks; i++)
{ {
context->GetGameState()->UpdateLogic(); gameStateUpdateLogic();
} }
Console::WriteLine("Completed: %s", GetAllEntitiesChecksum().ToString().c_str()); Console::WriteLine("Completed: %s", GetAllEntitiesChecksum().ToString().c_str());
} }

View File

@@ -1063,8 +1063,7 @@ namespace OpenRCT2
if (cs.GetMode() == OrcaStream::Mode::READING) if (cs.GetMode() == OrcaStream::Mode::READING)
{ {
// TODO: Use the passed gameState instead of the global one. gameStateInitAll(gameState, gameState.MapSize);
OpenRCT2::GetContext()->GetGameState()->InitAll(gameState.MapSize);
auto numElements = cs.Read<uint32_t>(); auto numElements = cs.Read<uint32_t>();

View File

@@ -326,8 +326,7 @@ namespace RCT1
gScenarioFileName = GetRCT1ScenarioName(); gScenarioFileName = GetRCT1ScenarioName();
// Do map initialisation, same kind of stuff done when loading scenario editor // Do map initialisation, same kind of stuff done when loading scenario editor
auto context = OpenRCT2::GetContext(); gameStateInitAll(gameState, { mapSize, mapSize });
context->GetGameState()->InitAll({ mapSize, mapSize });
gameState.EditorStep = EditorStep::ObjectSelection; gameState.EditorStep = EditorStep::ObjectSelection;
gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER;

View File

@@ -229,7 +229,7 @@ namespace RCT2
void Import(GameState_t& gameState) override void Import(GameState_t& gameState) override
{ {
Initialise(); Initialise(gameState);
gameState.EditorStep = _s6.Info.EditorStep; gameState.EditorStep = _s6.Info.EditorStep;
gameState.ScenarioCategory = static_cast<SCENARIO_CATEGORY>(_s6.Info.Category); gameState.ScenarioCategory = static_cast<SCENARIO_CATEGORY>(_s6.Info.Category);
@@ -1719,9 +1719,9 @@ namespace RCT2
dst->position.y = src->y; dst->position.y = src->y;
} }
void Initialise() void Initialise(GameState_t& gameState)
{ {
OpenRCT2::GetContext()->GetGameState()->InitAll({ _s6.MapSize, _s6.MapSize }); gameStateInitAll(gameState, { _s6.MapSize, _s6.MapSize });
} }
/** /**

View File

@@ -39,8 +39,7 @@ using namespace OpenRCT2;
bool gPreviewingTitleSequenceInGame; bool gPreviewingTitleSequenceInGame;
static TitleScreen* _singleton = nullptr; static TitleScreen* _singleton = nullptr;
TitleScreen::TitleScreen(GameState& gameState) TitleScreen::TitleScreen()
: _gameState(gameState)
{ {
_singleton = this; _singleton = this;
} }
@@ -129,7 +128,7 @@ void TitleScreen::Load()
GetContext()->GetNetwork().Close(); GetContext()->GetNetwork().Close();
#endif #endif
OpenRCT2::Audio::StopAll(); OpenRCT2::Audio::StopAll();
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gameStateInitAll(GetGameState(), DEFAULT_MAP_SIZE);
ViewportInitAll(); ViewportInitAll();
ContextOpenWindow(WindowClass::MainWindow); ContextOpenWindow(WindowClass::MainWindow);
CreateWindows(); CreateWindows();
@@ -173,7 +172,7 @@ void TitleScreen::Tick()
} }
for (int32_t i = 0; i < numUpdates; i++) for (int32_t i = 0; i < numUpdates; i++)
{ {
_gameState.UpdateLogic(); gameStateUpdateLogic();
} }
UpdatePaletteEffects(); UpdatePaletteEffects();
// update_weather_animation(); // update_weather_animation();
@@ -336,7 +335,7 @@ bool TitleScreen::TryLoadSequence(bool loadPreview)
_loadedTitleSequenceId = SIZE_MAX; _loadedTitleSequenceId = SIZE_MAX;
if (!loadPreview) if (!loadPreview)
{ {
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gameStateInitAll(GetGameState(), DEFAULT_MAP_SIZE);
GameNotifyMapChanged(); GameNotifyMapChanged();
} }
return false; return false;

View File

@@ -16,12 +16,10 @@ struct ITitleSequencePlayer;
namespace OpenRCT2 namespace OpenRCT2
{ {
class GameState;
class TitleScreen final class TitleScreen final
{ {
public: public:
TitleScreen(GameState& gameState); TitleScreen();
~TitleScreen(); ~TitleScreen();
ITitleSequencePlayer* GetSequencePlayer(); ITitleSequencePlayer* GetSequencePlayer();
@@ -38,8 +36,6 @@ namespace OpenRCT2
void ChangePresetSequence(size_t preset); void ChangePresetSequence(size_t preset);
private: private:
GameState& _gameState;
ITitleSequencePlayer* _sequencePlayer = nullptr; ITitleSequencePlayer* _sequencePlayer = nullptr;
size_t _loadedTitleSequenceId = SIZE_MAX; size_t _loadedTitleSequenceId = SIZE_MAX;
size_t _currentSequence = SIZE_MAX; size_t _currentSequence = SIZE_MAX;

View File

@@ -45,8 +45,6 @@ TEST(MultiLaunchTest, all)
// Check ride count to check load was successful // Check ride count to check load was successful
ASSERT_EQ(RideGetCount(), 134); ASSERT_EQ(RideGetCount(), 134);
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
auto& date = GetGameState().Date; auto& date = GetGameState().Date;
// NOTE: This value is saved in the SV6 file, after the import this will be the current state. // NOTE: This value is saved in the SV6 file, after the import this will be the current state.
@@ -55,7 +53,7 @@ TEST(MultiLaunchTest, all)
for (int j = 0; j < updatesToTest; j++) for (int j = 0; j < updatesToTest; j++)
{ {
gs->UpdateLogic(); gameStateUpdateLogic();
} }
ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest); ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest);

View File

@@ -68,11 +68,11 @@ static std::unique_ptr<IContext> localStartGame(const std::string& parkPath)
return context; return context;
} }
template<class Fn> static bool updateUntil(GameState& gs, int maxSteps, Fn&& fn) template<class Fn> static bool updateUntil(int maxSteps, Fn&& fn)
{ {
while (maxSteps-- && !fn()) while (maxSteps-- && !fn())
{ {
gs.UpdateLogic(); gameStateUpdateLogic();
} }
return maxSteps > 0; return maxSteps > 0;
} }
@@ -96,9 +96,6 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
auto context = localStartGame(initStateFile); auto context = localStartGame(initStateFile);
ASSERT_NE(context.get(), nullptr); ASSERT_NE(context.get(), nullptr);
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Open park for free but charging for rides // Open park for free but charging for rides
@@ -125,7 +122,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
richGuest->CashInPocket = 3000; richGuest->CashInPocket = 3000;
// Wait for rich guest to get in queue // Wait for rich guest to get in queue
bool matched = updateUntil(*gs, 1000, [&]() { return richGuest->State == PeepState::Queuing; }); bool matched = updateUntil(1000, [&]() { return richGuest->State == PeepState::Queuing; });
ASSERT_TRUE(matched); ASSERT_TRUE(matched);
// Insert poor guest // Insert poor guest
@@ -133,7 +130,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
poorGuest->CashInPocket = 5; poorGuest->CashInPocket = 5;
// Wait for poor guest to get in queue // Wait for poor guest to get in queue
matched = updateUntil(*gs, 1000, [&]() { return poorGuest->State == PeepState::Queuing; }); matched = updateUntil(1000, [&]() { return poorGuest->State == PeepState::Queuing; });
ASSERT_TRUE(matched); ASSERT_TRUE(matched);
// Raise the price of the ride to a value poor guest can't pay // Raise the price of the ride to a value poor guest can't pay
@@ -142,7 +139,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
// Verify that the poor guest goes back to walking without riding // Verify that the poor guest goes back to walking without riding
// since it doesn't have enough money to pay for it // since it doesn't have enough money to pay for it
bool enteredTheRide = false; bool enteredTheRide = false;
matched = updateUntil(*gs, 10000, [&]() { matched = updateUntil(10000, [&]() {
enteredTheRide |= poorGuest->State == PeepState::OnRide; enteredTheRide |= poorGuest->State == PeepState::OnRide;
return poorGuest->State == PeepState::Walking || enteredTheRide; return poorGuest->State == PeepState::Walking || enteredTheRide;
}); });
@@ -159,9 +156,6 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests)
auto context = localStartGame(initStateFile); auto context = localStartGame(initStateFile);
ASSERT_NE(context.get(), nullptr); ASSERT_NE(context.get(), nullptr);
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Open park for free but charging for rides // Open park for free but charging for rides
@@ -191,7 +185,7 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests)
// Wait until one of them is riding // Wait until one of them is riding
auto guestIsOnRide = [](auto* g) { return g->State == PeepState::OnRide; }; auto guestIsOnRide = [](auto* g) { return g->State == PeepState::OnRide; };
bool matched = updateUntil(*gs, 10000, [&]() { return std::any_of(guests.begin(), guests.end(), guestIsOnRide); }); bool matched = updateUntil(10000, [&]() { return std::any_of(guests.begin(), guests.end(), guestIsOnRide); });
ASSERT_TRUE(matched); ASSERT_TRUE(matched);
// For the next few ticks at most two guests can be on the ride // For the next few ticks at most two guests can be on the ride
@@ -199,6 +193,6 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests)
{ {
int numRiding = std::count_if(guests.begin(), guests.end(), guestIsOnRide); int numRiding = std::count_if(guests.begin(), guests.end(), guestIsOnRide);
ASSERT_LE(numRiding, 2); ASSERT_LE(numRiding, 2);
gs->UpdateLogic(); gameStateUpdateLogic();
} }
} }

View File

@@ -81,9 +81,6 @@ TEST_P(ReplayTests, RunReplay)
bool initialised = context->Initialise(); bool initialised = context->Initialise();
ASSERT_TRUE(initialised); ASSERT_TRUE(initialised);
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
IReplayManager* replayManager = context->GetReplayManager(); IReplayManager* replayManager = context->GetReplayManager();
ASSERT_NE(replayManager, nullptr); ASSERT_NE(replayManager, nullptr);
@@ -92,7 +89,7 @@ TEST_P(ReplayTests, RunReplay)
while (replayManager->IsReplaying()) while (replayManager->IsReplaying())
{ {
gs->UpdateLogic(); gameStateUpdateLogic();
if (replayManager->IsPlaybackStateMismatching()) if (replayManager->IsPlaybackStateMismatching())
break; break;
} }

View File

@@ -138,10 +138,9 @@ static void RecordGameStateSnapshot(std::unique_ptr<IContext>& context, MemorySt
static void AdvanceGameTicks(uint32_t ticks, std::unique_ptr<IContext>& context) static void AdvanceGameTicks(uint32_t ticks, std::unique_ptr<IContext>& context)
{ {
auto* gameState = context->GetGameState();
for (uint32_t i = 0; i < ticks; i++) for (uint32_t i = 0; i < ticks; i++)
{ {
gameState->UpdateLogic(); gameStateUpdateLogic();
} }
} }