From 02e0a382c10d183cf8d53ad031fed26b7e596cc5 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 6 Apr 2022 23:29:35 +0200 Subject: Cleaned up StarServer files --- StarsEx/StarServer.cpp | 98 ++++++++++++++++++++++---------------------------- StarsEx/StarServer.h | 33 ++++++----------- 2 files changed, 53 insertions(+), 78 deletions(-) (limited to 'StarsEx') diff --git a/StarsEx/StarServer.cpp b/StarsEx/StarServer.cpp index a2c9635..5173a50 100644 --- a/StarsEx/StarServer.cpp +++ b/StarsEx/StarServer.cpp @@ -7,71 +7,56 @@ */ -#include +#include "StarServer.h" +#include + +#include -#include "StarServer.h" #include "Campaign.h" +#include "Clock.h" #include "CombatRoster.h" -#include "Galaxy.h" -#include "Mission.h" -#include "Sim.h" -#include "SimEvent.h" -#include "Ship.h" -#include "Contact.h" -#include "QuantumDrive.h" -#include "Power.h" -#include "SystemDesign.h" -#include "WeaponDesign.h" -#include "Shot.h" +#include "DataLoader.h" #include "Drive.h" #include "Explosion.h" #include "FlightDeck.h" -#include "RadioMessage.h" -#include "RadioTraffic.h" -#include "Random.h" +#include "Galaxy.h" +#include "Game.h" #include "ModConfig.h" - -#include "NetLayer.h" -#include "NetGame.h" -#include "NetHost.h" -#include "NetServer.h" -#include "HttpServer.h" -#include "HttpServletExec.h" #include "NetAdminServer.h" +#include "NetGame.cpp" +#include "NetLobby.h" #include "NetLobbyServer.h" #include "NetServerConfig.h" +#include "RadioTraffic.h" +#include "Random.h" +#include "Ship.h" +#include "Shot.h" +#include "Sim.h" +#include "SystemDesign.h" +#include "Types.h" +#include "Utils.h" +#include "WeaponDesign.h" -#include "Token.h" -#include "MachineInfo.h" -#include "Game.h" -#include "Clock.h" -#include "ContentBundle.h" -#include "Keyboard.h" -#include "Mouse.h" -#include "EventDispatch.h" -#include "MultiController.h" -#include "DataLoader.h" -#include "ParseUtil.h" -#include "VersionInfo.h" -// +--------------------------------------------------------------------+ +StarServer* StarServer::instance {nullptr}; -StarServer* StarServer::instance {nullptr}; -static Mission* current_mission = 0; -static double time_til_change = 0; -static bool exit_latch = true; +StarServer* +StarServer::GetInstance() +{ + return instance; +} -// +--------------------------------------------------------------------+ StarServer::StarServer() : world {nullptr}, - loader(0), - time_mark(0), - minutes(0), - admin_server(0), - lobby_server(0) + current_mission {nullptr}, + admin_server {nullptr}, + lobby_server {nullptr}, + loader {nullptr}, + time_mark {0}, + minutes {0} { if (instance != nullptr) throw "StarServer may have only one instance"; @@ -106,8 +91,8 @@ StarServer::~StarServer() delete admin_server; delete lobby_server; - admin_server = 0; - lobby_server = 0; + admin_server = nullptr; + lobby_server = nullptr; // delete all the ships and stuff // BEFORE getting rid of the system @@ -133,7 +118,6 @@ StarServer::~StarServer() instance = nullptr; } -// +--------------------------------------------------------------------+ bool StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow) @@ -144,7 +128,6 @@ StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow) return Game::Init(hi, hpi, cmdline, nCmdShow); } -// +--------------------------------------------------------------------+ bool StarServer::InitGame() @@ -200,7 +183,6 @@ StarServer::InitGame() return true; } -// +--------------------------------------------------------------------+ void StarServer::SetGameMode(int m) @@ -240,7 +222,6 @@ StarServer::SetGameMode(int m) game_mode = m; } -// +--------------------------------------------------------------------+ void StarServer::CreateWorld() @@ -249,7 +230,7 @@ StarServer::CreateWorld() // create world if (!world) { - Sim* sim = new Sim(0); + Sim* sim = new Sim(nullptr); world = sim; Print(" World Created.\n"); } @@ -258,7 +239,7 @@ StarServer::CreateWorld() void StarServer::InstantiateMission() { - current_mission = 0; + current_mission = nullptr; if (Campaign::GetCampaign()) { current_mission = Campaign::GetCampaign()->GetMission(); @@ -284,7 +265,6 @@ StarServer::InstantiateMission() } } -// +--------------------------------------------------------------------+ void StarServer::UpdateWorld() @@ -313,7 +293,6 @@ StarServer::UpdateWorld() } } -// +--------------------------------------------------------------------+ void StarServer::GameState() @@ -349,3 +328,10 @@ StarServer::GameState() Sleep(10); } } + + +bool +StarServer::Server() +{ + return true; +} diff --git a/StarsEx/StarServer.h b/StarsEx/StarServer.h index 2164ce0..565f61d 100644 --- a/StarsEx/StarServer.h +++ b/StarsEx/StarServer.h @@ -10,31 +10,20 @@ #ifndef StarServer_h #define StarServer_h -#include "Types.h" +#include "DataLoader.h" #include "Game.h" -#include "Bitmap.h" -#include "KeyMap.h" - -// +--------------------------------------------------------------------+ - -class Universe; -class Campaign; -class Ship; -class Sim; -class FadeView; -class CameraDirector; -class MultiController; -class MouseController; -class DataLoader; - -class NetServer; -class NetLobbyServer; +#include "NetLobbyServer.h" +#include "NetServer.h" +#include "Mission.h" +#include "Types.h" +#include "Universe.h" -// +--------------------------------------------------------------------+ class StarServer : public Game { public: + static StarServer* GetInstance(); + StarServer(); virtual ~StarServer(); @@ -42,18 +31,17 @@ public: virtual bool InitGame(); virtual void GameState(); - bool Server() override { return true; } + bool Server() override; void SetGameMode(int mode) override; void CreateWorld(); - static StarServer* GetInstance() { return instance; } - protected: virtual void UpdateWorld(); virtual void InstantiateMission(); Universe* world; + Mission* current_mission; NetServer* admin_server; NetLobbyServer* lobby_server; @@ -66,4 +54,5 @@ private: static StarServer* instance; }; + #endif // StarServer_h -- cgit v1.1