Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
This commit is contained in:
@@ -1369,7 +1369,7 @@ bool Vehicle::HandleBreakdown()
|
||||
*/
|
||||
void AgeVehicle(Vehicle *v)
|
||||
{
|
||||
if (v->age < MAX_DATE) {
|
||||
if (v->age < CalendarTime::MAX_DATE) {
|
||||
v->age++;
|
||||
if (v->IsPrimaryVehicle() && v->age == VEHICLE_PROFIT_MIN_AGE + 1) GroupStatistics::VehicleReachedMinAge(v);
|
||||
}
|
||||
@@ -1378,7 +1378,7 @@ void AgeVehicle(Vehicle *v)
|
||||
|
||||
auto age = v->age - v->max_age;
|
||||
for (int32_t i = 0; i <= 4; i++) {
|
||||
if (age == DateAtStartOfYear(i)) {
|
||||
if (age == TimerGameCalendar::DateAtStartOfYear(i)) {
|
||||
v->reliability_spd_dec <<= 1;
|
||||
break;
|
||||
}
|
||||
@@ -1396,11 +1396,11 @@ void AgeVehicle(Vehicle *v)
|
||||
if (EngineHasReplacementForCompany(c, v->engine_type, v->group_id)) return;
|
||||
|
||||
StringID str;
|
||||
if (age == DateAtStartOfYear(-1)) {
|
||||
if (age == TimerGameCalendar::DateAtStartOfYear(-1)) {
|
||||
str = STR_NEWS_VEHICLE_IS_GETTING_OLD;
|
||||
} else if (age == DateAtStartOfYear(0)) {
|
||||
} else if (age == TimerGameCalendar::DateAtStartOfYear(0)) {
|
||||
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD;
|
||||
} else if (age > DateAtStartOfYear(0) && (static_cast<int32_t>(age) % DAYS_IN_LEAP_YEAR) == 0) {
|
||||
} else if (age > TimerGameCalendar::DateAtStartOfYear(0) && (static_cast<int32_t>(age) % CalendarTime::DAYS_IN_LEAP_YEAR) == 0) {
|
||||
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND;
|
||||
} else {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user