src/newgrf_commons.cpp
changeset 7297 1df77fb920bd
parent 7125 4ce0c7a12a3f
child 7323 b2871568db92
equal deleted inserted replaced
7296:341c1174517d 7297:1df77fb920bd
     4  * and its descendance, present and futur
     4  * and its descendance, present and futur
     5  */
     5  */
     6 
     6 
     7 #include "stdafx.h"
     7 #include "stdafx.h"
     8 #include "openttd.h"
     8 #include "openttd.h"
       
     9 #include "variables.h"
       
    10 #include "clear_map.h"
     9 #include "town.h"
    11 #include "town.h"
    10 #include "industry.h"
    12 #include "industry.h"
    11 #include "newgrf.h"
    13 #include "newgrf.h"
    12 #include "newgrf_commons.h"
    14 #include "newgrf_commons.h"
    13 
    15 
   146 
   148 
   147 		overridden_hs->override = house_id;
   149 		overridden_hs->override = house_id;
   148 		entity_overrides[i] = invalid_ID;
   150 		entity_overrides[i] = invalid_ID;
   149 	}
   151 	}
   150 }
   152 }
       
   153 
       
   154 /** Function used by houses (and soon industries) to get information
       
   155  * on type of "terrain" the tile it is queries sits on.
       
   156  * @param tile TileIndex of the tile been queried
       
   157  * @return value corresponding to the grf expected format:
       
   158  *         Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline */
       
   159 uint32 GetTerrainType(TileIndex tile)
       
   160 {
       
   161 	switch (_opt.landscape) {
       
   162 		case LT_TROPIC: return GetTropicZone(tile) == TROPICZONE_DESERT ? 1 : 2;
       
   163 		case LT_ARCTIC: return (GetClearGround(tile) == CLEAR_SNOW) ? 4 : 0;
       
   164 		default:        return 0;
       
   165 	}
       
   166 }
       
   167