Skip to content

Commit

Permalink
fix concurrent player check
Browse files Browse the repository at this point in the history
The `player_pool` property does not exist on main site (yet?).
  • Loading branch information
windo committed May 12, 2024
1 parent 9478fd1 commit e46a308
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,11 @@ class Main {
config;
if (config.max_games_per_player) {
const game_count = Object.keys(this.connected_games).filter((game_id) => {
return !!this.connected_games[game_id].state?.player_pool[player_id];
const state = this.connected_games[game_id]?.state;
if (state?.player_pool !== undefined) {
return !!state.player_pool[player_id];
}
return state.white_player_id === player_id || state.black_player_id === player_id;
}).length;
trace.log("Game count: ", game_count, " for ", player_id);
if (game_count >= config.max_games_per_player) {
Expand Down

0 comments on commit e46a308

Please sign in to comment.