- for mt in t["T_MEMTHING"]:
- if ord_blank != chr(t["T_MEMMAP"][(mt[1] * \
- world_db["MAP_LENGTH"]) + mt[2]]) \
- and world_db["ThingTypes"][mt[0]]["TT_TOOL"] == "food" \
- and world_db["ThingTypes"][mt[0]]["TT_TOOLPOWER"] \
- > eat_cost:
- return True
+ map_len = world_db["MAP_LENGTH"]
+ try:
+ next(mt for mt in t["T_MEMTHING"]
+ if ord_blank != t["T_MEMMAP"][mt[1] * map_len + mt[2]]
+ and world_db["ThingTypes"][mt[0]]["TT_TOOL"] == "food"
+ and world_db["ThingTypes"][mt[0]]["TT_TOOLPOWER"]
+ > eat_cost)
+ except StopIteration:
+ return False
+ return True
+