summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-09-13 13:55:25 +0000
committeryexo <yexo@openttd.org>2010-09-13 13:55:25 +0000
commitce649b0a73983505b7d6e00b155006db0d244289 (patch)
treebad73942243eae93ec1f7aae0e99b8b3c7eae0fd /src/newgrf_engine.cpp
parent4d1f24330fdbbaa4113d987d53f5a1bfe9accd83 (diff)
downloadopenttd-ce649b0a73983505b7d6e00b155006db0d244289.tar.xz
(svn r20799) -Fix: [NewGRF] clamp vehicle var 0xC2 (max age) to uint16 (Hirundo)
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index e688c417f..1866af6c4 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -742,8 +742,8 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
case 0x3F: return v->cargo.DaysInTransit();
case 0x40: return ClampToU16(v->age);
case 0x41: return GB(ClampToU16(v->age), 8, 8);
- case 0x42: return v->max_age;
- case 0x43: return GB(v->max_age, 8, 8);
+ case 0x42: return ClampToU16(v->max_age);
+ case 0x43: return GB(ClampToU16(v->max_age), 8, 8);
case 0x44: return Clamp(v->build_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
case 0x45: return v->unitnumber;
case 0x46: return Engine::Get(v->engine_type)->grf_prop.local_id;