home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 18 Jan 2019 02:35:26 +0000 (03:35 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 18 Jan 2019 02:35:26 +0000 (03:35 +0100)
server_/game.py
server_/map_.py

index 3b3eb0844cc7d527c95eed54282db4799c0ecff7..07dde9d5011144f155758a0304479b1c046a94df 100644 (file)
@@ -163,7 +163,6 @@ class Game(game_common.CommonCommandsMixin):
 
     def __init__(self, game_file_name):
         import server_.io
-        #self.get_map_class = server_.map_.get_map_class
         self.map_manager = server_.map_.map_manager
         self.world = World(self)
         self.io = server_.io.GameIO(game_file_name, self)
@@ -181,8 +180,8 @@ class Game(game_common.CommonCommandsMixin):
             return 'Y:' + str(tuple_[0]) + ',X:' + str(tuple_[1])
 
         self.io.send('NEW_TURN ' + str(self.world.turn))
-        grid = self.world.map_.__class__.__name__[3:]
-        self.io.send('MAP ' + grid +' ' + stringify_yx(self.world.map_.size))
+        self.io.send('MAP ' + self.world.map_.geometry +\
+                     ' ' + stringify_yx(self.world.map_.size))
         visible_map = self.world.get_player().get_visible_map()
         for y, line in visible_map.lines():
             self.io.send('VISIBLE_MAP_LINE %5s %s' % (y, self.io.quote(line)))
index 768160005ea3bf985d313939ad4aa7fc1dbd5da5..069af8dc92fe8c68a52f609bcb75daa3cef96e49 100644 (file)
@@ -19,6 +19,10 @@ class Map(game_common.Map):
             for x in range(self.size[1]):
                 yield [y, x]
 
+    @property
+    def geometry(self):
+        return self.__class__.__name__[3:]
+
     def lines(self):
         width = self.size[1]
         for y in range(self.size[0]):