Change: Reorganise industry accept/produce arrays. (#10853)
Use a array of struct for each cargo instead of an array for each statistic. This makes iterating for acceptance and production much simpler. pct_transported is now calculated when needed.
This commit is contained in:
@@ -95,13 +95,7 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
|
||||
/* Only add the tile if it accepts the cargo (sometimes just 1 tile of an
|
||||
* industry triggers the acceptance). */
|
||||
CargoArray acceptance = ::GetAcceptanceAroundTiles(cur_tile, 1, 1, radius);
|
||||
{
|
||||
bool cargo_accepts = false;
|
||||
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
|
||||
if (::IsValidCargoID(i->accepts_cargo[j]) && acceptance[i->accepts_cargo[j]] != 0) cargo_accepts = true;
|
||||
}
|
||||
if (!cargo_accepts) continue;
|
||||
}
|
||||
if (std::none_of(std::begin(i->accepted), std::end(i->accepted), [&acceptance](const auto &a) { return ::IsValidCargoID(a.cargo) && acceptance[a.cargo] != 0; })) continue;
|
||||
|
||||
this->AddTile(cur_tile);
|
||||
}
|
||||
|
Reference in New Issue
Block a user