Changeset - r968:cc00c557f4bf
[Not reviewed]
master
0 4 0
darkvater - 20 years ago 2005-01-10 14:24:40
darkvater@openttd.org
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
4 files changed with 32 insertions and 41 deletions:
0 comments (0 inline, 0 general)
aircraft_gui.c
Show inline comments
 
@@ -127,22 +127,20 @@ static void NewAircraftWndProc(Window *w
 
		case 5: { /* build */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1)
 
				DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
 
		} break;
 

	
 
		case 6:	/* rename */
 
			WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine;
 
			ShowQueryString(
 
				GetCustomEngineName(WP(w,buildtrain_d).sel_engine),
 
				STR_A039_RENAME_AIRCRAFT_TYPE,
 
				31,
 
				160,
 
				w->window_class,
 
				w->window_number);
 
			break;
 
		case 6:	{ /* rename */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1) {
 
				WP(w,buildtrain_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_A039_RENAME_AIRCRAFT_TYPE, 31, 160, w->window_class, w->window_number);
 
			}
 
		} break;
 
		}
 
		break;
 

	
 
	case WE_4:
 
		if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) {
 
			DeleteWindow(w);
roadveh_gui.c
Show inline comments
 
@@ -408,22 +408,20 @@ static void NewRoadVehWndProc(Window *w,
 
		case 5: { /* build */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1)
 
				DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
 
		} break;
 

	
 
		case 6: /* rename */
 
			WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine;
 
			ShowQueryString(
 
				GetCustomEngineName(WP(w,buildtrain_d).sel_engine),
 
				STR_9036_RENAME_ROAD_VEHICLE_TYPE,
 
				31,
 
				160,
 
				w->window_class,
 
				w->window_number);
 
			break;
 
		case 6: { /* rename */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1) {
 
				WP(w,buildtrain_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_9036_RENAME_ROAD_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number);
 
			}
 
		}	break;
 
		}
 
		break;
 

	
 
	case WE_4:
 
		if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) {
 
			DeleteWindow(w);
ship_gui.c
Show inline comments
 
@@ -399,23 +399,20 @@ static void NewShipWndProc(Window *w, Wi
 
		case 5: { /* build */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1)
 
				DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
 
		} break;
 

	
 
		case 6:	/* rename */
 
			WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine;
 
			ShowQueryString(
 
				GetCustomEngineName(WP(w,buildtrain_d).sel_engine),
 
				STR_9838_RENAME_SHIP_TYPE,
 
				31,
 
				160,
 
				w->window_class,
 
				w->window_number);
 
			break;
 

	
 
		case 6:	{ /* rename */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1) {
 
				WP(w,buildtrain_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_9838_RENAME_SHIP_TYPE, 31, 160, w->window_class, w->window_number);
 
			}
 
		}	break;
 
		}
 
		break;
 

	
 
	case WE_4:
 
		if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) {
 
			DeleteWindow(w);
train_gui.c
Show inline comments
 
@@ -197,22 +197,20 @@ static void NewRailVehicleWndProc(Window
 
		case 5: {
 
			int sel_eng;
 
			sel_eng = WP(w,buildtrain_d).sel_engine;
 
			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));
 
		}	break;
 
		case 6:
 
			WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine;
 
			ShowQueryString(
 
				GetCustomEngineName(WP(w,buildtrain_d).sel_engine),
 
				STR_886A_RENAME_TRAIN_VEHICLE_TYPE,
 
				31,
 
				160,
 
				w->window_class,
 
				w->window_number);
 
			break;
 
		case 6: { /* rename */
 
			int sel_eng = WP(w,buildtrain_d).sel_engine;
 
			if (sel_eng != -1) {
 
				WP(w,buildtrain_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_886A_RENAME_TRAIN_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number);
 
			}
 
		} break;
 
		}
 
	} break;
 

	
 
	case WE_4:
 
		if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) {
 
			DeleteWindow(w);
0 comments (0 inline, 0 general)