changeset 18305:b63ed3b18fd0 draft

(svn r23141) -Change: [NewGRF v8] Invert result bit 10 of callbacks 149 and 157 to make them consistent with other slope check callbacks. (michi_cc)
author frosch <frosch@openttd.org>
date Tue, 08 Nov 2011 17:24:31 +0000
parents b84b00f90388
children 21d2cc91c3ce
files src/newgrf_station.cpp src/object_cmd.cpp
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -694,8 +694,9 @@
 	/* Failed callback means success. */
 	if (cb_res == CALLBACK_FAILED) return CommandCost();
 
-	/* The meaning of bit 10 is inverted in the result of this callback. */
-	return GetErrorMessageFromLocationCallbackResult(ToggleBit(cb_res, 10), statspec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+	/* The meaning of bit 10 is inverted for a grf version < 8. */
+	if (statspec->grf_prop.grffile->grf_version < 8) ToggleBit(cb_res, 10);
+	return GetErrorMessageFromLocationCallbackResult(cb_res, statspec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 }
 
 
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -241,9 +241,10 @@
 
 			if (callback == CALLBACK_FAILED) {
 				cost.AddCost(CheckBuildableTile(t, 0, allowed_z, false, false));
-			} else if (callback != 0) {
-				/* The meaning of bit 10 is inverted in the result of this callback. */
-				return GetErrorMessageFromLocationCallbackResult(ToggleBit(callback, 10), spec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+			} else {
+				/* The meaning of bit 10 is inverted for a grf version < 8. */
+				if (spec->grf_prop.grffile->grf_version < 8) ToggleBit(callback, 10);
+				return GetErrorMessageFromLocationCallbackResult(callback, spec->grf_prop.grffile->grfid, STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 			}
 		}