update lobby datas on team master transfer

This commit is contained in:
Martin Michelsen
2023-12-28 10:23:13 -08:00
parent 7b7c9d371f
commit 1ba50e96ca
4 changed files with 27 additions and 0 deletions
+11
View File
@@ -4845,6 +4845,7 @@ static void on_EA_BB(shared_ptr<Client> c, uint16_t command, uint32_t flag, stri
// The client only sends this command with flag = 0x00, 0x30, or 0x40
bool send_updates_for_this_m = false;
bool send_updates_for_other_m = false;
bool send_master_transfer_updates = false;
switch (flag) {
case 0x00: // Demote member
if (s->team_index->demote_leader(c->license->serial_number, cmd.guild_card_number)) {
@@ -4867,11 +4868,21 @@ static void on_EA_BB(shared_ptr<Client> c, uint16_t command, uint32_t flag, stri
send_command(c, 0x11EA, 0x00000000);
send_updates_for_this_m = true;
send_updates_for_other_m = true;
send_master_transfer_updates = true;
break;
default:
throw runtime_error("invalid privilege level");
}
if (send_master_transfer_updates) {
for (const auto& it : team->members) {
try {
auto other_c = s->find_client(nullptr, it.second.serial_number);
send_update_lobby_data_bb(other_c);
} catch (const out_of_range&) {
}
}
}
if (send_updates_for_this_m) {
send_update_team_metadata_for_client(c);
send_team_membership_info(c);