mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 05:52:02 +00:00
Turn around true/false for better readability
This commit is contained in:
@@ -151,7 +151,7 @@ export class MapPlaylist {
|
||||
|
||||
public async gameConfigNotInUse(
|
||||
type: PublicGameType,
|
||||
isInUse: (config: GameConfig) => boolean,
|
||||
notInUse: (config: GameConfig) => boolean,
|
||||
): Promise<GameConfig> {
|
||||
const maxAttempts = 6;
|
||||
let attempts = 0;
|
||||
@@ -161,7 +161,7 @@ export class MapPlaylist {
|
||||
const config = await this.buildConfig(type, map);
|
||||
attempts++;
|
||||
|
||||
if (!isInUse(config) || attempts >= maxAttempts) {
|
||||
if (notInUse(config) || attempts >= maxAttempts) {
|
||||
this.consumeNextMap(type);
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -177,20 +177,20 @@ export class MasterLobbyService {
|
||||
}
|
||||
|
||||
const gameConfig = await this.playlist.gameConfigNotInUse(type, (c) => {
|
||||
if (usedMaps.has(c.gameMap)) return true;
|
||||
if (usedMaps.has(c.gameMap)) return false;
|
||||
|
||||
if (
|
||||
c.playerTeams !== undefined &&
|
||||
usedTeamTypes.has(String(c.playerTeams))
|
||||
) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.maxPlayers !== undefined && usedMaxPlayers.has(c.maxPlayers)) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
recordInUse(gameConfig);
|
||||
|
||||
Reference in New Issue
Block a user