From: Christian Heller Date: Wed, 4 Nov 2020 05:02:25 +0000 (+0100) Subject: Fix screen jumping around. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/te"st.html?a=commitdiff_plain;h=3f6aeac609f6337713f6cca17e4f54960ecf4d7f;p=plomrogue2-experiments Fix screen jumping around. --- diff --git a/new2/plomrogue/game.py b/new2/plomrogue/game.py index 5e33bc4..1cb6e22 100755 --- a/new2/plomrogue/game.py +++ b/new2/plomrogue/game.py @@ -88,7 +88,6 @@ class Game(GameBase): if hasattr(thing, 'nickname'): self.io.send('THING_NAME %s %s' % (thing.id_, quote(t.nickname))) - self.io.send('TURN ' + str(self.turn)) for t in self.things: send_thing(t) diff --git a/new2/rogue_chat_curses.py b/new2/rogue_chat_curses.py index e272fb2..ad6f4f9 100755 --- a/new2/rogue_chat_curses.py +++ b/new2/rogue_chat_curses.py @@ -10,8 +10,6 @@ from plomrogue.mapping import YX from plomrogue.things import ThingBase from plomrogue.misc import quote -# TODO: fix screen refreshes on intermediary map results - def cmd_TURN(game, n): game.turn = n game.things = [] @@ -240,6 +238,10 @@ class TUI: stdscr.addstr(1, self.window_width, 'MODE: ' + self.mode.name) def draw_map(): + player = self.game.get_thing(self.game.player_id, False) + if not player: + # catches race conditions where game.things still empty + return map_lines_split = [] for y in range(self.game.map_size.y): start = self.game.map_size.x * y @@ -256,13 +258,9 @@ class TUI: int(self.game.map_size.x / 2)) window_center = YX(int(self.size.y / 2), int(self.window_width / 2)) - center = map_center + center = player if self.mode.shows_info: center = self.explorer - else: - player = self.game.get_thing(self.game.player_id, False) - if player: - center = player.position offset = center - window_center term_y = max(0, -offset.y) term_x = max(0, -offset.x)