comparison pytouhou/vm/eclrunner.py @ 272:b21acb12bed1

Fix timeout handling
author Thibaut Girka <thib@sitedethib.com>
date Tue, 24 Jan 2012 02:22:50 +0100
parents 80e73b8245a4
children 595b227886b1
comparison
equal deleted inserted replaced
271:80e73b8245a4 272:b21acb12bed1
171 if enm.timeout_callback >= 0: 171 if enm.timeout_callback >= 0:
172 self.frame = 0 172 self.frame = 0
173 self.sub = enm.timeout_callback 173 self.sub = enm.timeout_callback
174 self.instruction_pointer = 0 174 self.instruction_pointer = 0
175 enm.timeout_callback = -1 175 enm.timeout_callback = -1
176 elif enm.touchable:
177 enm.life = 0
178 elif enm.death_callback >= 0:
179 self.frame = 0
180 self.sub = enm.death_callback
181 self.instruction_pointer = 0
182 enm.death_callback = -1
183 enm.timeout = -1 #TODO: check
176 else: 184 else:
177 enm.life = 0 185 raise Exception('What the hell, man!')
178 #TODO: other callbacks (low life, etc.)
179 186
180 187
181 def run_iteration(self): 188 def run_iteration(self):
182 # First, if enemy is dead, return 189 # First, if enemy is dead, return
183 if self._enemy._removed: 190 if self._enemy._removed: