1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 00:42:45 +01:00

Codechange: Use reference for always_accepted output parameter of AddAcceptedCargo. (#12854)

This parameter should always present (see tile_cmd.h:186), so use a reference to ensure it is.
This commit is contained in:
Peter Nelson
2024-07-10 12:30:14 +01:00
committed by GitHub
parent 60c3913a99
commit 93eb27d8df
4 changed files with 18 additions and 11 deletions

View File

@@ -409,7 +409,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
return FlatteningFoundation(tileh);
}
static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, CargoTypes *always_accepted)
static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted)
{
IndustryGfx gfx = GetIndustryGfx(tile);
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
@@ -459,13 +459,13 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca
acceptance[a] += cargo_acceptance[i];
/* Maybe set 'always accepted' bit (if it's not set already) */
if (HasBit(*always_accepted, a)) continue;
if (HasBit(always_accepted, a)) continue;
/* Test whether the industry itself accepts the cargo type */
if (ind->IsCargoAccepted(a)) continue;
/* If the industry itself doesn't accept this cargo, set 'always accepted' bit */
SetBit(*always_accepted, a);
SetBit(always_accepted, a);
}
}