Codechange: Early continue for cargos not moved by this station

This commit is contained in:
Tyler Trahan
2025-07-21 06:46:16 -04:00
committed by dP
parent 726da5e7b2
commit 415bbb00c4

View File

@@ -3962,15 +3962,18 @@ static void UpdateStationRating(Station *st)
for (const CargoSpec *cs : CargoSpec::Iterate()) {
GoodsEntry *ge = &st->goods[cs->Index()];
/* The station might not currently be moving this cargo. */
if (!ge->HasRating()) {
/* Slowly increase the rating back to its original level in the case we
* didn't deliver cargo yet to this station. This happens when a bribe
* failed while you didn't moved that cargo yet to a station. */
if (!ge->HasRating() && ge->rating < INITIAL_STATION_RATING) {
ge->rating++;
if (ge->rating < INITIAL_STATION_RATING) ge->rating++;
/* Nothing else to do with this cargo. */
continue;
}
/* Only change the rating if we are moving this cargo */
if (ge->HasRating()) {
byte_inc_sat(&ge->time_since_pickup);
if (ge->time_since_pickup == 255 && _settings_game.order.selectgoods) {
ge->status.Reset(GoodsEntry::State::Rating);
@@ -4102,7 +4105,6 @@ static void UpdateStationRating(Station *st)
}
}
}
}
StationID index = st->index;
if (waiting_changed) {