diff options
author | peter1138 <peter1138@openttd.org> | 2007-05-10 23:10:23 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-05-10 23:10:23 +0000 |
commit | c9018d3e7ca8265bf1cb3d4dcdf4737f3e65bd6f (patch) | |
tree | a30307b030b6015740856c49fa80fa650b404868 /src/engine.cpp | |
parent | 3cc31aae86854f41216da507de667e61df73b295 (diff) | |
download | openttd-c9018d3e7ca8265bf1cb3d4dcdf4737f3e65bd6f.tar.xz |
(svn r9825) -Codechange: [NewGRF] Add support for early vehicle retirement.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 04f30689a..e4d1e6e8d 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -70,6 +70,16 @@ static void CalcEngineReliability(Engine *e) { uint age = e->age; + /* 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) { + /* Early retirement is enabled and we're past the date... */ + e->player_avail = 0; + AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); + } + } + if (age < e->duration_phase_1) { uint start = e->reliability_start; e->reliability = age * (e->reliability_max - start) / e->duration_phase_1 + start; |