(svn r4817) - NewGRF: allow partial support for parameter retrieval in action D.
authorpeter1138
Wed, 10 May 2006 21:41:16 +0000
changeset 3807 736ea84b3cf4
parent 3806 cf2afd9440a1
child 3808 dadaaa757e8f
(svn r4817) - NewGRF: allow partial support for parameter retrieval in action D.
newgrf.c
--- a/newgrf.c	Wed May 10 21:34:57 2006 +0000
+++ b/newgrf.c	Wed May 10 21:41:16 2006 +0000
@@ -2292,10 +2292,12 @@
 	 * - it OR A PARAMETER WITH HIGHER NUMBER has been set to any value by
 	 *   an earlier action D */
 	if (oper & 0x80) {
-		if (_cur_grffile->param_end < target)
-			oper &= 0x7F;
-		else
+		if (target < 0x80 && target < _cur_grffile->param_end) {
+			DEBUG(grf, 7) ("Param %u already defined, skipping.", target);
 			return;
+		}
+
+		oper &= 0x7F;
 	}
 
 	/* The source1 and source2 operands refer to the grf parameter number
@@ -2306,13 +2308,15 @@
 	if (src1 == 0xFF) {
 		src1 = data;
 	} else {
-		src1 = _cur_grffile->param_end >= src1 ? _cur_grffile->param[src1] : 0;
+		uint32 temp;
+		src1 = GetParamVal(src1, &temp);
 	}
 
 	if (src2 == 0xFF) {
 		src2 = data;
 	} else {
-		src2 = _cur_grffile->param_end >= src2 ? _cur_grffile->param[src2] : 0;
+		uint32 temp;
+		src2 = GetParamVal(src2, &temp);
 	}
 
 	/* TODO: You can access the parameters of another GRF file by using