home · contact · privacy
Refactoring and removal of unused code.
[plomrogue2-experiments] / server.py
index 16915e9e6671d982fb200c6aa18da8805d041205..912a6927148129ad99250bf870ebcc1620017ed2 100755 (executable)
--- a/server.py
+++ b/server.py
@@ -154,7 +154,7 @@ class CommandHandler:
         self.send_all('MAP_SIZE ' + self.stringify_yx(self.world.map_size))
         for y in range(self.world.map_size[0]):
             width = self.world.map_size[1]
-            terrain_line = self.world.map_[y * width:(y + 1) * width]
+            terrain_line = self.world.terrain_map[y * width:(y + 1) * width]
             self.send_all('TERRAIN_LINE %5s %s' % (y, self.quoted(terrain_line)))
         for thing in self.world.things:
             self.send_all('THING_TYPE %s %s' % (thing.id_, thing.type_))
@@ -170,21 +170,18 @@ class CommandHandler:
         self.world.proceed_to_next_player_turn()
         self.send_all_gamestate()
 
-    def get_player(self):
-        return self.world.get_thing(self.world.player_id)
-
     def cmd_MOVE(self, direction, connection_id):
         """Set player task to 'move' with direction arg, finish player turn."""
         if direction not in {'UP', 'DOWN', 'RIGHT', 'LEFT'}:
             raise ArgError('Move argument must be one of: '
                            'UP, DOWN, RIGHT, LEFT')
-        self.get_player().set_task('move', direction=direction)
+        self.world.get_player().set_task('move', direction=direction)
         self.proceed()
     cmd_MOVE.argtypes = 'string'
 
     def cmd_WAIT(self, connection_id):
         """Set player task to 'wait', finish player turn."""
-        self.get_player().set_task('wait')
+        self.world.get_player().set_task('wait')
         self.proceed()
 
     def cmd_MAP_SIZE(self, yx, connection_id):