summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-08 22:53:10 +0000
committerrubidium <rubidium@openttd.org>2007-09-08 22:53:10 +0000
commit10ea6cd13c576d2a339d1ac65c8c53d0abdb16be (patch)
tree6f18d2db6c76f7ef0dd79e40290dd1a42cf77efc /src
parent211b8dea39df6e8f38042f520269d7cb5d851ea9 (diff)
downloadopenttd-10ea6cd13c576d2a339d1ac65c8c53d0abdb16be.tar.xz
(svn r11064) -Fix [FS#553]: when autorenew is enabled and it cannot renew the vehicle anymore (because the player cannot build the engine), the aging warnings as if autorenew is not enabled are shown.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 85ddcd377..4728f10dc 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1470,8 +1470,8 @@ static void ShowVehicleGettingOld(Vehicle *v, StringID msg)
{
if (v->owner != _local_player) return;
- /* Do not show getting-old message if autorenew is active */
- if (GetPlayer(v->owner)->engine_renew) return;
+ /* Do not show getting-old message if autorenew is active (and it can replace the vehicle) */
+ if (GetPlayer(v->owner)->engine_renew && GetEngine(v->engine_type)->player_avail != 0) return;
SetDParam(0, _vehicle_type_names[v->type]);
SetDParam(1, v->unitnumber);
@@ -1480,14 +1480,10 @@ static void ShowVehicleGettingOld(Vehicle *v, StringID msg)
void AgeVehicle(Vehicle *v)
{
- int age;
+ if (v->age < 65535) v->age++;
- if (v->age < 65535)
- v->age++;
-
- age = v->age - v->max_age;
- if (age == 366*0 || age == 366*1 || age == 366*2 || age == 366*3 || age == 366*4)
- v->reliability_spd_dec <<= 1;
+ int age = v->age - v->max_age;
+ if (age == 366*0 || age == 366*1 || age == 366*2 || age == 366*3 || age == 366*4) v->reliability_spd_dec <<= 1;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -1495,7 +1491,7 @@ void AgeVehicle(Vehicle *v)
ShowVehicleGettingOld(v, STR_01A0_IS_GETTING_OLD);
} else if (age == 0) {
ShowVehicleGettingOld(v, STR_01A1_IS_GETTING_VERY_OLD);
- } else if (age == 366*1 || age == 366*2 || age == 366*3 || age == 366*4 || age == 366*5) {
+ } else if ((age % 366) == 0) {
ShowVehicleGettingOld(v, STR_01A2_IS_GETTING_VERY_OLD_AND);
}
}