summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-02-01 09:47:18 +0000
committercelestar <celestar@openttd.org>2005-02-01 09:47:18 +0000
commitecbe6e2be43520e86b4bc7c88ccd24200b4b2fc9 (patch)
treefaf9ecb2ce10ec8d713f3f7628cd1265b491aacd
parenteb21ec63a3c88700f64c6d83c6f03e978c397d35 (diff)
downloadopenttd-ecbe6e2be43520e86b4bc7c88ccd24200b4b2fc9.tar.xz
(svn r1760) -Fix: [ 1113399 ] Game no longer crashes when right-clicking a disabled Full Load button
-rw-r--r--order_gui.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/order_gui.c b/order_gui.c
index 9cba6e291..df4db8f19 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -458,11 +458,12 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
case WE_RCLICK: {
Vehicle *v = GetVehicle(w->window_number);
- if (e->click.widget != 8) break;
- if (GetVehicleOrder(v, OrderGetSel(w))->type == OT_GOTO_DEPOT)
- GuiShowTooltips(STR_SERVICE_HINT);
- else
+ int sel = OrderGetSel(w);
+ if (e->click.widget != 8) break;
+ if (sel == v->num_orders || GetVehicleOrder(v, sel)->type != OT_GOTO_DEPOT)
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER);
+ else
+ GuiShowTooltips(STR_SERVICE_HINT);
} break;
case WE_4: {