diff options
author | frosch <frosch@openttd.org> | 2010-07-11 17:11:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-07-11 17:11:14 +0000 |
commit | 19fb8ba6f88d2f684546e93388418f3757d80612 (patch) | |
tree | 706e2845b26f7fa3a3d7f5c54909ff3b357fc91c /src | |
parent | 987417e6653f2f30556ac7a604333b577f269929 (diff) | |
download | openttd-19fb8ba6f88d2f684546e93388418f3757d80612.tar.xz |
(svn r20125) -Change: [NewGRF] If a tile has a snow-flag in the map array, use that for Terrain Type variables, instead of always only using the tile Z position. Also use the maximum Z of a tile for tiles which usually have levelling foundations (stations, houses, industries, unmovables).
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_commons.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index f95ad985c..ec4810461 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -17,8 +17,10 @@ #include "industrytype.h" #include "newgrf.h" #include "newgrf_commons.h" +#include "clear_map.h" #include "station_map.h" #include "tree_map.h" +#include "tunnelbridge_map.h" #include "core/mem_func.hpp" /** Constructor of generic class @@ -284,7 +286,49 @@ uint32 GetTerrainType(TileIndex tile) { switch (_settings_game.game_creation.landscape) { case LT_TROPIC: return GetTropicZone(tile); - case LT_ARCTIC: return GetTileZ(tile) > GetSnowLine() ? 4 : 0; + case LT_ARCTIC: { + bool has_snow; + switch (GetTileType(tile)) { + case MP_CLEAR: + has_snow = IsSnowTile(tile); + break; + + case MP_RAILWAY: { + RailGroundType ground = GetRailGroundType(tile); + has_snow = (ground == RAIL_GROUND_ICE_DESERT); + break; + } + + case MP_ROAD: + has_snow = IsOnSnow(tile); + break; + + case MP_TREES: { + TreeGround ground = GetTreeGround(tile); + has_snow = (ground == TREE_GROUND_SNOW_DESERT || ground == TREE_GROUND_ROUGH_SNOW); + break; + } + + case MP_TUNNELBRIDGE: + has_snow = HasTunnelBridgeSnowOrDesert(tile); + break; + + case MP_STATION: + case MP_HOUSE: + case MP_INDUSTRY: + case MP_UNMOVABLE: + /* These tiles usually have a levelling foundation. So use max Z */ + has_snow = (GetTileMaxZ(tile) > GetSnowLine()); + break; + + case MP_WATER: + has_snow = (GetTileZ(tile) > GetSnowLine()); + break; + + default: NOT_REACHED(); + } + return has_snow ? 4 : 0; + } default: return 0; } } |