summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newgrf_engine.c6
-rw-r--r--newgrf_spritegroup.c2
-rw-r--r--newgrf_station.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/newgrf_engine.c b/newgrf_engine.c
index 8413770d5..800be6523 100644
--- a/newgrf_engine.c
+++ b/newgrf_engine.c
@@ -694,8 +694,8 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
case 0x0D: return v->cur_order_index;
case 0x10: return v->load_unload_time_rem;
case 0x11: return v->load_unload_time_rem & 0xFF;
- case 0x12: return v->date_of_last_service;
- case 0x13: return v->date_of_last_service & 0xFF;
+ case 0x12: return max(v->date_of_last_service - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
+ case 0x13: return max(v->date_of_last_service - DAYS_TILL_ORIGINAL_BASE_YEAR, 0) & 0xFF;
case 0x14: return v->service_interval;
case 0x15: return v->service_interval & 0xFF;
case 0x16: return v->last_station_visited;
@@ -727,7 +727,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
case 0x41: return v->age & 0xFF;
case 0x42: return v->max_age;
case 0x43: return v->max_age & 0xFF;
- case 0x44: return v->build_year;
+ case 0x44: return clamp(v->build_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
case 0x45: return v->unitnumber;
case 0x46: return v->engine_type;
case 0x47: return v->engine_type & 0xFF;
diff --git a/newgrf_spritegroup.c b/newgrf_spritegroup.c
index 601116e7a..591a1f736 100644
--- a/newgrf_spritegroup.c
+++ b/newgrf_spritegroup.c
@@ -75,7 +75,7 @@ static inline uint32 GetVariable(const ResolverObject *object, byte variable, by
{
/* Return common variables */
switch (variable) {
- case 0x00: return _date;
+ case 0x00: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
case 0x01: return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
case 0x02: return _cur_month;
case 0x03: return _opt.landscape;
diff --git a/newgrf_station.c b/newgrf_station.c
index 0c602f646..548727b7d 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -325,7 +325,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
case 0x42: return 0; /* Rail type (XXX Get current type from GUI?) */
case 0x43: return _current_player; /* Station owner */
case 0x44: return 2; /* PBS status */
- case 0xFA: return _date; /* Build date */
+ case 0xFA: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); /* Build date */
}
*available = false;
@@ -372,7 +372,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
case 0xF3: return st->bus_stops->status;
case 0xF6: return st->airport_flags;
case 0xF7: return st->airport_flags & 0xFF;
- case 0xFA: return st->build_date;
+ case 0xFA: return max(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
}
/* Handle cargo variables (deprecated) */