home · contact · privacy
Refactor / encapsulate Map stuff into own module.
[plomrogue2-experiments] / client.py
index e270a8c9a63d6dc424ce28ef3c91c38febbf387c..9d0da0d534399be8f546258d8976036ac53c9eb6 100755 (executable)
--- a/client.py
+++ b/client.py
@@ -7,6 +7,10 @@ from parser import ArgError, Parser
 import game_common
 
 
+def get_map_class(geometry):
+    return globals()['Map' + geometry]
+
+
 class MapSquare(game_common.Map):
 
     def list_terrain_to_lines(self, terrain_as_list):
@@ -47,9 +51,8 @@ class World(game_common.World):
         on any update, even before we actually receive map data.
         """
         super().__init__(*args, **kwargs)
-        self.MapHex = MapHex
-        self.MapSquare = MapSquare
-        self.map_ = self.MapHex()
+        self.get_map_class = get_map_class
+        self.map_ = self.get_map_class('Hex')()
 
 
 class Game(game_common.CommonCommandsMixin):