diff options
author | darkvater <darkvater@openttd.org> | 2004-09-04 13:06:09 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-09-04 13:06:09 +0000 |
commit | 85628544eeac566a70bf3f218bc078c096c65c50 (patch) | |
tree | 4c8dfe7c2804e783d4308382ce2f15c7f96bd43f /aircraft_gui.c | |
parent | b4cf633f66491956dcb94e7fa39e687f9341b7e1 (diff) | |
download | openttd-85628544eeac566a70bf3f218bc078c096c65c50.tar.xz |
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
Diffstat (limited to 'aircraft_gui.c')
-rw-r--r-- | aircraft_gui.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 7a13ec15a..450c612cd 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -309,6 +309,9 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) switch(e->event) { case WE_PAINT: w->disabled_state = v->owner == _local_player ? 0 : (1 << 2); + if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled + w->disabled_state |= (1 << 5) | (1 << 6); + SET_DPARAM16(0, v->string_id); SET_DPARAM16(1, v->unitnumber); DrawWindowWidgets(w); @@ -356,7 +359,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) { SET_DPARAM16(0, v->service_interval); SET_DPARAM16(1, v->date_of_last_service); - DrawString(13, 103, STR_883C_SERVICING_INTERVAL_DAYS, 0); + DrawString(13, 103, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0); } DrawAircraftImage(v, 3, 57, INVALID_VEHICLE); @@ -403,14 +406,19 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) break; case 5: /* increase int */ - mod = 10; + mod = _ctrl_pressed? 5 : 10; goto change_int; case 6: /* decrease int */ - mod = -10; + mod = _ctrl_pressed?- 5 : -10; change_int: mod += v->service_interval; - if (!IS_INT_INSIDE(mod, 30, 800+1)) + + /* %-based service interval max 5%-90% + day-based service interval max 30-800 days */ + mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1); + if (mod == v->service_interval) return; + DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_AIRCRAFT_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); break; |