diff options
author | peter1138 <peter1138@openttd.org> | 2005-09-21 19:07:58 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2005-09-21 19:07:58 +0000 |
commit | 1195076373297f4d60a5705966f483b42cddf9ea (patch) | |
tree | 30c7afc02258e7a03afbb4a1d8ef3b8cc1c2699b | |
parent | 4d8c903d62547f1dd0dd0f0acf7231aa2e94e3f3 (diff) | |
download | openttd-1195076373297f4d60a5705966f483b42cddf9ea.tar.xz |
(svn r2968) -Newgrf: Implement current set of action D (ParamSet) operations.
-rw-r--r-- | newgrf.c | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -2070,6 +2070,46 @@ static void ParamSet(byte *buf, int len) res = (int32)src1 << src2; break; + case 0x07: /* Bitwise AND */ + res = src1 & src2; + break; + + case 0x08: /* Bitwise OR */ + res = src1 | src2; + break; + + case 0x09: /* Unsigned division */ + if (src2 == 0) { + res = src1; + } else { + res = src1 / src2; + } + break; + + case 0x0A: /* Signed divison */ + if (src2 == 0) { + res = src1; + } else { + res = (int32)src1 / (int32)src2; + } + break; + + case 0x0B: /* Unsigned modulo */ + if (src2 == 0) { + res = src1; + } else { + res = src1 % src2; + } + break; + + case 0x0C: /* Signed modulo */ + if (src2 == 0) { + res = src1; + } else { + res = (int32)src1 % (int32)src2; + } + break; + default: grfmsg(GMS_ERROR, "ParamSet: Unknown operation %d, skipping.", oper); return; |