MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SimulateDS

Method SimulateDS

engine/Poseidon/Network/NetworkServerSimulate.cpp:346–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344 return 0;
345}
346
347void NetworkServer::SimulateDS()
348{
349 if (!_dedicated)
350 {
351 return;
352 }
353
354 DWORD tickCount = GlobalTickCount();
355 bool simulateMode = AppConfig::Instance().IsSimulateMode();
356
357 // Periodic stats logging in simulate mode
358 if (simulateMode && _state == NGSPlay)
359 {
360 static unsigned long long frameCount = 0;
361 frameCount++;
362
363 int statsInterval = AppConfig::Instance().GetStatsInterval();
364 if (statsInterval > 0)
365 {
366 static DWORD lastStatsTick = 0;
367 DWORD statsIntervalMs = statsInterval * 1000;
368 if (lastStatsTick == 0 || (tickCount - lastStatsTick) >= statsIntervalMs)
369 {
370 lastStatsTick = tickCount;
371 int vehicles = GWorld->NVehicles();
372 int buildings = GWorld->NBuildings();
373 int animals = GWorld->NAnimals();
374 int shots = GWorld->NFastVehicles();
375
376 auto countSide = [](AICenter* c, int& groups, int& units)
377 {
378 groups = 0;
379 units = 0;
380 if (!c)
381 return;
382 groups = c->NGroups();
383 for (int i = 0; i < c->NGroups(); i++)
384 if (c->GetGroup(i))
385 units += c->GetGroup(i)->NUnits();
386 };
387 int wG, wU, eG, eU, gG, gU, cG, cU;
388 countSide(GWorld->GetWestCenter(), wG, wU);
389 countSide(GWorld->GetEastCenter(), eG, eU);
390 countSide(GWorld->GetGuerrilaCenter(), gG, gU);
391 countSide(GWorld->GetCivilianCenter(), cG, cU);
392
393 int totalGroups = wG + eG + gG + cG;
394 int totalUnits = wU + eU + gU + cU;
395 int players = _players.Size();
396 int roles = _playerRoles.Size();
397
398 // Game time in seconds since mission start
399 float gameTime = Glob.time - Time(0);
400 int gtMin = (int)(gameTime / 60.0f);
401 int gtSec = (int)gameTime % 60;
402
403 LOG_INFO(Mission,

Callers

nothing calls this directly

Calls 15

GlobalTickCountFunction · 0.85
AddMissionListFunction · 0.85
SetBaseDirectoryFunction · 0.85
SetMissionFunction · 0.85
MPMissionsPathFunction · 0.85
FailSimulateSmokeCheckFunction · 0.85
ParseMissionFunction · 0.85
FindIdentityFunction · 0.85
GetWorldNameFunction · 0.85
GetMaxErrorMessageFunction · 0.85
RunInitScriptFunction · 0.85
RunMissionScriptFunction · 0.85

Tested by

no test coverage detected