X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=game_common.py;h=7731c61eebe782e8c8e07187e9925a1d20343539;hb=f196909e2e033278e1492e60024fbc34e58eecb8;hp=3c17bd1b3c06abd2c40116291c0fc8da15cfd584;hpb=6237227d771fa5b4cfbcdffb8c74457e2d406bb1;p=plomrogue2-experiments
diff --git a/game_common.py b/game_common.py
index 3c17bd1..7731c61 100644
--- a/game_common.py
+++ b/game_common.py
@@ -3,12 +3,9 @@ from parser import ArgError
class MapManager:
- def __init__(self, globs):
- """With globs a globals() call, collect caller's Map classes."""
- self.map_classes = []
- for name in globs:
- if name[:3] == 'Map':
- self.map_classes += [globs[name]]
+ def __init__(self, map_classes):
+ """Collects tuple of basic Map[Geometry] classes."""
+ self.map_classes = map_classes
def get_map_geometries(self):
geometries = []
@@ -54,13 +51,15 @@ class World:
self.turn = 0
self.things = []
- def get_thing(self, id_):
+ def get_thing(self, id_, create_unfound=True):
for thing in self.things:
if id_ == thing.id_:
return thing
- t = self.Thing(self, id_)
- self.things += [t]
- return t
+ if create_unfound:
+ t = self.Thing(self, id_)
+ self.things += [t]
+ return t
+ return None
def new_map(self, geometry, yx):
map_type = self.game.map_manager.get_map_class(geometry)