Changeset - r15466:2b6ac974541f
[Not reviewed]
master
0 1 0
frosch - 14 years ago 2010-07-11 17:11:14
frosch@openttd.org
(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).
1 file changed with 45 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_commons.cpp
Show inline comments
 
@@ -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;
 
	}
 
}
0 comments (0 inline, 0 general)