From 795a476f5d4ba157f3287d7e2f5893cc91b6732e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 18 Jan 2019 03:35:26 +0100 Subject: [PATCH] Minor refactoring. --- server_/game.py | 5 ++--- server_/map_.py | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server_/game.py b/server_/game.py index 3b3eb08..07dde9d 100644 --- a/server_/game.py +++ b/server_/game.py @@ -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))) diff --git a/server_/map_.py b/server_/map_.py index 7681600..069af8d 100644 --- a/server_/map_.py +++ b/server_/map_.py @@ -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]): -- 2.30.2