| 110 | } |
| 111 | |
| 112 | int msg_wait_for_turns() |
| 113 | { |
| 114 | BOOL received; |
| 115 | DWORD turns; |
| 116 | |
| 117 | if (!sgbDeltaChunks) { |
| 118 | nthread_send_and_recv_turn(0, 0); |
| 119 | if (!SNetGetOwnerTurnsWaiting(&turns) && SErrGetLastError() == STORM_ERROR_NOT_IN_GAME) |
| 120 | return 100; |
| 121 | if (SDL_GetTicks() - sgdwOwnerWait <= 2000 && turns < gdwTurnsInTransit) |
| 122 | return 0; |
| 123 | sgbDeltaChunks++; |
| 124 | } |
| 125 | multi_process_network_packets(); |
| 126 | nthread_send_and_recv_turn(0, 0); |
| 127 | if (nthread_has_500ms_passed(FALSE)) |
| 128 | nthread_recv_turns(&received); |
| 129 | |
| 130 | if (gbGameDestroyed) |
| 131 | return 100; |
| 132 | if (gbDeltaSender >= MAX_PLRS) { |
| 133 | sgbDeltaChunks = 0; |
| 134 | sgbRecvCmd = CMD_DLEVEL_END; |
| 135 | gbDeltaSender = myplr; |
| 136 | nthread_set_turn_upper_bit(); |
| 137 | } |
| 138 | if (sgbDeltaChunks == 20) { |
| 139 | sgbDeltaChunks = 21; |
| 140 | return 99; |
| 141 | } |
| 142 | return 100 * sgbDeltaChunks / 21; |
| 143 | } |
| 144 | |
| 145 | void msg_process_net_packets() |
| 146 | { |
nothing calls this directly
no test coverage detected