diff options
author | notoraptor <notoraptor@users.noreply.github.com> | 2019-07-18 12:19:37 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-07-18 12:19:37 -0400 |
commit | f8ee5f84abc5c9d0d56402f2943abad1dc74d3dd (patch) | |
tree | 8f672a9a6029f172ac0c3651dcfa4c03040cd32f /diplomacy/engine | |
parent | 2701df1e3b03c7c605ccf212a02987d53fbd0609 (diff) |
Open DAIDE port on game loading and display on web
- Open DAIDE port on game loading too, and [web] Display DAIDE port on game title.
- [server] Also delete backup game file when deleting game.
- [python]
Add optional parameter `server` to ServerGame constructor to init server game with a server as soon as it is possible.
Add field `daide_port` to Game for client games.
When creating game, register it on server before generating client games, so that DAIDE ports are known on client game generation.
Move DAIDE port opening into Server.add_new_game() and Server.get_game(), so that port is opened as soon as a new game is added or a game is loaded.
Move DAIDE port closing for specific game into Server.delete_game().
Add DAIDE port to client game field daide_port if known.
[web]
Display DAIDE port if available in game title on game page.
- [python] Display game ID in log when opening DAIDE port.
- [server] Close DAIDE port as soon as game is done.
- Update dependencies.
Diffstat (limited to 'diplomacy/engine')
-rw-r--r-- | diplomacy/engine/game.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/diplomacy/engine/game.py b/diplomacy/engine/game.py index 06d2fe6..52ade4f 100644 --- a/diplomacy/engine/game.py +++ b/diplomacy/engine/game.py @@ -61,6 +61,7 @@ class Game(Jsonable): e.g. [(START_LOC, {Fleets Req}, {possible dest}), ...] - convoy_paths_dest - Contains a dictionary of possible paths to reach destination from start or None e.g. {start_loc: {dest_loc_1: [{fleets}, {fleets}, {fleets}], dest_loc_2: [{fleets, fleets}]} + - daide_port: for client games only. Port when a DAIDE bot can connect, to play with this game. - deadline: integer: game deadline in seconds. - dislodged - Contains a dictionary of dislodged units (and the site that dislodged them') e.g. { 'A PAR': 'MAR' } @@ -166,11 +167,12 @@ class Game(Jsonable): 'convoy_paths_dest', 'zobrist_hash', 'renderer', 'game_id', 'map_name', 'role', 'rules', 'message_history', 'state_history', 'result_history', 'status', 'timestamp_created', 'n_controls', 'deadline', 'registration_password', 'observer_level', 'controlled_powers', '_phase_wrapper_type', - 'phase_abbr', '_unit_owner_cache'] + 'phase_abbr', '_unit_owner_cache', 'daide_port'] zobrist_tables = {} rule_cache = () model = { strings.CONTROLLED_POWERS: parsing.OptionalValueType(parsing.SequenceType(str)), + strings.DAIDE_PORT: parsing.OptionalValueType(int), strings.DEADLINE: parsing.DefaultValueType(int, 300), strings.ERROR: parsing.DefaultValueType(parsing.SequenceType(parsing.StringableType(err.Error)), []), strings.GAME_ID: parsing.OptionalValueType(str), @@ -232,6 +234,7 @@ class Game(Jsonable): self.registration_password = None self.observer_level = None self.controlled_powers = None + self.daide_port = None # Caches self._unit_owner_cache = None # {(unit, coast_required): owner} |