static */
| 29 | /* static */ std::unique_ptr<GameScannerLibrary> Game::scanner_library = nullptr; |
| 30 | |
| 31 | /* static */ void Game::GameLoop() |
| 32 | { |
| 33 | if (_networking && !_network_server) { |
| 34 | PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT); |
| 35 | return; |
| 36 | } |
| 37 | if (Game::instance == nullptr) { |
| 38 | PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT); |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | PerformanceMeasurer framerate(PFE_GAMESCRIPT); |
| 43 | |
| 44 | Game::frame_counter++; |
| 45 | |
| 46 | Backup<CompanyID> cur_company(_current_company); |
| 47 | cur_company.Change(OWNER_DEITY); |
| 48 | Game::instance->GameLoop(); |
| 49 | cur_company.Restore(); |
| 50 | |
| 51 | /* Occasionally collect garbage */ |
| 52 | if ((Game::frame_counter & 255) == 0) { |
| 53 | Game::instance->CollectGarbage(); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /* static */ void Game::Initialize() |
| 58 | { |
nothing calls this directly
no test coverage detected