(svn r3353) Simplify the automatic length adjustment algorithm for replacing trains: Use the length of the train before the replacement as reference length

This commit is contained in:
tron
2005-12-29 12:42:59 +00:00
parent 901068fd6e
commit ed4b89ee36
24 changed files with 22 additions and 83 deletions

View File

@@ -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];