Browse files

Don't assert for action sets to exist in queries about whether they e…

…xist
  • Loading branch information...
1 parent 07f31fd commit 8dbf954ffe0a4149d957d87ae0a324d58b4da02c @totycro totycro committed Apr 25, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 horizons/world/concreteobject.py
View
4 horizons/world/concreteobject.py
@@ -109,13 +109,13 @@ def get_random_action_set(cls, level=0, exact_level=False, include_preview=False
The highest level number is preferred.
@param level: level to prefer. a lower level might be chosen
@param exact_level: choose only action sets from this level. return val might be None here.
- @return: action_set_id or (if include_preview) tuple (action_set_id, preview_action_set_id)"""
+ @return: action_set_id or (if include_preview) tuple (action_set_id, preview_action_set_id) or None"""
action_sets = cls.action_sets
if exact_level:
if level in action_sets.iterkeys():
action_set, preview_set = random.choice(action_sets[level].items())
else:
- assert False, "Couldn't find action set for obj {0}({1}) in tier {2}".format(cls.id, cls.name, level)
+ return None
else: # search all levels for an action set, starting with highest one
action_set = None
for possible_level in reversed(xrange(level+1)):

0 comments on commit 8dbf954

Please sign in to comment.