mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 13:23:46 +00:00
(svn r18567) -Fix [FS#2613]: [NewGRF] House property 15 did not work
This commit is contained in:
parent
1e1fa9ff2e
commit
ee3a44e74f
11
src/house.h
11
src/house.h
@ -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 */
|
||||
|
@ -1810,7 +1810,7 @@ assert_compile(lengthof(_town_draw_tile_data) == (NEW_HOUSE_OFFSET) * 4 * 4);
|
||||
*/
|
||||
#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[] = {
|
||||
/**
|
||||
|
@ -2094,7 +2094,7 @@ static bool BuildTownHouse(Town *t, TileIndex 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, TileIndex 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;
|
||||
|
@ -42,16 +42,26 @@ static inline void SetTownIndex(TileIndex t, TownID index)
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user