home · contact · privacy
Fix square grid scrolling bug.
[plomrogue2] / rogue_chat_curses.py
index 0a5ced7a0692c27b9211f9f57e7ac752b29fe447..3b110bae0b091dff9e8967f60fce7e8584961741 100755 (executable)
@@ -257,6 +257,8 @@ class TUI:
             'switch_to_study': '?',
             'switch_to_edit': 'm',
             'flatten': 'F',
+            'take_thing': 'z',
+            'drop_thing': 'u',
             'toggle_map_mode': 'M',
             'hex_move_upleft': 'w',
             'hex_move_upright': 'e',
@@ -490,22 +492,27 @@ class TUI:
             for y in range(self.game.map_geometry.size.y):
                 start = self.game.map_geometry.size.x * y
                 end = start + self.game.map_geometry.size.x
-                map_lines_split += [list(map_content[start:end])]
+                map_lines_split += [[c + ' ' for c in map_content[start:end]]]
             if self.map_mode == 'terrain':
+                used_positions = []
                 for t in self.game.things:
                     symbol = self.game.thing_types[t.type_]
-                    map_lines_split[t.position.y][t.position.x] = symbol
+                    if t.position in used_positions:
+                        map_lines_split[t.position.y][t.position.x] = symbol + '+'
+                    else:
+                        map_lines_split[t.position.y][t.position.x] = symbol + ' '
+                    used_positions += [t.position]
             if self.mode.shows_info:
-                map_lines_split[self.explorer.y][self.explorer.x] = '?'
+                map_lines_split[self.explorer.y][self.explorer.x] = '??'
             map_lines = []
             if type(self.game.map_geometry) == MapGeometryHex:
                 indent = 0
                 for line in map_lines_split:
-                    map_lines += [indent*' ' + ' '.join(line)]
+                    map_lines += [indent*' ' + ''.join(line)]
                     indent = 0 if indent else 1
             else:
                 for line in map_lines_split:
-                    map_lines += [' '.join(line)]
+                    map_lines += [''.join(line)]
             window_center = YX(int(self.size.y / 2),
                                int(self.window_width / 2))
             player = self.game.get_thing(self.game.player_id)
@@ -533,6 +540,10 @@ class TUI:
                 content += "Available actions:\n"
                 if 'MOVE' in self.game.tasks:
                     content += "[%s] – move player\n" % ','.join(self.movement_keys)
+                if 'PICK_UP' in self.game.tasks:
+                    content += "[%s] – take thing under player\n" % self.keys['take_thing']
+                if 'DROP' in self.game.tasks:
+                    content += "[%s] – drop carried thing\n" % self.keys['drop_thing']
                 if 'FLATTEN_SURROUNDINGS' in self.game.tasks:
                     content += "[%s] – flatten player's surroundings\n" % self.keys['flatten']
                 content += 'Other modes available from here:\n'
@@ -721,6 +732,10 @@ class TUI:
                 elif key == self.keys['flatten'] and\
                      'FLATTEN_SURROUNDINGS' in self.game.tasks:
                     self.send('TASK:FLATTEN_SURROUNDINGS ' + quote(self.password))
+                elif key == self.keys['take_thing'] and 'PICK_UP' in self.game.tasks:
+                    self.send('TASK:PICK_UP')
+                elif key == self.keys['drop_thing'] and 'DROP' in self.game.tasks:
+                    self.send('TASK:DROP')
                 elif key in self.movement_keys and 'MOVE' in self.game.tasks:
                     self.send('TASK:MOVE ' + self.movement_keys[key])
             elif self.mode == self.mode_edit: