diff options
Diffstat (limited to 'StarsEx')
-rw-r--r-- | StarsEx/StarServer.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/StarsEx/StarServer.cpp b/StarsEx/StarServer.cpp index 29e9470..b9ba942 100644 --- a/StarsEx/StarServer.cpp +++ b/StarsEx/StarServer.cpp @@ -207,10 +207,8 @@ StarServer::SetGameMode(int m) Print(" game_mode = MENU_MODE\n"); paused = true; - Sim* sim = (Sim*) world; - - if (sim) - sim->UnloadMission(); + if (auto sim = dynamic_cast<Sim*>(world)) + sim->UnloadMission(); } game_mode = m; @@ -224,8 +222,7 @@ StarServer::CreateWorld() // create world if (!world) { - Sim* sim = new Sim(nullptr); - world = sim; + world = new Sim(nullptr); Print(" World Created.\n"); } } @@ -239,9 +236,7 @@ StarServer::InstantiateMission() current_mission = Campaign::GetCampaign()->GetMission(); } - Sim* sim = (Sim*) world; - - if (sim) { + if (auto sim = dynamic_cast<Sim*>(world)) { sim->UnloadMission(); if (current_mission) { |