summaryrefslogtreecommitdiff
path: root/vehicle_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-12-29 12:42:59 +0000
committertron <tron@openttd.org>2005-12-29 12:42:59 +0000
commit246c126d250171bd69f66080dbc25fafef6a46d2 (patch)
tree471052da802f2cc20f631ca0291f7337c78cd45d /vehicle_gui.c
parent1ffc70079787954dda1182de89eca25f36837490 (diff)
downloadopenttd-246c126d250171bd69f66080dbc25fafef6a46d2.tar.xz
(svn r3353) Simplify the automatic length adjustment algorithm for replacing trains: Use the length of the train before the replacement as reference length
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index fbfd7d698..c8e184c13 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -747,10 +747,10 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
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 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
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];