|
@@ -170,13 +170,13 @@ void CcCloneTrain(bool success, uint til
|
|
|
|
|
|
v = GetVehicle(_new_train_id);
|
|
|
ShowTrainViewWindow(v);
|
|
|
}
|
|
|
|
|
|
static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
|
|
|
int *selected_id, byte railtype, byte show_max, bool is_engine)
|
|
|
EngineID* selected_id, byte railtype, byte show_max, bool is_engine)
|
|
|
{
|
|
|
EngineID i;
|
|
|
|
|
|
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
|
|
|
const Engine *e = GetEngine(i);
|
|
|
const RailVehicleInfo *rvi = RailVehInfo(i);
|
|
@@ -226,25 +226,25 @@ static void NewRailVehicleWndProc(Window
|
|
|
{
|
|
|
byte railtype = WP(w,buildtrain_d).railtype;
|
|
|
int sel = WP(w,buildtrain_d).sel_index;
|
|
|
int pos = w->vscroll.pos;
|
|
|
int x = 1;
|
|
|
int y = 15;
|
|
|
int selected_id = -1;
|
|
|
EngineID selected_id = INVALID_ENGINE;
|
|
|
|
|
|
/* Ensure that custom engines which substituted wagons
|
|
|
* are sorted correctly.
|
|
|
* XXX - DO NOT EVER DO THIS EVER AGAIN! GRRR hacking in wagons as
|
|
|
* engines to get more types.. Stays here until we have our own format
|
|
|
* then it is exit!!! */
|
|
|
engine_drawing_loop(&x, &y, &pos, &sel, &selected_id, railtype, w->vscroll.cap, true); // True engines
|
|
|
engine_drawing_loop(&x, &y, &pos, &sel, &selected_id, railtype, w->vscroll.cap, false); // Feeble wagons
|
|
|
|
|
|
WP(w,buildtrain_d).sel_engine = selected_id;
|
|
|
|
|
|
if (selected_id != -1) {
|
|
|
if (selected_id != INVALID_ENGINE) {
|
|
|
const RailVehicleInfo *rvi = RailVehInfo(selected_id);
|
|
|
|
|
|
if (!(rvi->flags & RVI_WAGON)) {
|
|
|
/* it's an engine */
|
|
|
DrawTrainEnginePurchaseInfo(2, w->widget[4].top + 1,selected_id);
|
|
|
} else {
|
|
@@ -262,20 +262,19 @@ static void NewRailVehicleWndProc(Window
|
|
|
if (i < w->vscroll.cap) {
|
|
|
WP(w,buildtrain_d).sel_index = i + w->vscroll.pos;
|
|
|
SetWindowDirty(w);
|
|
|
}
|
|
|
} break;
|
|
|
case 5: {
|
|
|
int sel_eng;
|
|
|
sel_eng = WP(w,buildtrain_d).sel_engine;
|
|
|
if (sel_eng != -1)
|
|
|
EngineID sel_eng = WP(w,buildtrain_d).sel_engine;
|
|
|
if (sel_eng != INVALID_ENGINE)
|
|
|
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: { /* rename */
|
|
|
int sel_eng = WP(w,buildtrain_d).sel_engine;
|
|
|
if (sel_eng != -1) {
|
|
|
EngineID sel_eng = WP(w,buildtrain_d).sel_engine;
|
|
|
if (sel_eng != INVALID_ENGINE) {
|
|
|
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;
|
|
|
}
|