diff options
author | frosch <frosch@openttd.org> | 2008-02-08 15:34:54 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-02-08 15:34:54 +0000 |
commit | 2173b031442a4e3a07b51d8f48dcace787e990bd (patch) | |
tree | 372567c03194b5209f73531f5af09ed2d6684246 | |
parent | bf15bc9c57ab31172cbddfb91d952b715ea6d2a3 (diff) | |
download | openttd-2173b031442a4e3a07b51d8f48dcace787e990bd.tar.xz |
(svn r12084) -Fix: 'Early retirement'-properties are signed.
-rw-r--r-- | src/engine.cpp | 5 | ||||
-rw-r--r-- | src/engine.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index c6b776667..d1475602d 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -91,8 +91,9 @@ static void CalcEngineReliability(Engine *e) /* Check for early retirement */ if (e->player_avail != 0 && !_patches.never_expire_vehicles) { - uint retire_early = EngInfo(e - _engines)->retire_early; - if (retire_early > 0 && age >= e->duration_phase_1 + e->duration_phase_2 - retire_early * 12) { + int retire_early = EngInfo(e - _engines)->retire_early; + uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12); + if (retire_early != 0 && age >= retire_early_max_age) { /* Early retirement is enabled and we're past the date... */ e->player_avail = 0; AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); diff --git a/src/engine.h b/src/engine.h index 66eb97b17..67ddf9996 100644 --- a/src/engine.h +++ b/src/engine.h @@ -110,7 +110,7 @@ struct EngineInfo { byte refit_cost; byte misc_flags; byte callbackmask; - byte retire_early; ///< Number of years early to retire vehicle + int8 retire_early; ///< Number of years early to retire vehicle StringID string_id; ///< Default name of engine }; |