Skip to content

Commit

Permalink
Fixed online game player name generation and stop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Vuk Djordjevic committed Sep 19, 2024
1 parent f5ba055 commit b535add
Show file tree
Hide file tree
Showing 5 changed files with 27,354 additions and 4 deletions.
7 changes: 7 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ADVANCED_GRAPHICS": true,
"MAP_TYPE": "",
"GAME_SPEED": 1.0,
"SOUND_VOLUME": 0,
"MUSIC_VOLUME": 0
}
2 changes: 1 addition & 1 deletion src/game_client/types/remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def disconnect(self) -> None:
def login(self, name: str, password: str | None = None, game_name: str | None = None,
num_turns: int | None = None, num_players: int | None = None,
is_observer: bool | None = None, is_full: bool | None = None) -> dict:
if password is None:
if password is None or len(password) == 0:
seed = random.randint(0, 10000)
name = f"{name}-{seed}"

Expand Down
4 changes: 1 addition & 3 deletions src/game_presets/local_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from src.game import Game
from src.game_presets.game_preset_utils import setup_num_turns
from src.parameters import DEFAULT_NUM_TURNS
from src.parameters import PLAYER_NAMES


def local_game(game_name: str, num_players: int = 3, use_advanced_ai: bool = True, num_turns: int = DEFAULT_NUM_TURNS,
Expand All @@ -20,8 +19,7 @@ def local_game(game_name: str, num_players: int = 3, use_advanced_ai: bool = Tru
if use_advanced_ai:
bot_name = "Advanced bot"
else:
bot_name = PLAYER_NAMES[1]
# game.add_local_player(name=f"{bot_name}-{seed}", is_observer=False, is_backup=use_advanced_ai)
bot_name = "Bot"

for i in range(0, num_players):
game.add_local_player(name=bot_name, is_observer=False, is_backup=use_advanced_ai)
Expand Down
1 change: 1 addition & 0 deletions src/gui/display_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def __run(self) -> None:

self.__helper_menu.enable()
self.__menu.disable()
self.__base_game_ui_controller.disable_everything()

self.__finalize_game()

Expand Down
Loading

0 comments on commit b535add

Please sign in to comment.