From fbaf7d722d5b08031531a39a82bc6f2abe0c295d Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 16 Jun 2024 10:44:16 -0700 Subject: [PATCH] delete overlay before parsing character data in 98 command --- src/ReceiveCommands.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index ae33dbd8..57a70d75 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -2998,6 +2998,16 @@ static void on_13_A7_GC(shared_ptr c, uint16_t command, uint32_t flag, s static void on_61_98(shared_ptr c, uint16_t command, uint32_t flag, string& data) { auto s = c->require_server_state(); + + // 98 should only be sent when leaving a game, and we should leave the client + // in no lobby (they will send an 84 soon afterward to choose a lobby). + if (command == 0x98) { + // If the client had an overlay (for battle/challenge modes), delete it + c->delete_overlay(); + c->telepipe_lobby_id = 0; + s->remove_client_from_lobby(c); + } + auto player = c->character(); switch (c->version()) { @@ -3192,15 +3202,7 @@ static void on_61_98(shared_ptr c, uint16_t command, uint32_t flag, stri c->update_channel_name(); - // 98 should only be sent when leaving a game, and we should leave the client - // in no lobby (they will send an 84 soon afterward to choose a lobby). - if (command == 0x98) { - // If the client had an overlay (for battle/challenge modes), delete it - c->delete_overlay(); - c->telepipe_lobby_id = 0; - s->remove_client_from_lobby(c); - - } else if (command == 0x61) { + if (command == 0x61) { if (c->pending_character_export) { unique_ptr pending_export = std::move(c->pending_character_export); c->pending_character_export.reset();