fix battle table edge case
This commit is contained in:
@@ -983,8 +983,10 @@ static bool start_ep3_battle_table_game_if_ready(
|
||||
if (c->card_battle_table_seat_number >= 4) {
|
||||
throw logic_error("invalid seat number");
|
||||
}
|
||||
// Apparently this can actually happen; just prevent them from starting a
|
||||
// battle if multiple players are in the same seat
|
||||
if (!table_clients.emplace(c->card_battle_table_seat_number, c).second) {
|
||||
throw runtime_error("multiple clients in same battle table seat");
|
||||
return false;
|
||||
}
|
||||
if (c->card_battle_table_seat_state == 3) {
|
||||
return false;
|
||||
|
||||
+4
-5
@@ -1921,12 +1921,11 @@ void send_ep3_card_battle_table_state(shared_ptr<Lobby> l, uint16_t table_number
|
||||
throw runtime_error("invalid battle table seat number");
|
||||
}
|
||||
auto& e = cmd.entries[c->card_battle_table_seat_number];
|
||||
if (e.state != 0) {
|
||||
throw runtime_error("multiple clients in the same battle table seat");
|
||||
if (e.state == 0) {
|
||||
e.state = c->card_battle_table_seat_state;
|
||||
e.guild_card_number = c->license->serial_number;
|
||||
clients.emplace(c);
|
||||
}
|
||||
e.state = c->card_battle_table_seat_state;
|
||||
e.guild_card_number = c->license->serial_number;
|
||||
clients.emplace(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user