Remove LoadScripts from CSimualation2

`LoadScripts` and `LoadDefaultScripts` have to be called imediately
after the `CSimulation2` constructor.

By doing the necesarry work in the constructor and removing
`LoadScripts` and `LoadDefaultScripts` the interface of `CSimulation2`
is simplified.
This commit is contained in:
phosit
2025-11-21 18:57:53 +01:00
parent 0b83e24065
commit ba2351611c
13 changed files with 61 additions and 89 deletions
+2 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games.
/* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -80,7 +80,7 @@ const CStr CGame::EventNameSimulationUpdate = "SimulationUpdate";
CGame::CGame(bool replayLog, const SimulationDebugOptions debugOptions):
m_World(new CWorld(*this)),
m_Simulation2{new CSimulation2{&m_World->GetUnitManager(), *g_ScriptContext, &m_World->GetTerrain(),
debugOptions}},
CSimulation2::DEFAULT_SCRIPTS, debugOptions}},
// TODO: we need to remove that global dependency. Maybe the game view
// should be created outside only if needed.
m_GameView(CRenderer::IsInitialised() ? new CGameView(g_VideoMode.GetBackendDevice(), this) : nullptr),
@@ -106,8 +106,6 @@ CGame::CGame(bool replayLog, const SimulationDebugOptions debugOptions):
m_World->GetUnitManager().SetObjectManager(m_GameView->GetObjectManager());
m_TurnManager = new CLocalTurnManager(*m_Simulation2, GetReplayLogger()); // this will get replaced if we're a net server/client
m_Simulation2->LoadDefaultScripts();
}
/**