fix session hang on empty download quest menu

This commit is contained in:
Martin Michelsen
2023-01-30 20:56:00 -08:00
parent 1fdbcd6c4e
commit 0ffa03d2b6
2 changed files with 14 additions and 22 deletions
+5 -14
View File
@@ -1730,16 +1730,11 @@ static void on_10(shared_ptr<ServerState> s, shared_ptr<Client> c,
shared_ptr<Lobby> 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<ServerState> s, shared_ptr<Client> c,
auto quests = s->quest_index->filter(c->version(),
c->flags & Client::Flag::IS_DC_V1,
static_cast<QuestCategory>(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
+9 -8
View File
@@ -630,14 +630,15 @@ static void on_subcommand_box_or_enemy_item_drop(shared_ptr<ServerState>,
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);
}