summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-24 22:40:31 +0100
committerAki <please@ignore.pl>2022-03-24 22:48:13 +0100
commit72bb517271dad40a440533ad0796a88247011199 (patch)
treee98ecbc4c2b0f6755944a889544ccffc91ed71d9
parent153f8032eebd9a61d525b0532b54b68e91625492 (diff)
downloadstarshatter-72bb517271dad40a440533ad0796a88247011199.zip
starshatter-72bb517271dad40a440533ad0796a88247011199.tar.gz
starshatter-72bb517271dad40a440533ad0796a88247011199.tar.bz2
Starserver no longer initializes windows application
-rw-r--r--Stars45/StarServer.cpp75
-rw-r--r--Stars45/StarServer.h5
2 files changed, 9 insertions, 71 deletions
diff --git a/Stars45/StarServer.cpp b/Stars45/StarServer.cpp
index 5385a6b..c95b2cb 100644
--- a/Stars45/StarServer.cpp
+++ b/Stars45/StarServer.cpp
@@ -7,6 +7,8 @@
*/
+#include <iostream>
+
#include "MemDebug.h"
#include "StarServer.h"
@@ -44,7 +46,6 @@
#include "Token.h"
#include "MachineInfo.h"
#include "Game.h"
-#include "GameWinDX9.h"
#include "Clock.h"
#include "ContentBundle.h"
#include "Keyboard.h"
@@ -142,7 +143,7 @@ StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
if (loader)
loader->UseFileSystem(false);
- return GameWinDX9::Init(hi, hpi, cmdline, nCmdShow);
+ return Game::Init(hi, hpi, cmdline, nCmdShow);
}
// +--------------------------------------------------------------------+
@@ -150,7 +151,7 @@ StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
bool
StarServer::InitGame()
{
- if (!GameWinDX9::InitGame())
+ if (!Game::InitGame())
return false;
RandomInit();
@@ -196,6 +197,8 @@ StarServer::InitGame()
lobby_server = nls;
admin_server = nas;
+ std::cout << "Started server listening on port " << server_config->GetLobbyPort() << std::endl;
+
return true;
}
@@ -285,6 +288,7 @@ StarServer::InstantiateMission()
sim->SetTestMode(false);
Print(" Mission Instantiated.\n");
+ std::cout << "Loaded mission: " << current_mission->Name() << std::endl;
}
else {
@@ -388,71 +392,6 @@ StarServer::GameState()
// +--------------------------------------------------------------------+
-bool
-StarServer::OnPaint()
-{
- PAINTSTRUCT paintstruct;
- HDC hdc = BeginPaint(hwnd, &paintstruct);
-
- Text txt_title = title_text;
- Text txt_mode;
- Text txt_users = ContentBundle::GetInstance()->GetText("server.no-users");
- char buf[256];
-
- txt_title += " ";
- txt_title += versionInfo;
-
- switch (game_mode) {
- case LOAD_MODE:
- case MENU_MODE:
- txt_mode = ContentBundle::GetInstance()->GetText("server.mode.lobby");
-
- if (lobby_server) {
- sprintf_s(buf, ContentBundle::GetInstance()->GetText("server.users").data(), lobby_server->NumUsers());
- txt_users = buf;
- }
- break;
-
- case PLAY_MODE:
- txt_mode = ContentBundle::GetInstance()->GetText("server.mode.active");
- if (lobby_server) {
- sprintf_s(buf, ContentBundle::GetInstance()->GetText("server.users-and-players").data(), lobby_server->NumUsers(), NetGame::NumPlayers());
- }
- else {
- sprintf_s(buf, ContentBundle::GetInstance()->GetText("server.players").data(), NetGame::NumPlayers());
- }
- txt_users = buf;
- break;
-
- default:
- txt_mode = ContentBundle::GetInstance()->GetText("server.mode.other");
- break;
- }
-
- if (lobby_server && lobby_server->GetStatus() == NetServerInfo::PERSISTENT)
- txt_mode += " " + ContentBundle::GetInstance()->GetText("server.alt.persistent");
-
- if (paused)
- txt_mode += " " + ContentBundle::GetInstance()->GetText("server.alt.paused");
-
- TextOut(hdc, 4, 4, txt_title, txt_title.length());
- TextOut(hdc, 4, 22, txt_mode, txt_mode.length());
- TextOut(hdc, 4, 40, txt_users, txt_users.length());
-
- Sim* sim = Sim::GetSim();
- if (sim && sim->GetMission()) {
- Mission* mission = sim->GetMission();
- Text txt_msn = ContentBundle::GetInstance()->GetText("server.mission");
- txt_msn += mission->Name();
- TextOut(hdc, 4, 58, txt_msn, txt_msn.length());
- }
-
- EndPaint(hwnd, &paintstruct);
- return true;
-}
-
-// +--------------------------------------------------------------------+
-
DWORD WINAPI StarServerShutdownProc(LPVOID link)
{
StarServer* stars = (StarServer*) link;
diff --git a/Stars45/StarServer.h b/Stars45/StarServer.h
index 434b3ac..9776e07 100644
--- a/Stars45/StarServer.h
+++ b/Stars45/StarServer.h
@@ -11,7 +11,7 @@
#define StarServer_h
#include "Types.h"
-#include "GameWinDX9.h"
+#include "Game.h"
#include "Bitmap.h"
#include "KeyMap.h"
@@ -31,7 +31,7 @@ class NetLobbyServer;
// +--------------------------------------------------------------------+
-class StarServer : public GameWinDX9
+class StarServer : public Game
{
public:
StarServer();
@@ -40,7 +40,6 @@ public:
virtual bool Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow);
virtual bool InitGame();
virtual void GameState();
- virtual bool OnPaint();
enum MODE { MENU_MODE, // main menu
LOAD_MODE, // loading mission into simulator