(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine

This commit is contained in:
darkvater 2005-01-10 14:24:40 +00:00
parent 94e44d05a1
commit 54e82ebbef
4 changed files with 32 additions and 41 deletions

View File

@ -130,16 +130,14 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT)); DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
} break; } break;
case 6: /* rename */ case 6: { /* rename */
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; int sel_eng = WP(w,buildtrain_d).sel_engine;
ShowQueryString( if (sel_eng != -1) {
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), WP(w,buildtrain_d).rename_engine = sel_eng;
STR_A039_RENAME_AIRCRAFT_TYPE, ShowQueryString(GetCustomEngineName(sel_eng),
31, STR_A039_RENAME_AIRCRAFT_TYPE, 31, 160, w->window_class, w->window_number);
160, }
w->window_class, } break;
w->window_number);
break;
} }
break; break;

View File

@ -411,16 +411,14 @@ static void NewRoadVehWndProc(Window *w, WindowEvent *e)
DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE)); DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
} break; } break;
case 6: /* rename */ case 6: { /* rename */
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; int sel_eng = WP(w,buildtrain_d).sel_engine;
ShowQueryString( if (sel_eng != -1) {
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), WP(w,buildtrain_d).rename_engine = sel_eng;
STR_9036_RENAME_ROAD_VEHICLE_TYPE, ShowQueryString(GetCustomEngineName(sel_eng),
31, STR_9036_RENAME_ROAD_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number);
160, }
w->window_class, } break;
w->window_number);
break;
} }
break; break;

View File

@ -402,17 +402,14 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP)); DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
} break; } break;
case 6: /* rename */ case 6: { /* rename */
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; int sel_eng = WP(w,buildtrain_d).sel_engine;
ShowQueryString( if (sel_eng != -1) {
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), WP(w,buildtrain_d).rename_engine = sel_eng;
STR_9838_RENAME_SHIP_TYPE, ShowQueryString(GetCustomEngineName(sel_eng),
31, STR_9838_RENAME_SHIP_TYPE, 31, 160, w->window_class, w->window_number);
160, }
w->window_class, } break;
w->window_number);
break;
} }
break; break;

View File

@ -200,16 +200,14 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
if (sel_eng != -1) if (sel_eng != -1)
DoCommandP(w->window_number, sel_eng, 0, (RailVehInfo(sel_eng)->flags & RVI_WAGON) ? CcBuildWagon : CcBuildLoco, CMD_BUILD_RAIL_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE)); DoCommandP(w->window_number, sel_eng, 0, (RailVehInfo(sel_eng)->flags & RVI_WAGON) ? CcBuildWagon : CcBuildLoco, CMD_BUILD_RAIL_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
} break; } break;
case 6: case 6: { /* rename */
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; int sel_eng = WP(w,buildtrain_d).sel_engine;
ShowQueryString( if (sel_eng != -1) {
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), WP(w,buildtrain_d).rename_engine = sel_eng;
STR_886A_RENAME_TRAIN_VEHICLE_TYPE, ShowQueryString(GetCustomEngineName(sel_eng),
31, STR_886A_RENAME_TRAIN_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number);
160, }
w->window_class, } break;
w->window_number);
break;
} }
} break; } break;