| 431 | } |
| 432 | |
| 433 | int WaitForTurns() |
| 434 | { |
| 435 | uint32_t turns; |
| 436 | |
| 437 | if (sgbDeltaChunks == 0) { |
| 438 | nthread_send_and_recv_turn(0, 0); |
| 439 | if (!SNetGetOwnerTurnsWaiting(&turns) && SErrGetLastError() == STORM_ERROR_NOT_IN_GAME) |
| 440 | return 100; |
| 441 | if (SDL_GetTicks() - sgdwOwnerWait <= 2000 && turns < gdwTurnsInTransit) |
| 442 | return 0; |
| 443 | sgbDeltaChunks++; |
| 444 | } |
| 445 | multi_process_network_packets(); |
| 446 | nthread_send_and_recv_turn(0, 0); |
| 447 | if (nthread_has_500ms_passed()) { |
| 448 | nthread_recv_turns(); |
| 449 | } |
| 450 | |
| 451 | if (gbGameDestroyed) |
| 452 | return 100; |
| 453 | if (gbDeltaSender >= Players.size()) { |
| 454 | sgbDeltaChunks = 0; |
| 455 | sgbRecvCmd = CMD_DLEVEL_END; |
| 456 | gbDeltaSender = MyPlayerId; |
| 457 | nthread_set_turn_upper_bit(); |
| 458 | } |
| 459 | if (sgbDeltaChunks == MAX_CHUNKS - 1) { |
| 460 | sgbDeltaChunks = MAX_CHUNKS; |
| 461 | return 99; |
| 462 | } |
| 463 | return 100 * sgbDeltaChunks / MAX_CHUNKS; |
| 464 | } |
| 465 | |
| 466 | byte *DeltaExportItem(byte *dst, const TCmdPItem *src) |
| 467 | { |
nothing calls this directly
no test coverage detected