(svn r2968) -Newgrf: Implement current set of action D (ParamSet) operations.
authorpeter1138
Wed, 21 Sep 2005 19:07:58 +0000
changeset 2442 da9a2075c747
parent 2441 20ccbbcffa9b
child 2443 62ff46a3f530
(svn r2968) -Newgrf: Implement current set of action D (ParamSet) operations.
newgrf.c
--- a/newgrf.c	Tue Sep 20 19:35:52 2005 +0000
+++ b/newgrf.c	Wed Sep 21 19:07:58 2005 +0000
@@ -2070,6 +2070,46 @@
 				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;