summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-31 09:40:10 +0000
committerbjarni <bjarni@openttd.org>2006-08-31 09:40:10 +0000
commitc3900434b53968529c5a48382ecc5339fe644c53 (patch)
tree944de40848bd7a02b7a3aae297bfaf3d7c70dd61
parentad076c8f9e953a7268c769d322c47333d9f2cfd3 (diff)
downloadopenttd-c3900434b53968529c5a48382ecc5339fe644c53.tar.xz
(svn r6261) -Fix r6246: fixed sprite related crash related to other player's vehicle list windows (spotted by Darkvater)
-rw-r--r--vehicle_gui.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index b79ae41d6..fede02861 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1251,6 +1251,8 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
}
SetDParam(0, w->vscroll.count);
w->widget[1].unkA = STR_VEH_WITH_SHARED_ORDERS_LIST;
+
+ if (owner != _local_player) break; // only set up buttons for local player
w->widget[10].unkA = STR_EMPTY;
SETBIT(w->disabled_state, 10);
@@ -1268,14 +1270,6 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
- if (vl->list_length == 0) SETBIT(w->disabled_state, 9);
- if (vehicle_type == VEH_Aircraft) {
- w->widget[9].unkA = STR_SEND_TO_HANGARS;
- w->widget[9].tooltips = STR_SEND_TO_HANGARS_TIP;
- } else {
- w->widget[9].unkA = STR_SEND_TO_DEPOTS;
- w->widget[9].tooltips = STR_SEND_TO_DEPOTS_TIP;
- }
switch (vehicle_type) {
case VEH_Train: w->widget[1].unkA = STR_881B_TRAINS; break;
@@ -1284,6 +1278,16 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
case VEH_Aircraft: w->widget[1].unkA = STR_A009_AIRCRAFT; break;
default: NOT_REACHED(); break;
}
+
+ if (owner != _local_player) break; // only set up buttons for local player
+ if (vl->list_length == 0) SETBIT(w->disabled_state, 9);
+ if (vehicle_type == VEH_Aircraft) {
+ w->widget[9].unkA = STR_SEND_TO_HANGARS;
+ w->widget[9].tooltips = STR_SEND_TO_HANGARS_TIP;
+ } else {
+ w->widget[9].unkA = STR_SEND_TO_DEPOTS;
+ w->widget[9].tooltips = STR_SEND_TO_DEPOTS_TIP;
+ }
break;
case VLW_STATION_LIST: