Extra House ID's

Use an extra unused bit in m3 to boost the max number of house types from 512 to 1024. So-far everything works, construction stages and animations appear unaffacted by my hubris.
pull/238/head
reldred 3 years ago
parent fcded2aff7
commit 51c0b222cc

@ -26,7 +26,7 @@ static const HouseID NUM_HOUSES_PER_GRF = 255; ///< Number of supported house
static const uint HOUSE_NO_CLASS = 0;
static const HouseID NEW_HOUSE_OFFSET = 110; ///< Offset for new houses.
static const HouseID NUM_HOUSES = 512; ///< Total number of houses.
static const HouseID NUM_HOUSES = 1024; ///< Total number of houses.
static const HouseID INVALID_HOUSE_ID = 0xFFFF;
static const uint HOUSE_NUM_ACCEPTS = 16; ///< Max number of cargoes accepted by a tile

@ -47,7 +47,7 @@ static inline void SetTownIndex(TileIndex t, TownID index)
static inline HouseID GetCleanHouseType(TileIndex t)
{
assert_tile(IsTileType(t, MP_HOUSE), t);
return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8);
return _m[t].m4 | (GB(_m[t].m3, 5, 2) << 8);
}
/**
@ -71,7 +71,7 @@ static inline void SetHouseType(TileIndex t, HouseID house_id)
{
assert_tile(IsTileType(t, MP_HOUSE), t);
_m[t].m4 = GB(house_id, 0, 8);
SB(_m[t].m3, 6, 1, GB(house_id, 8, 1));
SB(_m[t].m3, 5, 2, GB(house_id, 8, 2));
}
/**

Loading…
Cancel
Save