Codechange: Use range-for to simplify getting first non-zero value.
This reduces indexed array access.
This commit is contained in:

committed by
Peter Nelson

parent
4181d3c1ff
commit
3f853d8003
@@ -1373,8 +1373,8 @@ static bool VehicleCargoSorter(const Vehicle * const &a, const Vehicle * const &
|
||||
for (v = b; v != nullptr; v = v->Next()) diff[v->cargo_type] -= v->cargo_cap;
|
||||
|
||||
int r = 0;
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
r = diff[i];
|
||||
for (uint d : diff) {
|
||||
r = d;
|
||||
if (r != 0) break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user