| 321 | } |
| 322 | |
| 323 | void 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(); |
no test coverage detected