mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 13:23:46 +00:00
(svn r12561) -Fix: do not affect town rating change by the order in which we examine stations
This commit is contained in:
parent
42ed287506
commit
99b2536351
@ -2261,16 +2261,23 @@ static void UpdateTownGrowRate(Town *t)
|
|||||||
if (st->time_since_load <= 20 || st->time_since_unload <= 20) {
|
if (st->time_since_load <= 20 || st->time_since_unload <= 20) {
|
||||||
n++;
|
n++;
|
||||||
if (IsValidPlayer(st->owner)) {
|
if (IsValidPlayer(st->owner)) {
|
||||||
t->ratings[st->owner] = min((int)RATING_MAXIMUM, t->ratings[st->owner] + RATING_STATION_UP_STEP);
|
int new_rating = t->ratings[st->owner] + RATING_STATION_UP_STEP;
|
||||||
|
t->ratings[st->owner] = min(new_rating, INT16_MAX); // do not let it overflow
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IsValidPlayer(st->owner)) {
|
if (IsValidPlayer(st->owner)) {
|
||||||
t->ratings[st->owner] = max((int)RATING_MINIMUM, t->ratings[st->owner] + RATING_STATION_DOWN_STEP);
|
int new_rating = t->ratings[st->owner] + RATING_STATION_DOWN_STEP;
|
||||||
|
t->ratings[st->owner] = max(new_rating, INT16_MIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* clamp all ratings to valid values */
|
||||||
|
for (uint i = 0; i < MAX_PLAYERS; i++) {
|
||||||
|
t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM);
|
||||||
|
}
|
||||||
|
|
||||||
ClrBit(t->flags12, TOWN_IS_FUNDED);
|
ClrBit(t->flags12, TOWN_IS_FUNDED);
|
||||||
if (_patches.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
|
if (_patches.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user