MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / WaitForTurns

Function WaitForTurns

Source/msg.cpp:433–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433int 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
466byte *DeltaExportItem(byte *dst, const TCmdPItem *src)
467{

Callers

nothing calls this directly

Calls 8

SNetGetOwnerTurnsWaitingFunction · 0.85
SErrGetLastErrorFunction · 0.85
nthread_has_500ms_passedFunction · 0.85
nthread_recv_turnsFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected