diff options
author | Aki <please@ignore.pl> | 2022-04-06 23:57:32 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-06 23:57:32 +0200 |
commit | 2b8fa926eb8badc2f7e6716e4bdcdb2456216b8f (patch) | |
tree | f1dbb4e72ef4ff949ff43674ec10bbf38eb7197d /StarsEx | |
parent | c7644a37b7801a8a1755cf6219443375797a57c5 (diff) | |
download | starshatter-2b8fa926eb8badc2f7e6716e4bdcdb2456216b8f.zip starshatter-2b8fa926eb8badc2f7e6716e4bdcdb2456216b8f.tar.gz starshatter-2b8fa926eb8badc2f7e6716e4bdcdb2456216b8f.tar.bz2 |
Replaced c-style casts of derived classes with dynamic_cast
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) { |