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
commita00571a1d7bbf141812f62cea5a2ef2fcbf0e9b9 (patch)
treefaf9ecb2ce10ec8d713f3f7628cd1265b491aacd
parentcf5dd1521368c5f981deb05144a57c6ccf9eadad (diff)
downloadopenttd-a00571a1d7bbf141812f62cea5a2ef2fcbf0e9b9.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: {