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) {
|
if (c->card_battle_table_seat_number >= 4) {
|
||||||
throw logic_error("invalid seat number");
|
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) {
|
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) {
|
if (c->card_battle_table_seat_state == 3) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+2
-3
@@ -1921,14 +1921,13 @@ void send_ep3_card_battle_table_state(shared_ptr<Lobby> l, uint16_t table_number
|
|||||||
throw runtime_error("invalid battle table seat number");
|
throw runtime_error("invalid battle table seat number");
|
||||||
}
|
}
|
||||||
auto& e = cmd.entries[c->card_battle_table_seat_number];
|
auto& e = cmd.entries[c->card_battle_table_seat_number];
|
||||||
if (e.state != 0) {
|
if (e.state == 0) {
|
||||||
throw runtime_error("multiple clients in the same battle table seat");
|
|
||||||
}
|
|
||||||
e.state = c->card_battle_table_seat_state;
|
e.state = c->card_battle_table_seat_state;
|
||||||
e.guild_card_number = c->license->serial_number;
|
e.guild_card_number = c->license->serial_number;
|
||||||
clients.emplace(c);
|
clients.emplace(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& c : clients) {
|
for (const auto& c : clients) {
|
||||||
send_command_t(c, 0xE4, table_number, cmd);
|
send_command_t(c, 0xE4, table_number, cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user