mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Avoid lengthof() on std::array.
parent
40efa94d82
commit
481736fdfd
|
@ -80,7 +80,7 @@ void ResetHouseClassIDs()
|
|||
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid)
|
||||
{
|
||||
/* Start from 1 because 0 means that no class has been assigned. */
|
||||
for (int i = 1; i != lengthof(_class_mapping); i++) {
|
||||
for (uint i = 1; i != std::size(_class_mapping); i++) {
|
||||
HouseClassMapping *map = &_class_mapping[i];
|
||||
|
||||
if (map->class_id == grf_class_id && map->grfid == grfid) return (HouseClassID)i;
|
||||
|
|
|
@ -1708,14 +1708,15 @@ bool AfterLoadGame()
|
|||
}
|
||||
}
|
||||
|
||||
/* At version 78, industry cargo types can be changed, and are stored with the industry. For older save versions
|
||||
* copy the IndustrySpec's cargo types over to the Industry. */
|
||||
if (IsSavegameVersionBefore(SLV_78)) {
|
||||
uint j;
|
||||
for (Industry * i : Industry::Iterate()) {
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
const IndustrySpec *indsp = GetIndustrySpec(i->type);
|
||||
for (j = 0; j < lengthof(i->produced); j++) {
|
||||
for (uint j = 0; j < std::size(i->produced); j++) {
|
||||
i->produced[j].cargo = indsp->produced_cargo[j];
|
||||
}
|
||||
for (j = 0; j < lengthof(i->accepted); j++) {
|
||||
for (uint j = 0; j < std::size(i->accepted); j++) {
|
||||
i->accepted[j].cargo = indsp->accepts_cargo[j];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue