summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2006-12-10 00:48:50 +0000
committerglx <glx@openttd.org>2006-12-10 00:48:50 +0000
commit6bc56c61e3638e37c03b09016713fee214cfb588 (patch)
treea45e0c486ae7e6da1fae20d688dd4d35b0257c5d /newgrf.c
parent14363bfb511ac9d81beaa31783ea54c8c8c6e8c4 (diff)
downloadopenttd-6bc56c61e3638e37c03b09016713fee214cfb588.tar.xz
(svn r7462) -Fix: when doing comparison in action 7/9, mask the param value so it has the 'same' size as the value it is compared to
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/newgrf.c b/newgrf.c
index 308e925cc..2f162f826 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -2370,23 +2370,19 @@ static void SkipIf(byte *buf, int len)
param_val = GetParamVal(param, &cond_val);
- /* Apply parameter mask, only for GRF parameters. */
- if (param < 0x80) param_val &= mask;
-
DEBUG(grf, 7) ("Test condtype %d, param 0x%08X, condval 0x%08X", condtype, param_val, cond_val);
switch (condtype) {
case 0: result = !!(param_val & (1 << cond_val));
break;
case 1: result = !(param_val & (1 << cond_val));
break;
- /* TODO: For the following, make it to work with paramsize>1. */
- case 2: result = (param_val == cond_val);
+ case 2: result = (param_val & mask) == cond_val;
break;
- case 3: result = (param_val != cond_val);
+ case 3: result = (param_val & mask) != cond_val;
break;
- case 4: result = (param_val < cond_val);
+ case 4: result = (param_val & mask) < cond_val;
break;
- case 5: result = (param_val > cond_val);
+ case 5: result = (param_val & mask) > cond_val;
break;
/* Tests 6 to 10 are only for param 0x88, GRFID checks */