diff options
Diffstat (limited to 'StarsEx/StarServer.cpp')
-rw-r--r-- | StarsEx/StarServer.cpp | 98 |
1 files changed, 42 insertions, 56 deletions
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 <iostream> +#include "StarServer.h" +#include <stdlib.h> + +#include <iostream> -#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; +} |