vehicle_gui.c
changeset 2805 b6098e7ca457
parent 2753 15012faaa68a
child 2811 a2f26f7361e3
--- a/vehicle_gui.c	Wed Dec 28 22:29:59 2005 +0000
+++ b/vehicle_gui.c	Thu Dec 29 12:42:59 2005 +0000
@@ -747,10 +747,10 @@
 		STR_019E_SHIP,
 		STR_019D_AIRCRAFT
 	};
-	const Player *p = GetPlayer(_local_player);
 
 	switch (e->event) {
 		case WE_PAINT: {
+				const Player *p = GetPlayer(_local_player);
 				int pos = w->vscroll.pos;
 				EngineID selected_id[2] = { INVALID_ENGINE, INVALID_ENGINE };
 				int x = 1;
@@ -934,7 +934,7 @@
 					break;
 				}
 				case 17: { /* toggle renew_keep_length */
-					DoCommandP(0, 5, p->renew_keep_length ? 0 : 1, NULL, CMD_REPLACE_VEHICLE);
+					DoCommandP(0, 5, GetPlayer(_local_player)->renew_keep_length ? 0 : 1, NULL, CMD_REPLACE_VEHICLE);
 				} break;
 				case 4: { /* Start replacing */
 					EngineID veh_from = WP(w, replaceveh_d).sel_engine[0];