From 0ffa03d2b685e5395d51788c7c5b6093f6c984dc Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 30 Jan 2023 20:56:00 -0800 Subject: [PATCH] fix session hang on empty download quest menu --- src/ReceiveCommands.cc | 19 +++++-------------- src/ReceiveSubcommands.cc | 17 +++++++++-------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 14e7c72a..67d5047c 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -1730,16 +1730,11 @@ static void on_10(shared_ptr s, shared_ptr c, shared_ptr l = c->lobby_id ? s->find_lobby(c->lobby_id) : nullptr; auto quests = s->quest_index->filter( c->version(), c->flags & Client::Flag::IS_DC_V1, QuestCategory::EPISODE_3); - if (quests.empty()) { - send_lobby_message_box(c, u"$C6There are no quests\navailable."); - } else { - // Episode 3 has only download quests, not online quests, so this - // is always the download quest menu. (Episode 3 does actually - // have online quests, but they're served via a server data - // request instead of the file download paradigm that all other - // versions use.) - send_quest_menu(c, MenuID::QUEST, quests, true); - } + // Episode 3 has only download quests, not online quests, so this is + // always the download quest menu. (Episode 3 does actually have + // online quests, but they're served via a server data request + // instead of the file download paradigm that other versions use.) + send_quest_menu(c, MenuID::QUEST, quests, true); } else { send_quest_menu(c, MenuID::QUEST_FILTER, quest_download_menu, true); } @@ -1948,10 +1943,6 @@ static void on_10(shared_ptr s, shared_ptr c, auto quests = s->quest_index->filter(c->version(), c->flags & Client::Flag::IS_DC_V1, static_cast(item_id & 0xFF)); - if (quests.empty()) { - send_lobby_message_box(c, u"$C6There are no quests\navailable in that\ncategory."); - break; - } // Hack: Assume the menu to be sent is the download quest menu if the // client is not in any lobby diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 3656754e..3c0b51f9 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -630,14 +630,15 @@ static void on_subcommand_box_or_enemy_item_drop(shared_ptr, return; } - PlayerInventoryItem item; - item.present = 1; - item.flags = 0; - item.data = cmd.data; - l->add_item(item, cmd.area, cmd.x, cmd.z); - - l->log.info("Leader created ground item %08" PRIX32 " at %hhu:(%g, %g)", - item.data.id.load(), cmd.area, cmd.x.load(), cmd.z.load()); + if (l->flags & Lobby::Flag::ITEM_TRACKING_ENABLED) { + PlayerInventoryItem item; + item.present = 1; + item.flags = 0; + item.data = cmd.data; + l->add_item(item, cmd.area, cmd.x, cmd.z); + l->log.info("Leader created ground item %08" PRIX32 " at %hhu:(%g, %g)", + item.data.id.load(), cmd.area, cmd.x.load(), cmd.z.load()); + } forward_subcommand(l, c, command, flag, data); }