diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 22c69a5215..e508f95c06 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1326,7 +1326,7 @@ struct BuildVehicleWindow : Window { if (!this->listview_mode) { /* Query for cost and refitted capacity */ - auto [ret, veh_id, refit_capacity, refit_mail, cargo_capacities] = Command::Do(DC_QUERY_COST, this->window_number, this->sel_engine, true, cargo, INVALID_CLIENT_ID); + auto [ret, veh_id, refit_capacity, refit_mail, cargo_capacities] = Command::Do(DC_QUERY_COST, TileIndex(this->window_number), this->sel_engine, true, cargo, INVALID_CLIENT_ID); if (ret.Succeeded()) { this->te.cost = ret.GetCost() - e->GetCost(); this->te.capacity = refit_capacity; @@ -1501,7 +1501,7 @@ struct BuildVehicleWindow : Window { this->eng_list.clear(); - const Station *st = this->listview_mode ? nullptr : Station::GetByTile(this->window_number); + const Station *st = this->listview_mode ? nullptr : Station::GetByTile(TileIndex(this->window_number)); /* Make list of all available planes. * Also check to see if the previously selected plane is still available, @@ -1614,9 +1614,9 @@ struct BuildVehicleWindow : Window { CargoID cargo = this->cargo_filter_criteria; if (cargo == CargoFilterCriteria::CF_ANY || cargo == CargoFilterCriteria::CF_ENGINES || cargo == CargoFilterCriteria::CF_NONE) cargo = INVALID_CARGO; if (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) { - Command::Post(GetCmdBuildVehMsg(this->vehicle_type), CcBuildWagon, this->window_number, sel_eng, true, cargo, INVALID_CLIENT_ID); + Command::Post(GetCmdBuildVehMsg(this->vehicle_type), CcBuildWagon, TileIndex(this->window_number), sel_eng, true, cargo, INVALID_CLIENT_ID); } else { - Command::Post(GetCmdBuildVehMsg(this->vehicle_type), CcBuildPrimaryVehicle, this->window_number, sel_eng, true, cargo, INVALID_CLIENT_ID); + Command::Post(GetCmdBuildVehMsg(this->vehicle_type), CcBuildPrimaryVehicle, TileIndex(this->window_number), sel_eng, true, cargo, INVALID_CLIENT_ID); } /* Update last used variant in hierarchy and refresh if necessary. */ diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 21587aeac6..71823f3aae 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -300,7 +300,7 @@ struct DepotWindow : Window { { CloseWindowById(WC_BUILD_VEHICLE, this->window_number); CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false); - OrderBackup::Reset(this->window_number); + OrderBackup::Reset(TileIndex(this->window_number)); this->Window::Close(); } @@ -715,7 +715,7 @@ struct DepotWindow : Window { if (this->generate_list) { /* Generate the vehicle list * It's ok to use the wagon pointers for non-trains as they will be ignored */ - BuildDepotVehicleList(this->type, this->window_number, &this->vehicle_list, &this->wagon_list); + BuildDepotVehicleList(this->type, TileIndex(this->window_number), &this->vehicle_list, &this->wagon_list); this->generate_list = false; DepotSortList(&this->vehicle_list); @@ -756,7 +756,7 @@ struct DepotWindow : Window { } /* Setup disabled buttons. */ - TileIndex tile = this->window_number; + TileIndex tile(this->window_number); this->SetWidgetsDisabledState(!IsTileOwner(tile, _local_company), WID_D_STOP_ALL, WID_D_START_ALL, @@ -780,7 +780,7 @@ struct DepotWindow : Window { case WID_D_BUILD: // Build vehicle ResetObjectToPlace(); - ShowBuildVehicleWindow(this->window_number, this->type); + ShowBuildVehicleWindow(TileIndex(this->window_number), this->type); break; case WID_D_CLONE: // Clone button @@ -801,22 +801,22 @@ struct DepotWindow : Window { case WID_D_LOCATION: if (_ctrl_pressed) { - ShowExtraViewportWindow(this->window_number); + ShowExtraViewportWindow(TileIndex(this->window_number)); } else { - ScrollMainWindowToTile(this->window_number); + ScrollMainWindowToTile(TileIndex(this->window_number)); } break; case WID_D_RENAME: // Rename button SetDParam(0, this->type); - SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index); + SetDParam(1, Depot::GetByTile(TileIndex(this->window_number))->index); ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case WID_D_STOP_ALL: case WID_D_START_ALL: { VehicleListIdentifier vli(VL_DEPOT_LIST, this->type, this->owner); - Command::Post(this->window_number, widget == WID_D_START_ALL, false, vli); + Command::Post(TileIndex(this->window_number), widget == WID_D_START_ALL, false, vli); break; } @@ -835,11 +835,11 @@ struct DepotWindow : Window { break; case WID_D_VEHICLE_LIST: - ShowVehicleListWindow(GetTileOwner(this->window_number), this->type, (TileIndex)this->window_number); + ShowVehicleListWindow(GetTileOwner(this->window_number), this->type, TileIndex(this->window_number)); break; case WID_D_AUTOREPLACE: - Command::Post(this->window_number, this->type); + Command::Post(TileIndex(this->window_number), this->type); break; } @@ -916,10 +916,10 @@ struct DepotWindow : Window { { if (_ctrl_pressed) { /* Share-clone, do not open new viewport, and keep tool active */ - Command::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true); + Command::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, TileIndex(this->window_number), v->index, true); } else { /* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to change things on new vehicle) */ - if (Command::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, CcCloneVehicle, this->window_number, v->index, false)) { + if (Command::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, CcCloneVehicle, TileIndex(this->window_number), v->index, false)) { ResetObjectToPlace(); } } @@ -1150,7 +1150,7 @@ static void DepotSellAllConfirmationCallback(Window *win, bool confirmed) { if (confirmed) { DepotWindow *w = (DepotWindow*)win; - TileIndex tile = w->window_number; + TileIndex tile(w->window_number); VehicleType vehtype = w->type; Command::Post(tile, vehtype); }