Changeset - r14015:da5c9695fabe
[Not reviewed]
master
0 4 0
rubidium - 14 years ago 2009-12-20 14:53:32
rubidium@openttd.org
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
4 files changed with 30 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/house.h
Show inline comments
 
@@ -137,4 +137,15 @@ struct HouseSpec {
 
	}
 
};
 

	
 
/**
 
 * Do HouseID translation for NewGRFs.
 
 * @param hid the HouseID to get the override for.
 
 * @return the HouseID to actually work with.
 
 */
 
static inline HouseID GetTranslatedHouseID(HouseID hid)
 
{
 
	const HouseSpec *hs = HouseSpec::Get(hid);
 
	return hs->override == INVALID_HOUSE_ID ? hid : hs->override;
 
}
 

	
 
#endif /* HOUSE_H */
src/table/town_land.h
Show inline comments
 
@@ -1810,7 +1810,7 @@ assert_compile(lengthof(_town_draw_tile_
 
 */
 
#define MS(mnd, mxd, p, rc, bn, rr, mg, ca1, ca2, ca3, bf, ba, cg1, cg2, cg3) \
 
	{mnd, mxd, p, rc, bn, rr, mg, {ca1, ca2, ca3}, {cg1, cg2, cg3}, bf, ba, true, \
 
	 0, NULL, 0, 0, {0, 0, 0, 0}, 16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, 0, 2, 0, 0, 0, NULL}
 
	 0, NULL, INVALID_HOUSE_ID, 0, {0, 0, 0, 0}, 16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, 0, 2, 0, 0, 0, NULL}
 
/** House specifications from original data */
 
static const HouseSpec _original_house_specs[] = {
 
	/**
src/town_cmd.cpp
Show inline comments
 
@@ -2094,7 +2094,7 @@ static bool BuildTownHouse(Town *t, Tile
 
		const HouseSpec *hs = HouseSpec::Get(i);
 

	
 
		/* Verify that the candidate house spec matches the current tile status */
 
		if ((~hs->building_availability & bitmask) != 0 || !hs->enabled) continue;
 
		if ((~hs->building_availability & bitmask) != 0 || !hs->enabled || hs->override != INVALID_HOUSE_ID) continue;
 

	
 
		/* Don't let these counters overflow. Global counters are 32bit, there will never be that many houses. */
 
		if (hs->class_id != HOUSE_NO_CLASS) {
 
@@ -2132,13 +2132,9 @@ static bool BuildTownHouse(Town *t, Tile
 

	
 
		const HouseSpec *hs = HouseSpec::Get(house);
 

	
 
		if (_loaded_newgrf_features.has_newhouses) {
 
			if (hs->override != 0) {
 
				house = hs->override;
 
				hs = HouseSpec::Get(house);
 
			}
 

	
 
			if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world && _game_mode != GM_EDITOR) continue;
 
		if (_loaded_newgrf_features.has_newhouses && !_generating_world &&
 
				_game_mode != GM_EDITOR && (hs->extra_flags & BUILDING_IS_HISTORICAL) != 0) {
 
			continue;
 
		}
 

	
 
		if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue;
src/town_map.h
Show inline comments
 
@@ -42,16 +42,26 @@ static inline void SetTownIndex(TileInde
 

	
 
/**
 
 * Get the type of this house, which is an index into the house spec array
 
 * Since m4 is only a byte and we want to support 512 houses, we use the bit 6
 
 * of m3 as an additional bit to house type.
 
 * without doing any NewGRF related translations.
 
 * @param t the tile
 
 * @pre IsTileType(t, MP_HOUSE)
 
 * @return house type
 
 */
 
static inline HouseID GetCleanHouseType(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_HOUSE));
 
	return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8);
 
}
 

	
 
/**
 
 * Get the type of this house, which is an index into the house spec array
 
 * @param t the tile
 
 * @pre IsTileType(t, MP_HOUSE)
 
 * @return house type
 
 */
 
static inline HouseID GetHouseType(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_HOUSE));
 
	return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8);
 
	return GetTranslatedHouseID(GetCleanHouseType(t));
 
}
 

	
 
/**
0 comments (0 inline, 0 general)