home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Lots of refactoring to enable SAVE command.
[plomrogue2-experiments]
/
game_common.py
diff --git
a/game_common.py
b/game_common.py
index 3c17bd1b3c06abd2c40116291c0fc8da15cfd584..c0fb98b3fa9138a5766c3b6be70d47b12ad28240 100644
(file)
--- a/
game_common.py
+++ b/
game_common.py
@@
-54,13
+54,15
@@
class World:
self.turn = 0
self.things = []
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
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)
def new_map(self, geometry, yx):
map_type = self.game.map_manager.get_map_class(geometry)