From 5b9d9f92ea76320e405a1ffef8f1ed295cbd9999 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Tue, 5 Jun 2012 18:53:11 +0000 Subject: Documentation update --- Doc/doxygen/html/_star_server_8cpp_source.html | 838 ++++++++++++------------- 1 file changed, 407 insertions(+), 431 deletions(-) (limited to 'Doc/doxygen/html/_star_server_8cpp_source.html') diff --git a/Doc/doxygen/html/_star_server_8cpp_source.html b/Doc/doxygen/html/_star_server_8cpp_source.html index 993b3f4..6020208 100644 --- a/Doc/doxygen/html/_star_server_8cpp_source.html +++ b/Doc/doxygen/html/_star_server_8cpp_source.html @@ -198,464 +198,440 @@ $(document).ready(function(){initNavTree('_star_server_8cpp.html','');});
94  exit(-1);
95  }
96 
-
97 #ifndef STARSHATTER_DEMO_RELEASE
-
98  if (loader->FindFile("start.dat"))
-
99  loader->EnableDatafile("start.dat");
-
100 #endif
-
101 
-
102  // no images or sounds in server mode:
-
103  loader->EnableMedia(false);
-
104 }
-
105 
-
106 StarServer::~StarServer()
-
107 {
-
108  delete admin_server;
-
109  delete lobby_server;
-
110 
-
111  admin_server = 0;
-
112  lobby_server = 0;
-
113 
-
114  // delete all the ships and stuff
-
115  // BEFORE getting rid of the system
-
116  // and weapons catalogs!
-
117  delete world;
-
118  world = 0; // don't let base class double delete the world
-
119 
-
120  Drive::Close();
-
121  Explosion::Close();
-
122  FlightDeck::Close();
-
123  Campaign::Close();
-
124  CombatRoster::Close();
-
125  Galaxy::Close();
-
126  RadioTraffic::Close();
-
127  Ship::Close();
-
128  WeaponDesign::Close();
-
129  SystemDesign::Close();
-
130  DataLoader::Close();
-
131  NetServerConfig::Close();
-
132  ModConfig::Close();
+
97  if (loader->FindFile("start.dat"))
+
98  loader->EnableDatafile("start.dat");
+
99 
+
100  // no images or sounds in server mode:
+
101  loader->EnableMedia(false);
+
102 }
+
103 
+
104 StarServer::~StarServer()
+
105 {
+
106  delete admin_server;
+
107  delete lobby_server;
+
108 
+
109  admin_server = 0;
+
110  lobby_server = 0;
+
111 
+
112  // delete all the ships and stuff
+
113  // BEFORE getting rid of the system
+
114  // and weapons catalogs!
+
115  delete world;
+
116  world = 0; // don't let base class double delete the world
+
117 
+
118  Drive::Close();
+
119  Explosion::Close();
+
120  FlightDeck::Close();
+
121  Campaign::Close();
+
122  CombatRoster::Close();
+
123  Galaxy::Close();
+
124  RadioTraffic::Close();
+
125  Ship::Close();
+
126  WeaponDesign::Close();
+
127  SystemDesign::Close();
+
128  DataLoader::Close();
+
129  NetServerConfig::Close();
+
130  ModConfig::Close();
+
131 
+
132  instance = 0;
133 
-
134  instance = 0;
-
135 
-
136  Game::server = false;
-
137 }
+
134  Game::server = false;
+
135 }
+
136 
+
137 // +--------------------------------------------------------------------+
138 
-
139 // +--------------------------------------------------------------------+
-
140 
-
141 bool
-
142 StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
-
143 {
-
144  if (loader)
-
145  loader->UseFileSystem(false);
-
146 
-
147  return Game::Init(hi, hpi, cmdline, nCmdShow);
-
148 }
+
139 bool
+
140 StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
+
141 {
+
142  if (loader)
+
143  loader->UseFileSystem(false);
+
144 
+
145  return Game::Init(hi, hpi, cmdline, nCmdShow);
+
146 }
+
147 
+
148 // +--------------------------------------------------------------------+
149 
-
150 // +--------------------------------------------------------------------+
-
151 
-
152 bool
-
153 StarServer::InitGame()
-
154 {
-
155  if (!Game::InitGame())
-
156  return false;
-
157 
-
158  RandomInit();
-
159  ModConfig::Initialize();
-
160  NetServerConfig::Initialize();
-
161  SystemDesign::Initialize("sys.def");
-
162  WeaponDesign::Initialize("wep.def");
-
163  Ship::Initialize();
-
164  Galaxy::Initialize();
-
165  CombatRoster::Initialize();
-
166  Campaign::Initialize();
-
167 
-
168  Drive::Initialize();
-
169  Explosion::Initialize();
-
170  FlightDeck::Initialize();
-
171  Ship::Initialize();
-
172  Shot::Initialize();
-
173  RadioTraffic::Initialize();
-
174 
-
175  time_mark = Game::GameTime();
-
176  minutes = 0;
-
177 
-
178  NetServerConfig* server_config = NetServerConfig::GetInstance();
-
179  if (!server_config)
-
180  return false;
-
181 
-
182  ::Print("\n\n\nStarshatter Server Init\n");
-
183  ::Print("-----------------------\n");
-
184  ::Print("Server Name: %s\n", (const char*) server_config->Name());
-
185  ::Print("Server Type: %d\n", server_config->GetGameType());
-
186 
-
187  if (server_config->GetMission().length() > 0)
-
188  ::Print("Server Mission: %s\n", (const char*) server_config->GetMission());
-
189 
-
190  ::Print("Lobby Server Port: %d\n", server_config->GetLobbyPort());
-
191  ::Print("Admin Server Port: %d\n", server_config->GetAdminPort());
-
192  ::Print("-----------------------\n");
-
193 
-
194  NetLobbyServer* nls = new(__FILE__,__LINE__) NetLobbyServer;
-
195  NetAdminServer* nas = NetAdminServer::GetInstance(server_config->GetAdminPort());
-
196  nas->SetServerName(server_config->Name());
-
197 
-
198  lobby_server = nls;
-
199  admin_server = nas;
-
200 
-
201  return true;
-
202 }
+
150 bool
+
151 StarServer::InitGame()
+
152 {
+
153  if (!Game::InitGame())
+
154  return false;
+
155 
+
156  RandomInit();
+
157  ModConfig::Initialize();
+
158  NetServerConfig::Initialize();
+
159  SystemDesign::Initialize("sys.def");
+
160  WeaponDesign::Initialize("wep.def");
+
161  Ship::Initialize();
+
162  Galaxy::Initialize();
+
163  CombatRoster::Initialize();
+
164  Campaign::Initialize();
+
165 
+
166  Drive::Initialize();
+
167  Explosion::Initialize();
+
168  FlightDeck::Initialize();
+
169  Ship::Initialize();
+
170  Shot::Initialize();
+
171  RadioTraffic::Initialize();
+
172 
+
173  time_mark = Game::GameTime();
+
174  minutes = 0;
+
175 
+
176  NetServerConfig* server_config = NetServerConfig::GetInstance();
+
177  if (!server_config)
+
178  return false;
+
179 
+
180  ::Print("\n\n\nStarshatter Server Init\n");
+
181  ::Print("-----------------------\n");
+
182  ::Print("Server Name: %s\n", (const char*) server_config->Name());
+
183  ::Print("Server Type: %d\n", server_config->GetGameType());
+
184 
+
185  if (server_config->GetMission().length() > 0)
+
186  ::Print("Server Mission: %s\n", (const char*) server_config->GetMission());
+
187 
+
188  ::Print("Lobby Server Port: %d\n", server_config->GetLobbyPort());
+
189  ::Print("Admin Server Port: %d\n", server_config->GetAdminPort());
+
190  ::Print("-----------------------\n");
+
191 
+
192  NetLobbyServer* nls = new(__FILE__,__LINE__) NetLobbyServer;
+
193  NetAdminServer* nas = NetAdminServer::GetInstance(server_config->GetAdminPort());
+
194  nas->SetServerName(server_config->Name());
+
195 
+
196  lobby_server = nls;
+
197  admin_server = nas;
+
198 
+
199  return true;
+
200 }
+
201 
+
202 // +--------------------------------------------------------------------+
203 
-
204 // +--------------------------------------------------------------------+
-
205 
-
206 void
-
207 StarServer::SetGameMode(int m)
-
208 {
-
209  if (game_mode == m)
-
210  return;
-
211 
-
212  if (m == LOAD_MODE) {
-
213  Print(" game_mode = LOAD_MODE\n");
-
214  paused = true;
-
215  }
-
216 
-
217  else if (m == PLAY_MODE) {
-
218  Print(" game_mode = PLAY_MODE\n");
-
219 
-
220  if (!world) {
-
221  CreateWorld();
-
222  InstantiateMission();
-
223  }
-
224 
-
225  // stand alone server should wait for players to connect
-
226  // before unpausing the simulation...
-
227  SetTimeCompression(1);
-
228  Pause(true);
-
229  }
-
230 
-
231  else if (m == MENU_MODE) {
-
232  Print(" game_mode = MENU_MODE\n");
-
233  paused = true;
+
204 void
+
205 StarServer::SetGameMode(int m)
+
206 {
+
207  if (game_mode == m)
+
208  return;
+
209 
+
210  if (m == LOAD_MODE) {
+
211  Print(" game_mode = LOAD_MODE\n");
+
212  paused = true;
+
213  }
+
214 
+
215  else if (m == PLAY_MODE) {
+
216  Print(" game_mode = PLAY_MODE\n");
+
217 
+
218  if (!world) {
+
219  CreateWorld();
+
220  InstantiateMission();
+
221  }
+
222 
+
223  // stand alone server should wait for players to connect
+
224  // before unpausing the simulation...
+
225  SetTimeCompression(1);
+
226  Pause(true);
+
227  }
+
228 
+
229  else if (m == MENU_MODE) {
+
230  Print(" game_mode = MENU_MODE\n");
+
231  paused = true;
+
232 
+
233  Sim* sim = (Sim*) world;
234 
-
235  Sim* sim = (Sim*) world;
-
236 
-
237  if (sim)
-
238  sim->UnloadMission();
-
239  }
-
240 
-
241  game_mode = m;
-
242 }
+
235  if (sim)
+
236  sim->UnloadMission();
+
237  }
+
238 
+
239  game_mode = m;
+
240 }
+
241 
+
242 // +--------------------------------------------------------------------+
243 
-
244 // +--------------------------------------------------------------------+
-
245 
-
246 void
-
247 StarServer::SetNextMission(const char* script)
-
248 {
-
249  if (lobby_server)
-
250  lobby_server->SetServerMission(script);
-
251 }
+
244 void
+
245 StarServer::SetNextMission(const char* script)
+
246 {
+
247  if (lobby_server)
+
248  lobby_server->SetServerMission(script);
+
249 }
+
250 
+
251 // +--------------------------------------------------------------------+
252 
-
253 // +--------------------------------------------------------------------+
-
254 
-
255 void
-
256 StarServer::CreateWorld()
-
257 {
-
258  RadioTraffic::Initialize();
-
259 
-
260  // create world
-
261  if (!world) {
-
262  Sim* sim = new(__FILE__,__LINE__) Sim(0);
-
263  world = sim;
-
264  Print(" World Created.\n");
-
265  }
-
266 }
-
267 
-
268 void
-
269 StarServer::InstantiateMission()
-
270 {
-
271  Memory::Check();
+
253 void
+
254 StarServer::CreateWorld()
+
255 {
+
256  RadioTraffic::Initialize();
+
257 
+
258  // create world
+
259  if (!world) {
+
260  Sim* sim = new(__FILE__,__LINE__) Sim(0);
+
261  world = sim;
+
262  Print(" World Created.\n");
+
263  }
+
264 }
+
265 
+
266 void
+
267 StarServer::InstantiateMission()
+
268 {
+
269  Memory::Check();
+
270 
+
271  current_mission = 0;
272 
-
273  current_mission = 0;
-
274 
-
275  if (Campaign::GetCampaign()) {
-
276  current_mission = Campaign::GetCampaign()->GetMission();
-
277  }
+
273  if (Campaign::GetCampaign()) {
+
274  current_mission = Campaign::GetCampaign()->GetMission();
+
275  }
+
276 
+
277  Sim* sim = (Sim*) world;
278 
-
279  Sim* sim = (Sim*) world;
-
280 
-
281  if (sim) {
-
282  sim->UnloadMission();
-
283 
-
284  if (current_mission) {
-
285  sim->LoadMission(current_mission);
-
286  sim->ExecMission();
-
287  sim->SetTestMode(false);
-
288 
-
289  Print(" Mission Instantiated.\n");
-
290  }
-
291 
-
292  else {
-
293  Print(" *** WARNING: StarServer::InstantiateMission() - no mission selected ***\n");
-
294  }
-
295  }
-
296 
-
297  Memory::Check();
-
298 }
+
279  if (sim) {
+
280  sim->UnloadMission();
+
281 
+
282  if (current_mission) {
+
283  sim->LoadMission(current_mission);
+
284  sim->ExecMission();
+
285  sim->SetTestMode(false);
+
286 
+
287  Print(" Mission Instantiated.\n");
+
288  }
+
289 
+
290  else {
+
291  Print(" *** WARNING: StarServer::InstantiateMission() - no mission selected ***\n");
+
292  }
+
293  }
+
294 
+
295  Memory::Check();
+
296 }
+
297 
+
298 // +--------------------------------------------------------------------+
299 
-
300 // +--------------------------------------------------------------------+
-
301 
-
302 bool
-
303 StarServer::GameLoop()
-
304 {
-
305  if (active && paused) {
-
306  UpdateWorld();
-
307  GameState();
-
308  }
-
309 
-
310  else if (!active) {
-
311  UpdateWorld();
-
312  GameState();
-
313  Sleep(10);
-
314  }
-
315 
-
316  Game::GameLoop();
-
317  return false; // must return false to keep processing
-
318  // true tells the outer loop to sleep until a
-
319  // windows event is available
-
320 }
+
300 bool
+
301 StarServer::GameLoop()
+
302 {
+
303  if (active && paused) {
+
304  UpdateWorld();
+
305  GameState();
+
306  }
+
307 
+
308  else if (!active) {
+
309  UpdateWorld();
+
310  GameState();
+
311  Sleep(10);
+
312  }
+
313 
+
314  Game::GameLoop();
+
315  return false; // must return false to keep processing
+
316  // true tells the outer loop to sleep until a
+
317  // windows event is available
+
318 }
+
319 
+
320 // +--------------------------------------------------------------------+
321 
-
322 // +--------------------------------------------------------------------+
-
323 
-
324 void
-
325 StarServer::UpdateWorld()
-
326 {
-
327  long new_time = real_time;
-
328  double delta = new_time - frame_time;
-
329  seconds = max_frame_length;
-
330  gui_seconds = delta * 0.001;
-
331 
-
332  if (frame_time == 0)
-
333  gui_seconds = 0;
+
322 void
+
323 StarServer::UpdateWorld()
+
324 {
+
325  long new_time = real_time;
+
326  double delta = new_time - frame_time;
+
327  seconds = max_frame_length;
+
328  gui_seconds = delta * 0.001;
+
329 
+
330  if (frame_time == 0)
+
331  gui_seconds = 0;
+
332 
+
333  time_comp = 1;
334 
-
335  time_comp = 1;
-
336 
-
337  if (delta < max_frame_length * 1000)
-
338  seconds = delta * 0.001;
+
335  if (delta < max_frame_length * 1000)
+
336  seconds = delta * 0.001;
+
337 
+
338  frame_time = new_time;
339 
-
340  frame_time = new_time;
-
341 
-
342  Galaxy* galaxy = Galaxy::GetInstance();
-
343  if (galaxy) galaxy->ExecFrame();
-
344 
-
345  Campaign* campaign = Campaign::GetCampaign();
-
346  if (campaign) campaign->ExecFrame();
-
347 
-
348  if (paused) {
-
349  if (world)
-
350  world->ExecFrame(0);
-
351  }
-
352 
-
353  else {
-
354  game_time += (DWORD) (seconds * 1000);
+
340  Galaxy* galaxy = Galaxy::GetInstance();
+
341  if (galaxy) galaxy->ExecFrame();
+
342 
+
343  Campaign* campaign = Campaign::GetCampaign();
+
344  if (campaign) campaign->ExecFrame();
+
345 
+
346  if (paused) {
+
347  if (world)
+
348  world->ExecFrame(0);
+
349  }
+
350 
+
351  else {
+
352  game_time += (DWORD) (seconds * 1000);
+
353 
+
354  Drive::StartFrame();
355 
-
356  Drive::StartFrame();
-
357 
-
358  if (world)
-
359  world->ExecFrame(seconds);
-
360  }
-
361 
-
362  static DWORD refresh_time = 0;
-
363  if (RealTime() - refresh_time > 1000) {
-
364  refresh_time = RealTime();
-
365  RedrawWindow(hwnd, 0, 0, RDW_ERASE|RDW_INVALIDATE);
-
366  }
-
367 }
+
356  if (world)
+
357  world->ExecFrame(seconds);
+
358  }
+
359 
+
360  static DWORD refresh_time = 0;
+
361  if (RealTime() - refresh_time > 1000) {
+
362  refresh_time = RealTime();
+
363  RedrawWindow(hwnd, 0, 0, RDW_ERASE|RDW_INVALIDATE);
+
364  }
+
365 }
+
366 
+
367 // +--------------------------------------------------------------------+
368 
-
369 // +--------------------------------------------------------------------+
-
370 
-
371 void
-
372 StarServer::GameState()
-
373 {
-
374  if (lobby_server) {
-
375  lobby_server->ExecFrame();
-
376 
-
377  if (lobby_server->GetStatus() == NetServerInfo::PERSISTENT)
-
378  paused = NetGame::NumPlayers() < 1;
-
379  }
-
380 
-
381  if (game_mode == MENU_MODE) {
-
382  Sleep(30);
-
383  }
-
384 
-
385  else if (game_mode == LOAD_MODE) {
-
386  CreateWorld();
-
387  InstantiateMission();
-
388 
-
389  SetGameMode(PLAY_MODE);
-
390  }
-
391 
-
392  else if (game_mode == PLAY_MODE) {
-
393  if (Game::GameTime() - time_mark > 60000) {
-
394  time_mark = Game::GameTime();
-
395  minutes++;
-
396  if (minutes > 60)
-
397  Print(" TIME %2d:%02d:00\n", minutes/60, minutes%60);
-
398  else
-
399  Print(" TIME %2d:00\n", minutes);
-
400  }
-
401 
-
402  Sleep(10);
-
403  }
-
404 
-
405  Memory::Check();
-
406 }
+
369 void
+
370 StarServer::GameState()
+
371 {
+
372  if (lobby_server) {
+
373  lobby_server->ExecFrame();
+
374 
+
375  if (lobby_server->GetStatus() == NetServerInfo::PERSISTENT)
+
376  paused = NetGame::NumPlayers() < 1;
+
377  }
+
378 
+
379  if (game_mode == MENU_MODE) {
+
380  Sleep(30);
+
381  }
+
382 
+
383  else if (game_mode == LOAD_MODE) {
+
384  CreateWorld();
+
385  InstantiateMission();
+
386 
+
387  SetGameMode(PLAY_MODE);
+
388  }
+
389 
+
390  else if (game_mode == PLAY_MODE) {
+
391  if (Game::GameTime() - time_mark > 60000) {
+
392  time_mark = Game::GameTime();
+
393  minutes++;
+
394  if (minutes > 60)
+
395  Print(" TIME %2d:%02d:00\n", minutes/60, minutes%60);
+
396  else
+
397  Print(" TIME %2d:00\n", minutes);
+
398  }
+
399 
+
400  Sleep(10);
+
401  }
+
402 
+
403  Memory::Check();
+
404 }
+
405 
+
406 // +--------------------------------------------------------------------+
407 
-
408 // +--------------------------------------------------------------------+
-
409 
-
410 bool
-
411 StarServer::OnPaint()
-
412 {
-
413  PAINTSTRUCT paintstruct;
-
414  HDC hdc = BeginPaint(hwnd, &paintstruct);
-
415 
-
416  Text txt_title = title_text;
-
417  Text txt_mode;
-
418  Text txt_users = Game::GetText("server.no-users");
-
419  char buf[256];
-
420 
-
421  txt_title += " ";
-
422  txt_title += versionInfo;
-
423 
-
424  switch (game_mode) {
-
425  case LOAD_MODE:
-
426  case MENU_MODE:
-
427  txt_mode = Game::GetText("server.mode.lobby");
-
428 
-
429  if (lobby_server) {
-
430  sprintf_s(buf, Game::GetText("server.users").data(), lobby_server->NumUsers());
-
431  txt_users = buf;
-
432  }
-
433  break;
-
434 
-
435  case PLAY_MODE:
-
436  txt_mode = Game::GetText("server.mode.active");
-
437  if (lobby_server) {
-
438  sprintf_s(buf, Game::GetText("server.users-and-players").data(), lobby_server->NumUsers(), NetGame::NumPlayers());
-
439  }
-
440  else {
-
441  sprintf_s(buf, Game::GetText("server.players").data(), NetGame::NumPlayers());
-
442  }
-
443  txt_users = buf;
-
444  break;
-
445 
-
446  default:
-
447  txt_mode = Game::GetText("server.mode.other");
-
448  break;
-
449  }
-
450 
-
451  if (lobby_server && lobby_server->GetStatus() == NetServerInfo::PERSISTENT)
-
452  txt_mode += " " + Game::GetText("server.alt.persistent");
-
453 
-
454  if (paused)
-
455  txt_mode += " " + Game::GetText("server.alt.paused");
-
456 
-
457  TextOut(hdc, 4, 4, txt_title, txt_title.length());
-
458  TextOut(hdc, 4, 22, txt_mode, txt_mode.length());
-
459  TextOut(hdc, 4, 40, txt_users, txt_users.length());
-
460 
-
461  Sim* sim = Sim::GetSim();
-
462  if (sim && sim->GetMission()) {
-
463  Mission* mission = sim->GetMission();
-
464  Text txt_msn = Game::GetText("server.mission");
-
465  txt_msn += mission->Name();
-
466  TextOut(hdc, 4, 58, txt_msn, txt_msn.length());
-
467  }
-
468 
-
469  EndPaint(hwnd, &paintstruct);
-
470  return true;
-
471 }
+
408 bool
+
409 StarServer::OnPaint()
+
410 {
+
411  PAINTSTRUCT paintstruct;
+
412  HDC hdc = BeginPaint(hwnd, &paintstruct);
+
413 
+
414  Text txt_title = title_text;
+
415  Text txt_mode;
+
416  Text txt_users = Game::GetText("server.no-users");
+
417  char buf[256];
+
418 
+
419  txt_title += " ";
+
420  txt_title += versionInfo;
+
421 
+
422  switch (game_mode) {
+
423  case LOAD_MODE:
+
424  case MENU_MODE:
+
425  txt_mode = Game::GetText("server.mode.lobby");
+
426 
+
427  if (lobby_server) {
+
428  sprintf_s(buf, Game::GetText("server.users").data(), lobby_server->NumUsers());
+
429  txt_users = buf;
+
430  }
+
431  break;
+
432 
+
433  case PLAY_MODE:
+
434  txt_mode = Game::GetText("server.mode.active");
+
435  if (lobby_server) {
+
436  sprintf_s(buf, Game::GetText("server.users-and-players").data(), lobby_server->NumUsers(), NetGame::NumPlayers());
+
437  }
+
438  else {
+
439  sprintf_s(buf, Game::GetText("server.players").data(), NetGame::NumPlayers());
+
440  }
+
441  txt_users = buf;
+
442  break;
+
443 
+
444  default:
+
445  txt_mode = Game::GetText("server.mode.other");
+
446  break;
+
447  }
+
448 
+
449  if (lobby_server && lobby_server->GetStatus() == NetServerInfo::PERSISTENT)
+
450  txt_mode += " " + Game::GetText("server.alt.persistent");
+
451 
+
452  if (paused)
+
453  txt_mode += " " + Game::GetText("server.alt.paused");
+
454 
+
455  TextOut(hdc, 4, 4, txt_title, txt_title.length());
+
456  TextOut(hdc, 4, 22, txt_mode, txt_mode.length());
+
457  TextOut(hdc, 4, 40, txt_users, txt_users.length());
+
458 
+
459  Sim* sim = Sim::GetSim();
+
460  if (sim && sim->GetMission()) {
+
461  Mission* mission = sim->GetMission();
+
462  Text txt_msn = Game::GetText("server.mission");
+
463  txt_msn += mission->Name();
+
464  TextOut(hdc, 4, 58, txt_msn, txt_msn.length());
+
465  }
+
466 
+
467  EndPaint(hwnd, &paintstruct);
+
468  return true;
+
469 }
+
470 
+
471 // +--------------------------------------------------------------------+
472 
-
473 // +--------------------------------------------------------------------+
-
474 
-
475 DWORD WINAPI StarServerShutdownProc(LPVOID link)
-
476 {
-
477  StarServer* stars = (StarServer*) link;
+
473 DWORD WINAPI StarServerShutdownProc(LPVOID link)
+
474 {
+
475  StarServer* stars = (StarServer*) link;
+
476 
+
477  Sleep(3000);
478 
-
479  Sleep(3000);
-
480 
-
481  if (stars) {
-
482  stars->Exit();
-
483  return 0;
-
484  }
-
485 
-
486  return (DWORD) E_POINTER;
-
487 }
-
488 
-
489 DWORD WINAPI StarServerRestartProc(LPVOID link)
-
490 {
-
491  StarServer* stars = (StarServer*) link;
+
479  if (stars) {
+
480  stars->Exit();
+
481  return 0;
+
482  }
+
483 
+
484  return (DWORD) E_POINTER;
+
485 }
+
486 
+
487 DWORD WINAPI StarServerRestartProc(LPVOID link)
+
488 {
+
489  StarServer* stars = (StarServer*) link;
+
490 
+
491  Sleep(3000);
492 
-
493  Sleep(3000);
-
494 
-
495 #ifdef STARSHATTER_DEMO_RELEASE
-
496 
-
497  if (stars) {
-
498  char cmdline[256];
-
499  strcpy_s(cmdline, "StarDemo -server");
+
493  if (stars) {
+
494  char cmdline[256];
+
495  strcpy_s(cmdline, "stars -server");
+
496 
+
497  STARTUPINFO s;
+
498  ZeroMemory(&s, sizeof(s));
+
499  s.cb = sizeof(s);
500 
-
501  STARTUPINFO s;
-
502  ZeroMemory(&s, sizeof(s));
-
503  s.cb = sizeof(s);
-
504 
-
505  PROCESS_INFORMATION pi;
-
506  ZeroMemory(&pi, sizeof(pi));
-
507 
-
508  CreateProcess("StarDemo.exe", cmdline, 0, 0, 0, 0, 0, 0, &s, &pi);
-
509  stars->Exit();
-
510  return 0;
-
511  }
-
512 
-
513 #else
-
514 
-
515  if (stars) {
-
516  char cmdline[256];
-
517  strcpy_s(cmdline, "stars -server");
+
501  PROCESS_INFORMATION pi;
+
502  ZeroMemory(&pi, sizeof(pi));
+
503 
+
504  CreateProcess("stars.exe", cmdline, 0, 0, 0, 0, 0, 0, &s, &pi);
+
505  stars->Exit();
+
506  CloseHandle( pi.hProcess );
+
507  CloseHandle( pi.hThread );
+
508  return 0;
+
509  }
+
510 
+
511  return (DWORD) E_POINTER;
+
512 }
+
513 
+
514 void
+
515 StarServer::Shutdown(bool restart)
+
516 {
+
517  DWORD thread_id = 0;
518 
-
519  STARTUPINFO s;
-
520  ZeroMemory(&s, sizeof(s));
-
521  s.cb = sizeof(s);
-
522 
-
523  PROCESS_INFORMATION pi;
-
524  ZeroMemory(&pi, sizeof(pi));
-
525 
-
526  CreateProcess("stars.exe", cmdline, 0, 0, 0, 0, 0, 0, &s, &pi);
-
527  stars->Exit();
-
528  CloseHandle( pi.hProcess );
-
529  CloseHandle( pi.hThread );
-
530  return 0;
-
531  }
-
532 
-
533 #endif
-
534 
-
535  return (DWORD) E_POINTER;
-
536 }
-
537 
-
538 void
-
539 StarServer::Shutdown(bool restart)
-
540 {
-
541  DWORD thread_id = 0;
-
542 
-
543  if (restart)
-
544  CreateThread(0, 4096, StarServerRestartProc, (LPVOID) this, 0, &thread_id);
-
545  else
-
546  CreateThread(0, 4096, StarServerShutdownProc, (LPVOID) this, 0, &thread_id);
-
547 }
+
519  if (restart)
+
520  CreateThread(0, 4096, StarServerRestartProc, (LPVOID) this, 0, &thread_id);
+
521  else
+
522  CreateThread(0, 4096, StarServerShutdownProc, (LPVOID) this, 0, &thread_id);
+
523 }