From d11329b2c995196eee88147c2a79c2f2428bd9d6 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Fri, 2 Aug 2024 17:54:14 -0700 Subject: [PATCH] assign item IDs chen changing banks; fixes #546 --- src/ChatCommands.cc | 6 +++++- src/Lobby.cc | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 53885e5c..5f89de15 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -1480,7 +1480,11 @@ static void server_command_change_bank(shared_ptr c, const std::string& throw runtime_error("invalid bank number"); } - const auto& bank = c->current_bank(); + auto& bank = c->current_bank(); + bank.assign_ids(0x99000000 + (c->lobby_client_id << 20)); + c->log.info("Assigned bank item IDs"); + c->print_bank(stderr); + send_text_message_printf(c, "%" PRIu32 " items\n%" PRIu32 " Meseta", bank.num_items.load(), bank.meseta.load()); } diff --git a/src/Lobby.cc b/src/Lobby.cc index 24c0a4ad..361ae037 100644 --- a/src/Lobby.cc +++ b/src/Lobby.cc @@ -918,8 +918,9 @@ void Lobby::assign_inventory_and_bank_item_ids(shared_ptr c, bool consum if (c->log.info("Assigned inventory item IDs%s", consume_ids ? "" : " but did not mark IDs as used")) { c->print_inventory(stderr); + auto& bank = c->current_bank(); if (p->bank.num_items) { - p->bank.assign_ids(0x99000000 + (c->lobby_client_id << 20)); + bank.assign_ids(0x99000000 + (c->lobby_client_id << 20)); c->log.info("Assigned bank item IDs"); c->print_bank(stderr); } else {