diff pytouhou/vm/eclrunner.py @ 87:fda176f07d6d

Fix add_int
author Thibaut Girka <thib@sitedethib.com>
date Sun, 04 Sep 2011 01:09:28 +0200
parents fc0294c745b6
children f7525fa66bb0
line wrap: on
line diff
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -202,11 +202,6 @@ class ECLRunner(object):
         self._setval(variable_id, self._enemy.x)
 
 
-    @instruction(13)
-    def set_random_int2(self, variable_id, minval, amp):
-        self._setval(variable_id, int(self._getval(minval)) + int(self._getval(amp)) * self._game_state.prng.rand_double())
-
-
     @instruction(14)
     @instruction(21)
     def substract(self, variable_id, a, b):
@@ -215,6 +210,14 @@ class ECLRunner(object):
         self._setval(variable_id, self._getval(a) - self._getval(b))
 
 
+    @instruction(13)
+    @instruction(20)
+    def add(self, variable_id, a, b):
+        #TODO: 13 takes only ints and 20 only floats.
+        # The original engine dereferences the variables in the type it waits for, so this isn't exactly the correct implementation, but the data don't contain such case.
+        self._setval(variable_id, self._getval(a) + self._getval(b))
+
+
     @instruction(15)
     def multiply_int(self, variable_id, a, b):
         #TODO: takes only ints.
@@ -232,12 +235,6 @@ class ECLRunner(object):
         self._setval(variable_id, self._getval(a) % self._getval(b))
 
 
-    @instruction(20)
-    def add_float(self, variable_id, a, b):
-        #TODO: takes only floats.
-        self._setval(variable_id, self._getval(a) + self._getval(b))
-
-
     @instruction(23)
     def divide_float(self, variable_id, a, b):
         #TODO: takes only floats.