Mercurial > hg > openttd
changeset 15457:a4ca05c4772a draft
(svn r20106) -Fix (r5999): Engine and vehicle age were clamped at 0xFFFF, though there are 32bit available.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 10 Jul 2010 08:54:57 +0000 |
parents | 191f2e65fb67 |
children | 53df44fca900 |
files | src/engine.cpp src/newgrf_engine.cpp src/vehicle.cpp |
diffstat | 3 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/engine.cpp +++ b/src/engine.cpp @@ -734,7 +734,7 @@ Engine *e; FOR_ALL_ENGINES(e) { /* Age the vehicle */ - if ((e->flags & ENGINE_AVAILABLE) && e->age != 0xFFFF) { + if ((e->flags & ENGINE_AVAILABLE) && e->age != MAX_DAY) { e->age++; CalcEngineReliability(e); }
--- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -732,8 +732,8 @@ case 0x3D: return GB(v->cargo.Count(), 8, 8); case 0x3E: return v->cargo.Source(); case 0x3F: return v->cargo.DaysInTransit(); - case 0x40: return v->age; - case 0x41: return GB(v->age, 8, 8); + 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 0x44: return Clamp(v->build_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;