MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MainLoop

Method MainLoop

src/video/dedicated_v.cpp:194–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void VideoDriver_Dedicated::MainLoop()
195{
196 /* Signal handlers */
197#if defined(UNIX)
198 signal(SIGTERM, DedicatedSignalHandler);
199 signal(SIGINT, DedicatedSignalHandler);
200 signal(SIGQUIT, DedicatedSignalHandler);
201#endif
202
203 /* Load the dedicated server stuff */
204 _is_network_server = true;
205 _network_dedicated = true;
206 _current_company = _local_company = COMPANY_SPECTATOR;
207
208 /* If SwitchMode is SM_LOAD_GAME / SM_START_HEIGHTMAP, it means that the user used the '-g' options */
209 if (_switch_mode != SM_LOAD_GAME && _switch_mode != SM_START_HEIGHTMAP) {
210 StartNewGameWithoutGUI(GENERATE_NEW_SEED);
211 }
212
213 this->is_game_threaded = false;
214
215 /* Done loading, start game! */
216
217 while (!_exit_game) {
218 if (!_dedicated_forks) DedicatedHandleKeyInput();
219 this->DrainCommandQueue();
220
221 this->Tick();
222 this->SleepTillNextTick();
223 }
224}

Callers

nothing calls this directly

Calls 5

StartNewGameWithoutGUIFunction · 0.85
DedicatedHandleKeyInputFunction · 0.85
DrainCommandQueueMethod · 0.80
SleepTillNextTickMethod · 0.80
TickMethod · 0.45

Tested by

no test coverage detected