mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Codechange: Limit house default cargo label lists to original slot counts. (#13079)
Same as for IndustrySpec and IndustryTileSpec.
This commit is contained in:
parent
d6c2f9edf1
commit
98c8445519
@ -101,7 +101,6 @@ struct HouseSpec {
|
||||
uint8_t mail_generation; ///< mail generation multiplier (tile based, as the acceptances below)
|
||||
uint8_t cargo_acceptance[HOUSE_NUM_ACCEPTS]; ///< acceptance level for the cargo slots
|
||||
CargoID accepts_cargo[HOUSE_NUM_ACCEPTS]; ///< input cargo slots
|
||||
CargoLabel accepts_cargo_label[HOUSE_NUM_ACCEPTS]; ///< input landscape cargo slots
|
||||
BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...)
|
||||
HouseZones building_availability; ///< where can it be built (climates, zones)
|
||||
bool enabled; ///< the house is available to build (true by default, but can be disabled by newgrf)
|
||||
@ -118,6 +117,8 @@ struct HouseSpec {
|
||||
uint8_t minimum_life; ///< The minimum number of years this house will survive before the town rebuilds it
|
||||
CargoTypes watched_cargoes; ///< Cargo types watched for acceptance.
|
||||
|
||||
CargoLabel accepts_cargo_label[HOUSE_ORIGINAL_NUM_ACCEPTS]; ///< input landscape cargo slots
|
||||
|
||||
HouseID Index() const;
|
||||
Money GetRemovalCost() const;
|
||||
|
||||
|
@ -2639,7 +2639,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt
|
||||
housespec->accepts_cargo[i] = INVALID_CARGO;
|
||||
housespec->cargo_acceptance[i] = 0;
|
||||
}
|
||||
housespec->accepts_cargo_label[i] = CT_INVALID;
|
||||
if (i < std::size(housespec->accepts_cargo_label)) housespec->accepts_cargo_label[i] = CT_INVALID;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -9376,7 +9376,7 @@ static void FinaliseHouseArray()
|
||||
}
|
||||
|
||||
/* Apply default cargo translation map for unset cargo slots */
|
||||
for (uint i = 0; i < lengthof(hs->accepts_cargo); ++i) {
|
||||
for (uint i = 0; i < lengthof(hs->accepts_cargo_label); ++i) {
|
||||
if (!IsValidCargoID(hs->accepts_cargo[i])) hs->accepts_cargo[i] = GetCargoIDByLabel(hs->accepts_cargo_label[i]);
|
||||
/* Disable acceptance if cargo type is invalid. */
|
||||
if (!IsValidCargoID(hs->accepts_cargo[i])) hs->cargo_acceptance[i] = 0;
|
||||
|
@ -1813,9 +1813,8 @@ static_assert(lengthof(_town_draw_tile_data) == (NEW_HOUSE_OFFSET) * 4 * 4);
|
||||
{mnd, mxd, p, rc, bn, rr, mg, \
|
||||
{ca1, ca2, ca3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \
|
||||
{INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO, INVALID_CARGO}, \
|
||||
{cg1, cg2, cg3, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, \
|
||||
bf, ba, true, GRFFileProps(INVALID_HOUSE_ID), 0, {COLOUR_BEGIN, COLOUR_BEGIN, COLOUR_BEGIN, COLOUR_BEGIN}, \
|
||||
16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, {0, 2, 0, 0}, 0, 0, 0}
|
||||
16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, {0, 2, 0, 0}, 0, 0, 0, {cg1, cg2, cg3}, }
|
||||
/** House specifications from original data */
|
||||
extern const HouseSpec _original_house_specs[] = {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user