From: Christian Heller Date: Sun, 6 Dec 2020 18:31:04 +0000 (+0100) Subject: Replace annotation polling with annotation push, cache info display. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/templates?a=commitdiff_plain;h=a81ea397900267331c15c1cda5d349b22a49ea16;p=plomrogue2 Replace annotation polling with annotation push, cache info display. --- diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 2061fe7..07bfae0 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -202,18 +202,6 @@ def cmd_GOD_PORTAL(game, big_yx, little_yx, msg): game.changed = True cmd_GOD_PORTAL.argtypes = 'yx_tuple yx_tuple:nonneg string' -def cmd_GET_ANNOTATION(game, yx, connection_id): - player = game.get_player(connection_id) - big_yx, little_yx = player.fov_stencil.source_yxyx(yx) - annotation = '(unknown)' - if player.fov_test(big_yx, little_yx): - annotation = '(none)' - if big_yx in game.annotations: - if little_yx in game.annotations[big_yx]: - annotation = game.annotations[big_yx][little_yx] - game.io.send('ANNOTATION %s %s' % (yx, quote(annotation))) -cmd_GET_ANNOTATION.argtypes = 'yx_tuple:nonneg' - def cmd_MAP_LINE(game, big_yx, y, line): map_ = game.get_map(big_yx) map_.set_line(y, line) diff --git a/plomrogue/game.py b/plomrogue/game.py index ff76155..c495179 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -202,6 +202,7 @@ class Game(GameBase): def send_gamestate(self, connection_id=None): """Send out game state data relevant to clients.""" + # TODO: limit to connection_id if provided self.io.send('TURN ' + str(self.turn)) from plomrogue.mapping import FovMap import multiprocessing @@ -247,7 +248,9 @@ class Game(GameBase): for little_yx in [little_yx for little_yx in self.annotations[big_yx] if player.fov_test(big_yx, little_yx)]: target_yx = player.fov_stencil.target_yx(big_yx, little_yx) - self.io.send('ANNOTATION_HINT %s' % (target_yx,), c_id) + annotation = self.annotations[big_yx][little_yx] + self.io.send('ANNOTATION %s %s' % (target_yx, + quote(annotation)), c_id) self.io.send('GAME_STATE_COMPLETE') def run_tick(self): diff --git a/rogue_chat.html b/rogue_chat.html index 8efe2a2..dd037e2 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -120,8 +120,8 @@ keyboard input/control: