X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=client-curses.py;h=ca907db013380f3da7d54b57a7f0dc73c8f11b2d;hb=4542a12bf12101e60aedea9bb9df098573bf0d25;hp=e942dd8fbc349b0e6571e97cad9995c8ba87327f;hpb=362ee8651a250d99377806c33451ceb5b027c606;p=plomrogue2-experiments diff --git a/client-curses.py b/client-curses.py index e942dd8..ca907db 100755 --- a/client-curses.py +++ b/client-curses.py @@ -13,13 +13,12 @@ class Map(game_common.Map): map_height = len(map_lines) if map_height > view_height and center_y > view_height / 2: if center_y > map_height - view_height / 2: - map_lines = map_lines[map_height - view_height:] + map_lines[:] = map_lines[map_height - view_height:] else: - start = center_y - int(view_height / 2) + start = center_y - int(view_height / 2) - 1 map_lines[:] = map_lines[start:start + view_height] - def x_cut(self, map_lines, center_x, view_width): - map_width = len(map_lines[0]) + def x_cut(self, map_lines, center_x, view_width, map_width): if map_width > view_width and center_x > view_width / 2: if center_x > map_width - view_width / 2: cut_start = map_width - view_width @@ -45,7 +44,7 @@ class MapSquare(Map): map_lines = map_string_to_lines(map_string) self.y_cut(map_lines, center[0], size[0]) - self.x_cut(map_lines, center[1], size[1]) + self.x_cut(map_lines, center[1], size[1], self.size[1]) return map_lines @@ -54,7 +53,7 @@ class MapHex(Map): def format_to_view(self, map_string, center, size): def map_string_to_lines(map_string): - map_view_chars = [' '] + map_view_chars = ['0'] x = 0 y = 0 for c in map_string: @@ -65,12 +64,16 @@ class MapHex(Map): x = 0 y += 1 if y % 2 == 0: - map_view_chars += [' '] + map_view_chars += ['0'] + if y % 2 == 0: + map_view_chars = map_view_chars[:-1] + map_view_chars = map_view_chars[:-1] return ''.join(map_view_chars).split('\n') map_lines = map_string_to_lines(map_string) self.y_cut(map_lines, center[0], size[0]) - self.x_cut(map_lines, center[1] * 2, size[1]) + map_width = self.size[1] * 2 + 1 + self.x_cut(map_lines, center[1] * 2, size[1], map_width) return map_lines @@ -147,6 +150,8 @@ class Game(game_common.CommonCommandsMixin): """Set self.turn to n, empty self.things.""" self.world.turn = n self.world.things = [] + self.to_update['turn'] = False + self.to_update['map'] = False cmd_NEW_TURN.argtypes = 'int:nonneg' def cmd_VISIBLE_MAP_LINE(self, y, terrain_line):