From 37d4fd61b47137b4f4bc6209c8ecec56981c2007 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 9 Apr 2022 22:16:27 +0200 Subject: Removed dependency on Starshatter in some dialogs and mission gens --- StarsEx/AudDlg.cpp | 1 - StarsEx/AwardDlg.cpp | 14 +++----------- StarsEx/AwardShowDlg.cpp | 1 - StarsEx/CampaignMissionFighter.cpp | 6 ++---- StarsEx/CampaignMissionStarship.cpp | 6 ++---- StarsEx/CmdDlg.cpp | 8 +++----- StarsEx/CmdDlg.h | 1 - StarsEx/CmdForceDlg.cpp | 4 +--- StarsEx/CmdForceDlg.h | 1 - StarsEx/CmdMsgDlg.cpp | 1 - StarsEx/CmdOrdersDlg.cpp | 4 +--- StarsEx/CmdOrdersDlg.h | 1 - StarsEx/CmdTheaterDlg.cpp | 4 +--- StarsEx/CmdTheaterDlg.h | 1 - StarsEx/CmdTitleDlg.cpp | 4 +--- StarsEx/CmdTitleDlg.h | 1 - StarsEx/CmpCompleteDlg.cpp | 2 -- StarsEx/CmpFileDlg.cpp | 1 - StarsEx/ConfirmDlg.cpp | 1 - StarsEx/DebriefDlg.cpp | 15 +++------------ 20 files changed, 17 insertions(+), 60 deletions(-) (limited to 'StarsEx') diff --git a/StarsEx/AudDlg.cpp b/StarsEx/AudDlg.cpp index ec25996..fe6e14d 100644 --- a/StarsEx/AudDlg.cpp +++ b/StarsEx/AudDlg.cpp @@ -13,7 +13,6 @@ #include "AudDlg.h" #include "MenuScreen.h" -#include "Starshatter.h" #include "AudioConfig.h" #include "DataLoader.h" diff --git a/StarsEx/AwardDlg.cpp b/StarsEx/AwardDlg.cpp index 90e1bb4..7ec04a5 100644 --- a/StarsEx/AwardDlg.cpp +++ b/StarsEx/AwardDlg.cpp @@ -13,7 +13,6 @@ #include "AwardDlg.h" #include "PlanScreen.h" -#include "Starshatter.h" #include "Ship.h" #include "Player.h" #include "Campaign.h" @@ -29,7 +28,6 @@ #include "Keyboard.h" #include "Mouse.h" #include "Sound.h" -#include "Panic.h" // +--------------------------------------------------------------------+ // DECLARE MAPPING FUNCTIONS: @@ -134,18 +132,12 @@ AwardDlg::OnClose(AWEvent* event) if (player) player->ClearShowAward(); - Starshatter* stars = Starshatter::GetInstance(); - - if (stars) { + if (auto game = Game::GetInstance()) { Mouse::Show(false); - Campaign* campaign = Campaign::GetCampaign(); if (campaign && campaign->GetCampaignId() < Campaign::SINGLE_MISSIONS) - stars->SetGameMode(Game::CMPN_MODE); + game->SetGameMode(Game::CMPN_MODE); else - stars->SetGameMode(Game::MENU_MODE); + game->SetGameMode(Game::MENU_MODE); } - - else - Panic::Panic("AwardDlg::OnClose() - Game instance not found"); } diff --git a/StarsEx/AwardShowDlg.cpp b/StarsEx/AwardShowDlg.cpp index 10e6423..750c4ed 100644 --- a/StarsEx/AwardShowDlg.cpp +++ b/StarsEx/AwardShowDlg.cpp @@ -13,7 +13,6 @@ #include "AwardShowDlg.h" #include "MenuScreen.h" -#include "Starshatter.h" #include "Ship.h" #include "Player.h" #include "Campaign.h" diff --git a/StarsEx/CampaignMissionFighter.cpp b/StarsEx/CampaignMissionFighter.cpp index 78409e9..1e851eb 100644 --- a/StarsEx/CampaignMissionFighter.cpp +++ b/StarsEx/CampaignMissionFighter.cpp @@ -28,7 +28,6 @@ #include "Instruction.h" #include "Ship.h" #include "ShipDesign.h" -#include "Starshatter.h" #include "StarSystem.h" #include "Player.h" @@ -2149,7 +2148,6 @@ CampaignMissionFighter::DescribeMission() void CampaignMissionFighter::Exit() { - Starshatter* stars = Starshatter::GetInstance(); - if (stars) - stars->SetGameMode(Game::MENU_MODE); + if (auto game = Game::GetInstance()) + game->SetGameMode(Game::MENU_MODE); } diff --git a/StarsEx/CampaignMissionStarship.cpp b/StarsEx/CampaignMissionStarship.cpp index 63f182e..2857ebb 100644 --- a/StarsEx/CampaignMissionStarship.cpp +++ b/StarsEx/CampaignMissionStarship.cpp @@ -27,7 +27,6 @@ #include "Instruction.h" #include "Ship.h" #include "ShipDesign.h" -#include "Starshatter.h" #include "StarSystem.h" #include "Player.h" #include "ContentBundle.h" @@ -1398,7 +1397,6 @@ CampaignMissionStarship::DescribeMission() void CampaignMissionStarship::Exit() { - Starshatter* stars = Starshatter::GetInstance(); - if (stars) - stars->SetGameMode(Game::MENU_MODE); + if (auto game = Game::GetInstance()) + game->SetGameMode(Game::MENU_MODE); } diff --git a/StarsEx/CmdDlg.cpp b/StarsEx/CmdDlg.cpp index 89f7a9e..0392e24 100644 --- a/StarsEx/CmdDlg.cpp +++ b/StarsEx/CmdDlg.cpp @@ -14,7 +14,6 @@ #include "CmdDlg.h" #include "CmpFileDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "Combatant.h" #include "CombatGroup.h" @@ -35,9 +34,8 @@ CmdDlg::CmdDlg(CmpnScreen* mgr) : cmpn_screen(mgr), txt_group(0), txt_score(0), txt_name(0), txt_time(0), - btn_save(0), btn_exit(0), stars(0), campaign(0), mode(0) + btn_save(0), btn_exit(0), campaign(0), mode(0) { - stars = Starshatter::GetInstance(); campaign = Campaign::GetCampaign(); for (int i = 0; i < 5; i++) @@ -173,9 +171,9 @@ CmdDlg::OnSave(AWEvent* event) void CmdDlg::OnExit(AWEvent* event) { - if (stars) { + if (auto game = Game::GetInstance()) { Mouse::Show(false); - stars->SetGameMode(Game::MENU_MODE); + game->SetGameMode(Game::MENU_MODE); } } diff --git a/StarsEx/CmdDlg.h b/StarsEx/CmdDlg.h index 6d4ba40..5bdc3d1 100644 --- a/StarsEx/CmdDlg.h +++ b/StarsEx/CmdDlg.h @@ -72,7 +72,6 @@ protected: Button* btn_save; Button* btn_exit; - Starshatter* stars; Campaign* campaign; int mode; diff --git a/StarsEx/CmdForceDlg.cpp b/StarsEx/CmdForceDlg.cpp index 91f8cb6..508ff01 100644 --- a/StarsEx/CmdForceDlg.cpp +++ b/StarsEx/CmdForceDlg.cpp @@ -14,7 +14,6 @@ #include "CmdForceDlg.h" #include "CmdMsgDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "Combatant.h" #include "CombatAssignment.h" @@ -53,10 +52,9 @@ DEF_MAP_CLIENT(CmdForceDlg, OnTransfer); CmdForceDlg::CmdForceDlg(Screen* s, FormDef& def, CmpnScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), CmdDlg(mgr), cmb_forces(0), lst_combat(0), lst_desc(0), - stars(0), campaign(0), current_group(0), current_unit(0), + campaign(0), current_group(0), current_unit(0), btn_transfer(0) { - stars = Starshatter::GetInstance(); campaign = Campaign::GetCampaign(); Init(def); diff --git a/StarsEx/CmdForceDlg.h b/StarsEx/CmdForceDlg.h index f85e9e9..9e5e5c1 100644 --- a/StarsEx/CmdForceDlg.h +++ b/StarsEx/CmdForceDlg.h @@ -58,7 +58,6 @@ protected: ListBox* lst_desc; Button* btn_transfer; - Starshatter* stars; Campaign* campaign; CombatGroup* current_group; CombatUnit* current_unit; diff --git a/StarsEx/CmdMsgDlg.cpp b/StarsEx/CmdMsgDlg.cpp index 0d0b0ba..81766fb 100644 --- a/StarsEx/CmdMsgDlg.cpp +++ b/StarsEx/CmdMsgDlg.cpp @@ -12,7 +12,6 @@ #include "CmdMsgDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Game.h" #include "ListBox.h" diff --git a/StarsEx/CmdOrdersDlg.cpp b/StarsEx/CmdOrdersDlg.cpp index 7fd4183..41c5265 100644 --- a/StarsEx/CmdOrdersDlg.cpp +++ b/StarsEx/CmdOrdersDlg.cpp @@ -14,7 +14,6 @@ #include "CmdOrdersDlg.h" #include "CmdDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "Combatant.h" #include "CombatGroup.h" @@ -45,9 +44,8 @@ DEF_MAP_CLIENT(CmdOrdersDlg, OnExit); CmdOrdersDlg::CmdOrdersDlg(Screen* s, FormDef& def, CmpnScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), CmdDlg(mgr), manager(mgr), - lbl_orders(0), stars(0), campaign(0) + lbl_orders(0), campaign(0) { - stars = Starshatter::GetInstance(); campaign = Campaign::GetCampaign(); Init(def); diff --git a/StarsEx/CmdOrdersDlg.h b/StarsEx/CmdOrdersDlg.h index 7b7f55e..3b02cca 100644 --- a/StarsEx/CmdOrdersDlg.h +++ b/StarsEx/CmdOrdersDlg.h @@ -47,7 +47,6 @@ protected: ActiveWindow* lbl_orders; - Starshatter* stars; Campaign* campaign; }; diff --git a/StarsEx/CmdTheaterDlg.cpp b/StarsEx/CmdTheaterDlg.cpp index b07fa70..6201334 100644 --- a/StarsEx/CmdTheaterDlg.cpp +++ b/StarsEx/CmdTheaterDlg.cpp @@ -15,7 +15,6 @@ #include "CmdDlg.h" #include "CmpnScreen.h" #include "Galaxy.h" -#include "Starshatter.h" #include "StarSystem.h" #include "Campaign.h" #include "Combatant.h" @@ -61,9 +60,8 @@ const int VIEW_REGION = 2; CmdTheaterDlg::CmdTheaterDlg(Screen* s, FormDef& def, CmpnScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), CmdDlg(mgr), manager(mgr), - map_theater(0), map_view(0), stars(0), campaign(0) + map_theater(0), map_view(0), campaign(0) { - stars = Starshatter::GetInstance(); campaign = Campaign::GetCampaign(); Init(def); diff --git a/StarsEx/CmdTheaterDlg.h b/StarsEx/CmdTheaterDlg.h index 102db50..aba1057 100644 --- a/StarsEx/CmdTheaterDlg.h +++ b/StarsEx/CmdTheaterDlg.h @@ -53,7 +53,6 @@ protected: Button* zoom_in_btn; Button* zoom_out_btn; - Starshatter* stars; Campaign* campaign; }; diff --git a/StarsEx/CmdTitleDlg.cpp b/StarsEx/CmdTitleDlg.cpp index dfc89ff..8ebbcee 100644 --- a/StarsEx/CmdTitleDlg.cpp +++ b/StarsEx/CmdTitleDlg.cpp @@ -13,7 +13,6 @@ #include "CmdTitleDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "Combatant.h" #include "CombatEvent.h" @@ -40,9 +39,8 @@ CmdTitleDlg::CmdTitleDlg(Screen* s, FormDef& def, CmpnScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), -stars(0), campaign(0), showTime(0) +campaign(0), showTime(0) { - stars = Starshatter::GetInstance(); campaign = Campaign::GetCampaign(); Init(def); diff --git a/StarsEx/CmdTitleDlg.h b/StarsEx/CmdTitleDlg.h index 9bac729..9ab2563 100644 --- a/StarsEx/CmdTitleDlg.h +++ b/StarsEx/CmdTitleDlg.h @@ -46,7 +46,6 @@ protected: ImageBox* img_title; - Starshatter* stars; Campaign* campaign; double showTime; }; diff --git a/StarsEx/CmpCompleteDlg.cpp b/StarsEx/CmpCompleteDlg.cpp index a80e460..9047ac7 100644 --- a/StarsEx/CmpCompleteDlg.cpp +++ b/StarsEx/CmpCompleteDlg.cpp @@ -14,7 +14,6 @@ #include "CmpnScreen.h" #include "Campaign.h" #include "CombatEvent.h" -#include "Starshatter.h" #include "Game.h" #include "DataLoader.h" @@ -62,7 +61,6 @@ CmpCompleteDlg::Show() if (img_title && c) { DataLoader* loader = DataLoader::GetLoader(); - Starshatter* stars = Starshatter::GetInstance(); CombatEvent* event = c->GetLastEvent(); char img_name[256]; diff --git a/StarsEx/CmpFileDlg.cpp b/StarsEx/CmpFileDlg.cpp index 1f359e5..87856cb 100644 --- a/StarsEx/CmpFileDlg.cpp +++ b/StarsEx/CmpFileDlg.cpp @@ -13,7 +13,6 @@ #include "CmpFileDlg.h" #include "CmpnScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "CampaignSaveGame.h" #include "CombatGroup.h" diff --git a/StarsEx/ConfirmDlg.cpp b/StarsEx/ConfirmDlg.cpp index 4e528f5..87a001c 100644 --- a/StarsEx/ConfirmDlg.cpp +++ b/StarsEx/ConfirmDlg.cpp @@ -13,7 +13,6 @@ #include "ConfirmDlg.h" #include "MenuScreen.h" -#include "Starshatter.h" #include "FormatUtil.h" #include "Game.h" diff --git a/StarsEx/DebriefDlg.cpp b/StarsEx/DebriefDlg.cpp index a0a2b30..f6abdd1 100644 --- a/StarsEx/DebriefDlg.cpp +++ b/StarsEx/DebriefDlg.cpp @@ -13,7 +13,6 @@ #include "DebriefDlg.h" #include "PlanScreen.h" -#include "Starshatter.h" #include "Campaign.h" #include "Element.h" #include "Instruction.h" @@ -38,7 +37,6 @@ #include "ListBox.h" #include "Slider.h" #include "ParseUtil.h" -#include "Panic.h" #include "Game.h" // +--------------------------------------------------------------------+ @@ -355,20 +353,13 @@ DebriefDlg::OnClose(AWEvent* event) } else { - Starshatter* stars = Starshatter::GetInstance(); - - if (stars) { + if (auto game = Game::GetInstance()) { Mouse::Show(false); - Campaign* campaign = Campaign::GetCampaign(); if (campaign && campaign->GetCampaignId() < Campaign::SINGLE_MISSIONS) - stars->SetGameMode(Game::CMPN_MODE); + game->SetGameMode(Game::CMPN_MODE); else - stars->SetGameMode(Game::MENU_MODE); - } - - else { - Panic::Panic("DebriefDlg::OnClose() - Game instance not found"); + game->SetGameMode(Game::MENU_MODE); } } } -- cgit v1.1