MCPcopy Create free account
hub / github.com/diasurgical/devilution / multi_begin_timeout

Function multi_begin_timeout

Source/multi.cpp:323–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323void multi_begin_timeout()
324{
325 int i, nTicks, nState, nLowestActive, nLowestPlayer;
326 BYTE bGroupPlayers, bGroupCount;
327
328 if (!sgbTimeout) {
329 return;
330 }
331#ifdef _DEBUG
332 if (debug_mode_key_i) {
333 return;
334 }
335#endif
336
337 nTicks = SDL_GetTicks() - sglTimeoutStart;
338 if (nTicks > 20000) {
339 gbRunGame = FALSE;
340 return;
341 }
342 if (nTicks < 10000) {
343 return;
344 }
345
346 nLowestActive = -1;
347 nLowestPlayer = -1;
348 bGroupPlayers = 0;
349 bGroupCount = 0;
350 for (i = 0; i < MAX_PLRS; i++) {
351 nState = player_state[i];
352 if (nState & 0x10000) {
353 if (nLowestPlayer == -1) {
354 nLowestPlayer = i;
355 }
356 if (nState & 0x40000) {
357 bGroupPlayers++;
358 if (nLowestActive == -1) {
359 nLowestActive = i;
360 }
361 } else {
362 bGroupCount++;
363 }
364 }
365 }
366
367 /// ASSERT: assert(bGroupPlayers);
368 /// ASSERT: assert(nLowestActive != -1);
369 /// ASSERT: assert(nLowestPlayer != -1);
370
371 if (bGroupPlayers < bGroupCount) {
372 gbGameDestroyed = TRUE;
373 } else if (bGroupPlayers == bGroupCount) {
374 if (nLowestPlayer != nLowestActive) {
375 gbGameDestroyed = TRUE;
376 } else if (nLowestActive == myplr) {
377 multi_check_drop_player();
378 }
379 } else if (nLowestActive == myplr) {
380 multi_check_drop_player();

Callers 1

multi_handle_deltaFunction · 0.85

Calls 1

multi_check_drop_playerFunction · 0.85

Tested by

no test coverage detected