home · contact · privacy
Add item-free-terrain view, and augment other views with control view.
[plomrogue2] / rogue_chat_curses.py
index e95b0c84cc45e816bfe4b90c3bca17ccf07d94ec..67f63a1cd09dd9980f9783a5e737ce79f5f4ad39 100755 (executable)
@@ -374,7 +374,7 @@ class TUI:
         self.mode_admin.available_modes = ["control_pw_type",
                                            "control_tile_type", "chat",
                                            "study", "play", "edit"]
-        self.mode_control_tile_draw.available_modes = ["admin"]
+        self.mode_control_tile_draw.available_modes = ["admin_enter"]
         self.mode_edit.available_modes = ["write", "annotate", "portal",
                                           "password", "chat", "study", "play",
                                           "admin_enter"]
@@ -386,7 +386,7 @@ class TUI:
         self.do_refresh = True
         self.queue = queue.Queue()
         self.login_name = None
-        self.map_mode = 'terrain'
+        self.map_mode = 'all'
         self.password = 'foo'
         self.switch_mode('waiting_for_server')
         self.keys = {
@@ -502,7 +502,7 @@ class TUI:
                   (self.explorer, quote(self.tile_control_char)))
 
     def switch_mode(self, mode_name):
-        self.map_mode = 'terrain'
+        self.map_mode = 'all'
         if mode_name == 'admin_enter' and self.is_admin:
             mode_name = 'admin'
         self.mode = getattr(self, 'mode_' + mode_name)
@@ -662,17 +662,23 @@ class TUI:
             if not self.game.turn_complete:
                 return
             map_lines_split = []
-            map_content = self.game.map_content
-            if self.map_mode == 'control':
-                map_content = self.game.map_control_content
             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 += [[c + ' ' for c in map_content[start:end]]]
+                if self.mode.name in {'edit', 'write', 'control_tile_draw',
+                                      'control_tile_type'}:
+                    line = []
+                    for i in range(start, end):
+                        line += [self.game.map_content[i]
+                                 + self.game.map_control_content[i]]
+                    map_lines_split += [line]
+                else:
+                    map_lines_split += [[c + ' ' for c
+                                         in self.game.map_content[start:end]]]
             if self.map_mode == 'annotations':
                 for p in self.game.info_hints:
                     map_lines_split[p.y][p.x] = 'A '
-            elif self.map_mode == 'terrain':
+            elif self.map_mode == 'all':
                 for p in self.game.portals.keys():
                     original = map_lines_split[p.y][p.x]
                     map_lines_split[p.y][p.x] = original[0] + 'P'
@@ -733,7 +739,7 @@ class TUI:
             elif self.mode.name == 'study':
                 content += 'Available actions:\n'
                 content += '[%s] – move question mark\n' % ','.join(self.movement_keys)
-                content += '[%s] – toggle view between terrain, annotations, and password protection areas\n' % self.keys['toggle_map_mode']
+                content += '[%s] – toggle view between anything, terrain, and annotations\n' % self.keys['toggle_map_mode']
                 content += '\n'
             elif self.mode.name == 'edit':
                 content += "Available actions:\n"
@@ -895,7 +901,7 @@ class TUI:
                     if self.map_mode == 'terrain':
                         self.map_mode = 'annotations'
                     elif self.map_mode == 'annotations':
-                        self.map_mode = 'control'
+                        self.map_mode = 'all'
                     else:
                         self.map_mode = 'terrain'
                 elif key in self.movement_keys: