home · contact · privacy
Allow toggling of map control preset drawing.
[plomrogue2] / plomrogue / game.py
index b394c5d1024c4662c350b5ad6fdfb8f026a2006e..4b5c3372eba5b2d96fccfb72ec0d7e8250645b37 100755 (executable)
@@ -146,6 +146,7 @@ class Game(GameBase):
             '=': Terrain('=', 'glass', blocks_sound=True, blocks_movement=True),
             'T': Terrain('T', 'table', blocks_movement=True),
         }
+        self.draw_control_presets = True
         if os.path.exists(self.io.save_file):
             if not os.path.isfile(self.io.save_file):
                 raise GameError('save file path refers to non-file')
@@ -277,7 +278,7 @@ class Game(GameBase):
             self.io.send('PLAYERS_HAT_CHARS ' + quote(player.get_cookie_chars()),
                          c_id)
             self.io.send('STATS %s %s' % (player.need_for_toilet,
-                                          player.weariness), c_id)
+                                          player.energy), c_id)
             if player.id_ in player_ids_send_fov:
                 self.io.send('FOV %s' % quote(player.fov_stencil.terrain), c_id)
                 self.io.send('MAP %s %s %s' % (self.get_map_geometry_shape(),
@@ -498,6 +499,9 @@ class Game(GameBase):
         with open(self.io.save_file, 'w') as f:
             write(f, 'TURN %s' % self.turn)
             map_geometry_shape = self.get_map_geometry_shape()
+            # must come before MAP, otherwise first get_map uses the default
+            # TODO: refactor into MAP
+            write(f, 'MAP_CONTROL_PRESETS %s' % int(self.draw_control_presets))
             write(f, 'MAP %s %s' % (map_geometry_shape, self.map_geometry.size,))
             for terrain in self.terrains.values():
                 write(f, 'TERRAIN %s %s %s %s %s' % (quote(terrain.character),
@@ -576,7 +580,7 @@ class Game(GameBase):
             maps = self.map_controls
         if big_yx not in maps:
             maps[big_yx] = SaveableMap(self.map_geometry)
-            if type_ == 'control':
+            if self.draw_control_presets and type_ == 'control':
                 maps[big_yx].draw_presets(big_yx.y % 2)
         return maps[big_yx]