Mercurial > hg > openttd
changeset 18007:c7a5373f1a03 draft
(svn r22816) -Feature(ette): [NewGRF] Also age wagons and articulated parts.
author | frosch <frosch@openttd.org> |
---|---|
date | Mon, 22 Aug 2011 21:33:58 +0000 |
parents | 0f3a7e784f69 |
children | cf2c1b7a2231 |
files | src/roadveh_cmd.cpp src/train_cmd.cpp src/vehicle.cpp |
diffstat | 3 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1591,12 +1591,13 @@ void RoadVehicle::OnNewDay() { + AgeVehicle(this); + if (!this->IsFrontEngine()) return; if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this); if (this->blocked_ctr == 0) CheckVehicleBreakdown(this); - AgeVehicle(this); CheckIfRoadVehNeedsService(this); CheckOrders(this);
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3778,11 +3778,12 @@ void Train::OnNewDay() { + AgeVehicle(this); + if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this); if (this->IsFrontEngine()) { CheckVehicleBreakdown(this); - AgeVehicle(this); CheckIfTrainNeedsService(this); @@ -3806,9 +3807,6 @@ SetWindowDirty(WC_VEHICLE_DETAILS, this->index); SetWindowClassesDirty(WC_TRAINS_LIST); } - } else if (this->IsEngine()) { - /* Also age engines that aren't front engines */ - AgeVehicle(this); } }
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1138,6 +1138,8 @@ { if (v->age < MAX_DAY) v->age++; + if (!v->IsPrimaryVehicle() && (v->type != VEH_TRAIN || !Train::From(v)->IsEngine())) return; + int age = v->age - v->max_age; if (age == DAYS_IN_LEAP_YEAR * 0 || age == DAYS_IN_LEAP_YEAR * 1 || age == DAYS_IN_LEAP_YEAR * 2 || age == DAYS_IN_LEAP_YEAR * 3 || age == DAYS_IN_LEAP_YEAR * 4) {