mirror of https://github.com/OpenTTD/OpenTTD
(svn r22816) -Feature(ette): [NewGRF] Also age wagons and articulated parts.
parent
3957f428b1
commit
28117b3eb0
|
@ -1591,12 +1591,13 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
|
||||||
|
|
||||||
void RoadVehicle::OnNewDay()
|
void RoadVehicle::OnNewDay()
|
||||||
{
|
{
|
||||||
|
AgeVehicle(this);
|
||||||
|
|
||||||
if (!this->IsFrontEngine()) return;
|
if (!this->IsFrontEngine()) return;
|
||||||
|
|
||||||
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
|
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
|
||||||
if (this->blocked_ctr == 0) CheckVehicleBreakdown(this);
|
if (this->blocked_ctr == 0) CheckVehicleBreakdown(this);
|
||||||
|
|
||||||
AgeVehicle(this);
|
|
||||||
CheckIfRoadVehNeedsService(this);
|
CheckIfRoadVehNeedsService(this);
|
||||||
|
|
||||||
CheckOrders(this);
|
CheckOrders(this);
|
||||||
|
|
|
@ -3778,11 +3778,12 @@ static void CheckIfTrainNeedsService(Train *v)
|
||||||
|
|
||||||
void Train::OnNewDay()
|
void Train::OnNewDay()
|
||||||
{
|
{
|
||||||
|
AgeVehicle(this);
|
||||||
|
|
||||||
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
|
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
|
||||||
|
|
||||||
if (this->IsFrontEngine()) {
|
if (this->IsFrontEngine()) {
|
||||||
CheckVehicleBreakdown(this);
|
CheckVehicleBreakdown(this);
|
||||||
AgeVehicle(this);
|
|
||||||
|
|
||||||
CheckIfTrainNeedsService(this);
|
CheckIfTrainNeedsService(this);
|
||||||
|
|
||||||
|
@ -3806,9 +3807,6 @@ void Train::OnNewDay()
|
||||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||||
SetWindowClassesDirty(WC_TRAINS_LIST);
|
SetWindowClassesDirty(WC_TRAINS_LIST);
|
||||||
}
|
}
|
||||||
} else if (this->IsEngine()) {
|
|
||||||
/* Also age engines that aren't front engines */
|
|
||||||
AgeVehicle(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1138,6 +1138,8 @@ void AgeVehicle(Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->age < MAX_DAY) v->age++;
|
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;
|
int age = v->age - v->max_age;
|
||||||
if (age == DAYS_IN_LEAP_YEAR * 0 || age == DAYS_IN_LEAP_YEAR * 1 ||
|
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) {
|
age == DAYS_IN_LEAP_YEAR * 2 || age == DAYS_IN_LEAP_YEAR * 3 || age == DAYS_IN_LEAP_YEAR * 4) {
|
||||||
|
|
Loading…
Reference in New Issue