From ec60523956ddbc9e04129bda91a847a1fdb89ee7 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 16 Dec 2018 14:07:16 +0100 Subject: [PATCH] Clean up msg_wait_resync --- Source/msg.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index eb1e6cd83..00cf776b7 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -71,7 +71,7 @@ TMegaPkt *__cdecl msg_get_next_packet() BOOL __cdecl msg_wait_resync() { - int v0; // eax + BOOL success; msg_get_next_packet(); sgbDeltaChunks = 0; @@ -79,21 +79,26 @@ BOOL __cdecl msg_wait_resync() sgbRecvCmd = CMD_DLEVEL_END; gbBufferMsgs = 1; sgdwOwnerWait = GetTickCount(); - v0 = UiProgressDialog(ghMainWnd, "Waiting for game data...", 1, msg_wait_for_turns, 20); + success = UiProgressDialog(ghMainWnd, "Waiting for game data...", 1, msg_wait_for_turns, 20); gbBufferMsgs = 0; - if (!v0) - goto LABEL_6; + if (!success) { + msg_free_packets(); + return FALSE; + } + if (gbGameDestroyed) { DrawDlg("The game ended"); - LABEL_6: msg_free_packets(); - return 0; + return FALSE; } + if (sgbDeltaChunks != 21) { DrawDlg("Unable to get level data"); - goto LABEL_6; + msg_free_packets(); + return FALSE; } - return 1; + + return TRUE; } // 65AB18: using guessed type int sgdwOwnerWait; // 65AB24: using guessed type int sgnCurrMegaPlayer;