summaryrefslogtreecommitdiff
path: root/newgrf_engine.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-20 20:21:00 +0000
committerrubidium <rubidium@openttd.org>2006-08-20 20:21:00 +0000
commit29c80979867c685af43a78589dcfa215aaddd1f5 (patch)
tree26c60f6e35de8b3a260791f8f2d26f28cc379528 /newgrf_engine.c
parent43af0ced5f2135f840124c8fe269a8d802e529b9 (diff)
downloadopenttd-29c80979867c685af43a78589dcfa215aaddd1f5.tar.xz
(svn r6013) -Fix: some newgrf properties returned the date in the new format where the newgrf's expect the original format. Thanks to michi_cc for finding these and providing the initial patch.
Diffstat (limited to 'newgrf_engine.c')
-rw-r--r--newgrf_engine.c6
1 files changed, 3 insertions, 3 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;