(svn r10089) -Fix (r10040): Use GetTileZ instead of GetClearGround in GetTerrainType as
authormaedhros
Mon, 11 Jun 2007 04:52:51 +0000
changeset 7345 6fab61079176
parent 7344 72e3e8607419
child 7346 3c376020c6bf
(svn r10089) -Fix (r10040): Use GetTileZ instead of GetClearGround in GetTerrainType as
GetTileZ is valid for any tile type. Also use GetTerrainType for stations.
src/newgrf_commons.cpp
src/newgrf_station.cpp
--- a/src/newgrf_commons.cpp	Sun Jun 10 23:40:29 2007 +0000
+++ b/src/newgrf_commons.cpp	Mon Jun 11 04:52:51 2007 +0000
@@ -7,7 +7,7 @@
 #include "stdafx.h"
 #include "openttd.h"
 #include "variables.h"
-#include "clear_map.h"
+#include "landscape.h"
 #include "town.h"
 #include "industry.h"
 #include "newgrf.h"
@@ -229,7 +229,7 @@
 {
 	switch (_opt.landscape) {
 		case LT_TROPIC: return GetTropicZone(tile) == TROPICZONE_DESERT ? 1 : 2;
-		case LT_ARCTIC: return (GetClearGround(tile) == CLEAR_SNOW) ? 4 : 0;
+		case LT_ARCTIC: return GetTileZ(tile) >= GetSnowLine() ? 4 : 0;
 		default:        return 0;
 	}
 }
--- a/src/newgrf_station.cpp	Sun Jun 10 23:40:29 2007 +0000
+++ b/src/newgrf_station.cpp	Mon Jun 11 04:52:51 2007 +0000
@@ -15,6 +15,7 @@
 #include "station_map.h"
 #include "newgrf.h"
 #include "newgrf_callbacks.h"
+#include "newgrf_commons.h"
 #include "newgrf_station.h"
 #include "newgrf_spritegroup.h"
 #include "date.h"
@@ -388,10 +389,7 @@
 		/* Calculated station variables */
 		case 0x40: return GetPlatformInfoHelper(tile, false, false, false);
 		case 0x41: return GetPlatformInfoHelper(tile, true,  false, false);
-		case 0x42: // Terrain and rail type
-			return ((_opt.landscape == LT_ARCTIC && GetTileZ(tile) > GetSnowLine()) ? 4 : 0) |
-			       (_opt.landscape == LT_TROPIC ? GetTropicZone(tile) : 0) |
-			       (GetRailType(tile) << 8);
+		case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8);
 		case 0x43: return st->owner; // Station owner
 		case 0x44: return 2;         // PBS status
 		case 0x45: return GetRailContinuationInfo(tile);