changeset 272:b21acb12bed1

Fix timeout handling
author Thibaut Girka <thib@sitedethib.com>
date Tue, 24 Jan 2012 02:22:50 +0100
parents 80e73b8245a4
children 595b227886b1
files pytouhou/vm/eclrunner.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -173,9 +173,16 @@ class ECLRunner(object):
                 self.sub = enm.timeout_callback
                 self.instruction_pointer = 0
                 enm.timeout_callback = -1
-            else:
+            elif enm.touchable:
                 enm.life = 0
-        #TODO: other callbacks (low life, etc.)
+            elif enm.death_callback >= 0:
+                self.frame = 0
+                self.sub = enm.death_callback
+                self.instruction_pointer = 0
+                enm.death_callback = -1
+                enm.timeout = -1 #TODO: check
+            else:
+                raise Exception('What the hell, man!')
 
 
     def run_iteration(self):