mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Pass WindowDesc by reference instead of pointer. (#12771)
WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.pull/12773/head
parent
18bce69623
commit
4cf6d1dd79
|
@ -97,7 +97,7 @@ struct AIConfigWindow : public Window {
|
|||
int line_height; ///< Height of a single AI-name line.
|
||||
Scrollbar *vscroll; ///< Cache of the vertical scrollbar.
|
||||
|
||||
AIConfigWindow() : Window(&_ai_config_desc)
|
||||
AIConfigWindow() : Window(_ai_config_desc)
|
||||
{
|
||||
this->InitNested(WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
|
||||
this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
|
||||
|
|
|
@ -83,7 +83,7 @@ static void PlaceAirport(TileIndex tile)
|
|||
struct BuildAirToolbarWindow : Window {
|
||||
int last_user_action; // Last started user action.
|
||||
|
||||
BuildAirToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
BuildAirToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
this->OnInvalidateData();
|
||||
|
@ -228,7 +228,7 @@ Window *ShowBuildAirToolbar()
|
|||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
||||
return AllocateWindowDescFront<BuildAirToolbarWindow>(_air_toolbar_desc, TRANSPORT_AIR);
|
||||
}
|
||||
|
||||
class BuildAirportWindow : public PickerWindowBase {
|
||||
|
@ -249,7 +249,7 @@ class BuildAirportWindow : public PickerWindowBase {
|
|||
}
|
||||
|
||||
public:
|
||||
BuildAirportWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildAirportWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -626,7 +626,7 @@ static WindowDesc _build_airport_desc(
|
|||
|
||||
static void ShowBuildAirportPicker(Window *parent)
|
||||
{
|
||||
new BuildAirportWindow(&_build_airport_desc, parent);
|
||||
new BuildAirportWindow(_build_airport_desc, parent);
|
||||
}
|
||||
|
||||
void InitializeAirportGui()
|
||||
|
|
|
@ -263,7 +263,7 @@ class ReplaceVehicleWindow : public Window {
|
|||
}
|
||||
|
||||
public:
|
||||
ReplaceVehicleWindow(WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
|
||||
ReplaceVehicleWindow(WindowDesc &desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
|
||||
{
|
||||
this->sel_railtype = INVALID_RAILTYPE;
|
||||
this->sel_roadtype = INVALID_ROADTYPE;
|
||||
|
@ -889,11 +889,9 @@ static WindowDesc _replace_vehicle_desc(
|
|||
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
||||
{
|
||||
CloseWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
||||
WindowDesc *desc;
|
||||
switch (vehicletype) {
|
||||
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
|
||||
case VEH_ROAD: desc = &_replace_road_vehicle_desc; break;
|
||||
default: desc = &_replace_vehicle_desc; break;
|
||||
case VEH_TRAIN: new ReplaceVehicleWindow(_replace_rail_vehicle_desc, vehicletype, id_g); break;
|
||||
case VEH_ROAD: new ReplaceVehicleWindow(_replace_road_vehicle_desc, vehicletype, id_g); break;
|
||||
default: new ReplaceVehicleWindow(_replace_vehicle_desc, vehicletype, id_g); break;
|
||||
}
|
||||
new ReplaceVehicleWindow(desc, vehicletype, id_g);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static WindowDesc _background_desc(
|
|||
/** The background for the game. */
|
||||
class BootstrapBackground : public Window {
|
||||
public:
|
||||
BootstrapBackground() : Window(&_background_desc)
|
||||
BootstrapBackground() : Window(_background_desc)
|
||||
{
|
||||
this->InitNested(0);
|
||||
CLRBITS(this->flags, WF_WHITE_BORDER);
|
||||
|
@ -86,7 +86,7 @@ static WindowDesc _bootstrap_errmsg_desc(
|
|||
/** The window for a failed bootstrap. */
|
||||
class BootstrapErrorWindow : public Window {
|
||||
public:
|
||||
BootstrapErrorWindow() : Window(&_bootstrap_errmsg_desc)
|
||||
BootstrapErrorWindow() : Window(_bootstrap_errmsg_desc)
|
||||
{
|
||||
this->InitNested(1);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static WindowDesc _bootstrap_download_status_window_desc(
|
|||
struct BootstrapContentDownloadStatusWindow : public BaseNetworkContentDownloadStatusWindow {
|
||||
public:
|
||||
/** Simple call the constructor of the superclass. */
|
||||
BootstrapContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(&_bootstrap_download_status_window_desc)
|
||||
BootstrapContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(_bootstrap_download_status_window_desc)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ class BootstrapAskForDownloadWindow : public Window, ContentCallback {
|
|||
|
||||
public:
|
||||
/** Start listening to the content client events. */
|
||||
BootstrapAskForDownloadWindow() : Window(&_bootstrap_query_desc)
|
||||
BootstrapAskForDownloadWindow() : Window(_bootstrap_query_desc)
|
||||
{
|
||||
this->InitNested(WN_CONFIRM_POPUP_QUERY_BOOTSTRAP);
|
||||
_network_content_client.AddCallback(this);
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
BuildBridgeWindow(WindowDesc *desc, TileIndex start, TileIndex end, TransportType transport_type, uint8_t road_rail_type, GUIBridgeList &&bl) : Window(desc),
|
||||
BuildBridgeWindow(WindowDesc &desc, TileIndex start, TileIndex end, TransportType transport_type, uint8_t road_rail_type, GUIBridgeList &&bl) : Window(desc),
|
||||
start_tile(start),
|
||||
end_tile(end),
|
||||
transport_type(transport_type),
|
||||
|
@ -435,7 +435,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
|||
}
|
||||
|
||||
if (!bl.empty()) {
|
||||
new BuildBridgeWindow(&_build_bridge_desc, start, end, transport_type, road_rail_type, std::move(bl));
|
||||
new BuildBridgeWindow(_build_bridge_desc, start, end, transport_type, road_rail_type, std::move(bl));
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
|
||||
}
|
||||
|
|
|
@ -1201,7 +1201,7 @@ struct BuildVehicleWindow : Window {
|
|||
}
|
||||
}
|
||||
|
||||
BuildVehicleWindow(WindowDesc *desc, TileIndex tile, VehicleType type) : Window(desc), vehicle_editbox(MAX_LENGTH_VEHICLE_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_VEHICLE_NAME_CHARS)
|
||||
BuildVehicleWindow(WindowDesc &desc, TileIndex tile, VehicleType type) : Window(desc), vehicle_editbox(MAX_LENGTH_VEHICLE_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_VEHICLE_NAME_CHARS)
|
||||
{
|
||||
this->vehicle_type = type;
|
||||
this->listview_mode = tile == INVALID_TILE;
|
||||
|
@ -1938,5 +1938,5 @@ void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
|
|||
|
||||
CloseWindowById(WC_BUILD_VEHICLE, num);
|
||||
|
||||
new BuildVehicleWindow(&_build_vehicle_desc, tile, type);
|
||||
new BuildVehicleWindow(_build_vehicle_desc, tile, type);
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ struct CheatWindow : Window {
|
|||
uint line_height;
|
||||
Dimension icon; ///< Dimension of company icon sprite
|
||||
|
||||
CheatWindow(WindowDesc *desc) : Window(desc)
|
||||
CheatWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested();
|
||||
}
|
||||
|
@ -436,5 +436,5 @@ static WindowDesc _cheats_desc(
|
|||
void ShowCheatWindow()
|
||||
{
|
||||
CloseWindowById(WC_CHEATS, 0);
|
||||
new CheatWindow(&_cheats_desc);
|
||||
new CheatWindow(_cheats_desc);
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ struct CompanyFinancesWindow : Window {
|
|||
static Money max_money; ///< The maximum amount of money a company has had this 'run'
|
||||
bool small; ///< Window is toggled to 'small'.
|
||||
|
||||
CompanyFinancesWindow(WindowDesc *desc, CompanyID company) : Window(desc)
|
||||
CompanyFinancesWindow(WindowDesc &desc, CompanyID company) : Window(desc)
|
||||
{
|
||||
this->small = false;
|
||||
this->CreateNestedTree();
|
||||
|
@ -548,7 +548,7 @@ void ShowCompanyFinances(CompanyID company)
|
|||
if (!Company::IsValidID(company)) return;
|
||||
if (BringWindowToFrontById(WC_FINANCES, company)) return;
|
||||
|
||||
new CompanyFinancesWindow(&_company_finances_desc, company);
|
||||
new CompanyFinancesWindow(_company_finances_desc, company);
|
||||
}
|
||||
|
||||
/* Association of liveries to livery classes */
|
||||
|
@ -670,7 +670,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
SelectCompanyLiveryWindow(WindowDesc *desc, CompanyID company, GroupID group) : Window(desc)
|
||||
SelectCompanyLiveryWindow(WindowDesc &desc, CompanyID company, GroupID group) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SCL_MATRIX_SCROLLBAR);
|
||||
|
@ -1089,7 +1089,7 @@ void ShowCompanyLiveryWindow(CompanyID company, GroupID group)
|
|||
{
|
||||
SelectCompanyLiveryWindow *w = (SelectCompanyLiveryWindow *)BringWindowToFrontById(WC_COMPANY_COLOUR, company);
|
||||
if (w == nullptr) {
|
||||
new SelectCompanyLiveryWindow(&_select_company_livery_desc, company, group);
|
||||
new SelectCompanyLiveryWindow(_select_company_livery_desc, company, group);
|
||||
} else if (group != INVALID_GROUP) {
|
||||
w->SetSelectedGroup(company, group);
|
||||
}
|
||||
|
@ -1349,7 +1349,7 @@ class SelectCompanyManagerFaceWindow : public Window
|
|||
}
|
||||
|
||||
public:
|
||||
SelectCompanyManagerFaceWindow(WindowDesc *desc, Window *parent) : Window(desc)
|
||||
SelectCompanyManagerFaceWindow(WindowDesc &desc, Window *parent) : Window(desc)
|
||||
{
|
||||
this->advanced = false;
|
||||
this->CreateNestedTree();
|
||||
|
@ -1720,7 +1720,7 @@ static void DoSelectCompanyManagerFace(Window *parent)
|
|||
if (!Company::IsValidID((CompanyID)parent->window_number)) return;
|
||||
|
||||
if (BringWindowToFrontById(WC_COMPANY_MANAGER_FACE, parent->window_number)) return;
|
||||
new SelectCompanyManagerFaceWindow(&_select_company_manager_face_desc, parent);
|
||||
new SelectCompanyManagerFaceWindow(_select_company_manager_face_desc, parent);
|
||||
}
|
||||
|
||||
static constexpr NWidgetPart _nested_company_infrastructure_widgets[] = {
|
||||
|
@ -1770,7 +1770,7 @@ struct CompanyInfrastructureWindow : Window
|
|||
|
||||
uint total_width; ///< String width of the total cost line.
|
||||
|
||||
CompanyInfrastructureWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
CompanyInfrastructureWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->UpdateRailRoadTypes();
|
||||
|
||||
|
@ -2094,7 +2094,7 @@ static WindowDesc _company_infrastructure_desc(
|
|||
static void ShowCompanyInfrastructure(CompanyID company)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
AllocateWindowDescFront<CompanyInfrastructureWindow>(&_company_infrastructure_desc, company);
|
||||
AllocateWindowDescFront<CompanyInfrastructureWindow>(_company_infrastructure_desc, company);
|
||||
}
|
||||
|
||||
static constexpr NWidgetPart _nested_company_widgets[] = {
|
||||
|
@ -2196,7 +2196,7 @@ struct CompanyWindow : Window
|
|||
CWP_RELOCATE_HIDE, ///< Hide the relocate HQ button.
|
||||
};
|
||||
|
||||
CompanyWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
CompanyWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
this->owner = (Owner)this->window_number;
|
||||
|
@ -2567,7 +2567,7 @@ void ShowCompany(CompanyID company)
|
|||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
|
||||
AllocateWindowDescFront<CompanyWindow>(&_company_desc, company);
|
||||
AllocateWindowDescFront<CompanyWindow>(_company_desc, company);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2581,7 +2581,7 @@ void DirtyCompanyInfrastructureWindows(CompanyID company)
|
|||
}
|
||||
|
||||
struct BuyCompanyWindow : Window {
|
||||
BuyCompanyWindow(WindowDesc *desc, WindowNumber window_number, bool hostile_takeover) : Window(desc), hostile_takeover(hostile_takeover)
|
||||
BuyCompanyWindow(WindowDesc &desc, WindowNumber window_number, bool hostile_takeover) : Window(desc), hostile_takeover(hostile_takeover)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
|
||||
|
@ -2702,6 +2702,6 @@ void ShowBuyCompanyDialog(CompanyID company, bool hostile_takeover)
|
|||
{
|
||||
auto window = BringWindowToFrontById(WC_BUY_COMPANY, company);
|
||||
if (window == nullptr) {
|
||||
new BuyCompanyWindow(&_buy_company_desc, company, hostile_takeover);
|
||||
new BuyCompanyWindow(_buy_company_desc, company, hostile_takeover);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ struct IConsoleWindow : Window
|
|||
int line_offset;
|
||||
int cursor_width;
|
||||
|
||||
IConsoleWindow() : Window(&_console_window_desc)
|
||||
IConsoleWindow() : Window(_console_window_desc)
|
||||
{
|
||||
_iconsole_mode = ICONSOLE_OPENED;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ struct SetDateWindow : Window {
|
|||
* @param max_year the maximum year (inclusive) to show in the year dropdown
|
||||
* @param callback the callback to call once a date has been selected
|
||||
*/
|
||||
SetDateWindow(WindowDesc *desc, WindowNumber window_number, Window *parent, TimerGameEconomy::Date initial_date, TimerGameEconomy::Year min_year, TimerGameEconomy::Year max_year, SetDateCallback *callback, void *callback_data) :
|
||||
SetDateWindow(WindowDesc &desc, WindowNumber window_number, Window *parent, TimerGameEconomy::Date initial_date, TimerGameEconomy::Year min_year, TimerGameEconomy::Year max_year, SetDateCallback *callback, void *callback_data) :
|
||||
Window(desc),
|
||||
callback(callback),
|
||||
callback_data(callback_data),
|
||||
|
@ -216,5 +216,5 @@ static WindowDesc _set_date_desc(
|
|||
void ShowSetDateWindow(Window *parent, int window_number, TimerGameEconomy::Date initial_date, TimerGameEconomy::Year min_year, TimerGameEconomy::Year max_year, SetDateCallback *callback, void *callback_data)
|
||||
{
|
||||
CloseWindowByClass(WC_SET_DATE);
|
||||
new SetDateWindow(&_set_date_desc, window_number, parent, initial_date, min_year, max_year, callback, callback_data);
|
||||
new SetDateWindow(_set_date_desc, window_number, parent, initial_date, min_year, max_year, callback, callback_data);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ struct DepotWindow : Window {
|
|||
Scrollbar *hscroll; ///< Only for trains.
|
||||
Scrollbar *vscroll;
|
||||
|
||||
DepotWindow(WindowDesc *desc, TileIndex tile, VehicleType type) : Window(desc)
|
||||
DepotWindow(WindowDesc &desc, TileIndex tile, VehicleType type) : Window(desc)
|
||||
{
|
||||
assert(IsCompanyBuildableVehicleType(type)); // ensure that we make the call with a valid type
|
||||
|
||||
|
@ -1142,16 +1142,13 @@ void ShowDepotWindow(TileIndex tile, VehicleType type)
|
|||
{
|
||||
if (BringWindowToFrontById(WC_VEHICLE_DEPOT, tile) != nullptr) return;
|
||||
|
||||
WindowDesc *desc;
|
||||
switch (type) {
|
||||
default: NOT_REACHED();
|
||||
case VEH_TRAIN: desc = &_train_depot_desc; break;
|
||||
case VEH_ROAD: desc = &_road_depot_desc; break;
|
||||
case VEH_SHIP: desc = &_ship_depot_desc; break;
|
||||
case VEH_AIRCRAFT: desc = &_aircraft_depot_desc; break;
|
||||
case VEH_TRAIN: new DepotWindow(_train_depot_desc, tile, type); break;
|
||||
case VEH_ROAD: new DepotWindow(_road_depot_desc, tile, type); break;
|
||||
case VEH_SHIP: new DepotWindow(_ship_depot_desc, tile, type); break;
|
||||
case VEH_AIRCRAFT: new DepotWindow(_aircraft_depot_desc, tile, type); break;
|
||||
}
|
||||
|
||||
new DepotWindow(desc, tile, type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -100,7 +100,7 @@ static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = n
|
|||
struct BuildDocksToolbarWindow : Window {
|
||||
DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar.
|
||||
|
||||
BuildDocksToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
BuildDocksToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->last_clicked_widget = WID_DT_INVALID;
|
||||
this->InitNested(window_number);
|
||||
|
@ -364,7 +364,7 @@ Window *ShowBuildDocksToolbar()
|
|||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
|
||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(_build_docks_toolbar_desc, TRANSPORT_WATER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,7 +402,7 @@ static WindowDesc _build_docks_scen_toolbar_desc(
|
|||
*/
|
||||
Window *ShowBuildDocksScenToolbar()
|
||||
{
|
||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
|
||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
|
||||
}
|
||||
|
||||
/** Widget numbers of the build-dock GUI. */
|
||||
|
@ -416,7 +416,7 @@ enum BuildDockStationWidgets {
|
|||
|
||||
struct BuildDocksStationWindow : public PickerWindowBase {
|
||||
public:
|
||||
BuildDocksStationWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildDocksStationWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(TRANSPORT_WATER);
|
||||
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||
|
@ -507,7 +507,7 @@ static WindowDesc _build_dock_station_desc(
|
|||
|
||||
static void ShowBuildDockStationPicker(Window *parent)
|
||||
{
|
||||
new BuildDocksStationWindow(&_build_dock_station_desc, parent);
|
||||
new BuildDocksStationWindow(_build_dock_station_desc, parent);
|
||||
}
|
||||
|
||||
struct BuildDocksDepotWindow : public PickerWindowBase {
|
||||
|
@ -522,7 +522,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
BuildDocksDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildDocksDepotWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(TRANSPORT_WATER);
|
||||
this->LowerWidget(WID_BDD_X + _ship_depot_direction);
|
||||
|
@ -603,7 +603,7 @@ static WindowDesc _build_docks_depot_desc(
|
|||
|
||||
static void ShowBuildDocksDepotPicker(Window *parent)
|
||||
{
|
||||
new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
|
||||
new BuildDocksDepotWindow(_build_docks_depot_desc, parent);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ struct DropdownWindow : Window {
|
|||
* @param persist Dropdown menu will persist.
|
||||
*/
|
||||
DropdownWindow(Window *parent, DropDownList &&list, int selected, WidgetID button, const Rect wi_rect, bool instant_close, Colours wi_colour, bool persist)
|
||||
: Window(&_dropdown_desc)
|
||||
: Window(_dropdown_desc)
|
||||
, parent_button(button)
|
||||
, wi_rect(wi_rect)
|
||||
, list(std::move(list))
|
||||
|
|
|
@ -70,7 +70,7 @@ static constexpr NWidgetPart _nested_engine_preview_widgets[] = {
|
|||
struct EnginePreviewWindow : Window {
|
||||
int vehicle_space; // The space to show the vehicle image
|
||||
|
||||
EnginePreviewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
EnginePreviewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
|
||||
|
@ -154,7 +154,7 @@ static WindowDesc _engine_preview_desc(
|
|||
|
||||
void ShowEnginePreviewWindow(EngineID engine)
|
||||
{
|
||||
AllocateWindowDescFront<EnginePreviewWindow>(&_engine_preview_desc, engine);
|
||||
AllocateWindowDescFront<EnginePreviewWindow>(_engine_preview_desc, engine);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,7 +175,7 @@ private:
|
|||
|
||||
public:
|
||||
ErrmsgWindow(const ErrorMessageData &data) :
|
||||
Window(data.HasFace() ? &_errmsg_face_desc : &_errmsg_desc),
|
||||
Window(data.HasFace() ? _errmsg_face_desc : _errmsg_desc),
|
||||
ErrorMessageData(data),
|
||||
display_timeout(std::chrono::seconds(3 * _settings_client.gui.errmsg_duration), [this]() {
|
||||
this->Close();
|
||||
|
|
|
@ -302,7 +302,7 @@ public:
|
|||
this->filename_editbox.text.Assign(GenerateDefaultSaveName());
|
||||
}
|
||||
|
||||
SaveLoadWindow(WindowDesc *desc, AbstractFileType abstract_filetype, SaveLoadOperation fop)
|
||||
SaveLoadWindow(WindowDesc &desc, AbstractFileType abstract_filetype, SaveLoadOperation fop)
|
||||
: Window(desc), filename_editbox(64), abstract_filetype(abstract_filetype), fop(fop), filter_editbox(EDITBOX_MAX_SIZE)
|
||||
{
|
||||
assert(this->fop == SLO_SAVE || this->fop == SLO_LOAD);
|
||||
|
@ -915,13 +915,10 @@ void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fo
|
|||
{
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
|
||||
WindowDesc *sld;
|
||||
if (fop == SLO_SAVE) {
|
||||
sld = &_save_dialog_desc;
|
||||
new SaveLoadWindow(_save_dialog_desc, abstract_filetype, fop);
|
||||
} else {
|
||||
/* Dialogue for loading a file. */
|
||||
sld = (abstract_filetype == FT_HEIGHTMAP) ? &_load_heightmap_dialog_desc : &_load_dialog_desc;
|
||||
new SaveLoadWindow((abstract_filetype == FT_HEIGHTMAP) ? _load_heightmap_dialog_desc : _load_dialog_desc, abstract_filetype, fop);
|
||||
}
|
||||
|
||||
new SaveLoadWindow(sld, abstract_filetype, fop);
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ struct FramerateWindow : Window {
|
|||
|
||||
static constexpr int MIN_ELEMENTS = 5; ///< smallest number of elements to display
|
||||
|
||||
FramerateWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
||||
FramerateWindow(WindowDesc &desc, WindowNumber number) : Window(desc)
|
||||
{
|
||||
this->InitNested(number);
|
||||
this->small = this->IsShaded();
|
||||
|
@ -755,7 +755,7 @@ struct FrametimeGraphWindow : Window {
|
|||
PerformanceElement element; ///< what element this window renders graph for
|
||||
Dimension graph_size; ///< size of the main graph area (excluding axis labels)
|
||||
|
||||
FrametimeGraphWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
||||
FrametimeGraphWindow(WindowDesc &desc, WindowNumber number) : Window(desc)
|
||||
{
|
||||
this->element = (PerformanceElement)number;
|
||||
this->horizontal_scale = 4;
|
||||
|
@ -1029,14 +1029,14 @@ static WindowDesc _frametime_graph_window_desc(
|
|||
/** Open the general framerate window */
|
||||
void ShowFramerateWindow()
|
||||
{
|
||||
AllocateWindowDescFront<FramerateWindow>(&_framerate_display_desc, 0);
|
||||
AllocateWindowDescFront<FramerateWindow>(_framerate_display_desc, 0);
|
||||
}
|
||||
|
||||
/** Open a graph window for a performance element */
|
||||
void ShowFrametimeGraphWindow(PerformanceElement elem)
|
||||
{
|
||||
if (elem < PFE_FIRST || elem >= PFE_MAX) return; // maybe warn?
|
||||
AllocateWindowDescFront<FrametimeGraphWindow>(&_frametime_graph_window_desc, elem, true);
|
||||
AllocateWindowDescFront<FrametimeGraphWindow>(_frametime_graph_window_desc, elem, true);
|
||||
}
|
||||
|
||||
/** Print performance statistics to game console */
|
||||
|
|
|
@ -96,7 +96,7 @@ struct GSConfigWindow : public Window {
|
|||
typedef std::vector<const ScriptConfigItem *> VisibleSettingsList; ///< typdef for a vector of script settings
|
||||
VisibleSettingsList visible_settings; ///< List of visible GS settings
|
||||
|
||||
GSConfigWindow() : Window(&_gs_config_desc),
|
||||
GSConfigWindow() : Window(_gs_config_desc),
|
||||
clicked_button(-1),
|
||||
clicked_dropdown(false),
|
||||
closing_dropdown(false)
|
||||
|
|
|
@ -391,7 +391,7 @@ struct GenerateLandscapeWindow : public Window {
|
|||
std::string name;
|
||||
GenerateLandscapeWindowMode mode;
|
||||
|
||||
GenerateLandscapeWindow(WindowDesc *desc, WindowNumber number = 0) : Window(desc)
|
||||
GenerateLandscapeWindow(WindowDesc &desc, WindowNumber number = 0) : Window(desc)
|
||||
{
|
||||
this->InitNested(number);
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode)
|
|||
if (!GetHeightmapDimensions(_file_to_saveload.detail_ftype, _file_to_saveload.name.c_str(), &x, &y)) return;
|
||||
}
|
||||
|
||||
WindowDesc *desc = (mode == GLWM_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc;
|
||||
WindowDesc &desc = (mode == GLWM_HEIGHTMAP) ? _heightmap_load_desc : _generate_landscape_desc;
|
||||
GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>(desc, mode, true);
|
||||
|
||||
if (mode == GLWM_HEIGHTMAP) {
|
||||
|
@ -1075,7 +1075,7 @@ struct CreateScenarioWindow : public Window
|
|||
{
|
||||
WidgetID widget_id;
|
||||
|
||||
CreateScenarioWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
CreateScenarioWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
this->LowerWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE);
|
||||
|
@ -1321,7 +1321,7 @@ static WindowDesc _create_scenario_desc(
|
|||
void ShowCreateScenario()
|
||||
{
|
||||
CloseWindowByClass(WC_GENERATE_LANDSCAPE);
|
||||
new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
|
||||
new CreateScenarioWindow(_create_scenario_desc, GLWM_SCENARIO);
|
||||
}
|
||||
|
||||
static constexpr NWidgetPart _nested_generate_progress_widgets[] = {
|
||||
|
@ -1381,7 +1381,7 @@ static void AbortGeneratingWorldCallback(Window *, bool confirmed)
|
|||
|
||||
struct GenerateProgressWindow : public Window {
|
||||
|
||||
GenerateProgressWindow() : Window(&_generate_progress_desc)
|
||||
GenerateProgressWindow() : Window(_generate_progress_desc)
|
||||
{
|
||||
this->InitNested();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ enum GoalColumn {
|
|||
struct GoalListWindow : public Window {
|
||||
Scrollbar *vscroll; ///< Reference to the scrollbar widget.
|
||||
|
||||
GoalListWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
GoalListWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_GOAL_SCROLLBAR);
|
||||
|
@ -317,7 +317,7 @@ void ShowGoalsList(CompanyID company)
|
|||
{
|
||||
if (!Company::IsValidID(company)) company = (CompanyID)INVALID_COMPANY;
|
||||
|
||||
AllocateWindowDescFront<GoalListWindow>(&_goals_list_desc, company);
|
||||
AllocateWindowDescFront<GoalListWindow>(_goals_list_desc, company);
|
||||
}
|
||||
|
||||
/** Ask a question about a goal. */
|
||||
|
@ -327,7 +327,7 @@ struct GoalQuestionWindow : public Window {
|
|||
int button[3]; ///< Buttons to display.
|
||||
TextColour colour; ///< Colour of the question text.
|
||||
|
||||
GoalQuestionWindow(WindowDesc *desc, WindowNumber window_number, TextColour colour, uint32_t button_mask, const std::string &question) : Window(desc), colour(colour)
|
||||
GoalQuestionWindow(WindowDesc &desc, WindowNumber window_number, TextColour colour, uint32_t button_mask, const std::string &question) : Window(desc), colour(colour)
|
||||
{
|
||||
this->question = question;
|
||||
|
||||
|
@ -482,5 +482,5 @@ static WindowDesc _goal_question_list_desc[] = {
|
|||
void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question)
|
||||
{
|
||||
assert(type < GQT_END);
|
||||
new GoalQuestionWindow(&_goal_question_list_desc[type], id, type == 3 ? TC_WHITE : TC_BLACK, button_mask, question);
|
||||
new GoalQuestionWindow(_goal_question_list_desc[type], id, type == 3 ? TC_WHITE : TC_BLACK, button_mask, question);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ static_assert(static_cast<int64_t>(INT64_MAX_IN_DOUBLE) < INT64_MAX);
|
|||
/****************/
|
||||
|
||||
struct GraphLegendWindow : Window {
|
||||
GraphLegendWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
GraphLegendWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
|
||||
|
@ -151,7 +151,7 @@ static WindowDesc _graph_legend_desc(
|
|||
|
||||
static void ShowGraphLegend()
|
||||
{
|
||||
AllocateWindowDescFront<GraphLegendWindow>(&_graph_legend_desc, 0);
|
||||
AllocateWindowDescFront<GraphLegendWindow>(_graph_legend_desc, 0);
|
||||
}
|
||||
|
||||
/** Contains the interval of a graph's data. */
|
||||
|
@ -493,7 +493,7 @@ protected:
|
|||
}
|
||||
|
||||
|
||||
BaseGraphWindow(WindowDesc *desc, StringID format_str_y_axis) :
|
||||
BaseGraphWindow(WindowDesc &desc, StringID format_str_y_axis) :
|
||||
Window(desc),
|
||||
format_str_y_axis(format_str_y_axis)
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ public:
|
|||
/********************/
|
||||
|
||||
struct OperatingProfitGraphWindow : BaseGraphWindow {
|
||||
OperatingProfitGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
OperatingProfitGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_CURRENCY_SHORT)
|
||||
{
|
||||
this->num_on_x_axis = GRAPH_NUM_MONTHS;
|
||||
|
@ -702,7 +702,7 @@ static WindowDesc _operating_profit_desc(
|
|||
|
||||
void ShowOperatingProfitGraph()
|
||||
{
|
||||
AllocateWindowDescFront<OperatingProfitGraphWindow>(&_operating_profit_desc, 0);
|
||||
AllocateWindowDescFront<OperatingProfitGraphWindow>(_operating_profit_desc, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -711,7 +711,7 @@ void ShowOperatingProfitGraph()
|
|||
/****************/
|
||||
|
||||
struct IncomeGraphWindow : BaseGraphWindow {
|
||||
IncomeGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
IncomeGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_CURRENCY_SHORT)
|
||||
{
|
||||
this->num_on_x_axis = GRAPH_NUM_MONTHS;
|
||||
|
@ -760,7 +760,7 @@ static WindowDesc _income_graph_desc(
|
|||
|
||||
void ShowIncomeGraph()
|
||||
{
|
||||
AllocateWindowDescFront<IncomeGraphWindow>(&_income_graph_desc, 0);
|
||||
AllocateWindowDescFront<IncomeGraphWindow>(_income_graph_desc, 0);
|
||||
}
|
||||
|
||||
/*******************/
|
||||
|
@ -768,7 +768,7 @@ void ShowIncomeGraph()
|
|||
/*******************/
|
||||
|
||||
struct DeliveredCargoGraphWindow : BaseGraphWindow {
|
||||
DeliveredCargoGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
DeliveredCargoGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_COMMA)
|
||||
{
|
||||
this->num_on_x_axis = GRAPH_NUM_MONTHS;
|
||||
|
@ -817,7 +817,7 @@ static WindowDesc _delivered_cargo_graph_desc(
|
|||
|
||||
void ShowDeliveredCargoGraph()
|
||||
{
|
||||
AllocateWindowDescFront<DeliveredCargoGraphWindow>(&_delivered_cargo_graph_desc, 0);
|
||||
AllocateWindowDescFront<DeliveredCargoGraphWindow>(_delivered_cargo_graph_desc, 0);
|
||||
}
|
||||
|
||||
/***********************/
|
||||
|
@ -825,7 +825,7 @@ void ShowDeliveredCargoGraph()
|
|||
/***********************/
|
||||
|
||||
struct PerformanceHistoryGraphWindow : BaseGraphWindow {
|
||||
PerformanceHistoryGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
PerformanceHistoryGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_COMMA)
|
||||
{
|
||||
this->num_on_x_axis = GRAPH_NUM_MONTHS;
|
||||
|
@ -881,7 +881,7 @@ static WindowDesc _performance_history_desc(
|
|||
|
||||
void ShowPerformanceHistoryGraph()
|
||||
{
|
||||
AllocateWindowDescFront<PerformanceHistoryGraphWindow>(&_performance_history_desc, 0);
|
||||
AllocateWindowDescFront<PerformanceHistoryGraphWindow>(_performance_history_desc, 0);
|
||||
}
|
||||
|
||||
/*****************/
|
||||
|
@ -889,7 +889,7 @@ void ShowPerformanceHistoryGraph()
|
|||
/*****************/
|
||||
|
||||
struct CompanyValueGraphWindow : BaseGraphWindow {
|
||||
CompanyValueGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
CompanyValueGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_CURRENCY_SHORT)
|
||||
{
|
||||
this->num_on_x_axis = GRAPH_NUM_MONTHS;
|
||||
|
@ -938,7 +938,7 @@ static WindowDesc _company_value_graph_desc(
|
|||
|
||||
void ShowCompanyValueGraph()
|
||||
{
|
||||
AllocateWindowDescFront<CompanyValueGraphWindow>(&_company_value_graph_desc, 0);
|
||||
AllocateWindowDescFront<CompanyValueGraphWindow>(_company_value_graph_desc, 0);
|
||||
}
|
||||
|
||||
/*****************/
|
||||
|
@ -950,7 +950,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
|
|||
Scrollbar *vscroll; ///< Cargo list scrollbar.
|
||||
uint legend_width; ///< Width of legend 'blob'.
|
||||
|
||||
PaymentRatesGraphWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
PaymentRatesGraphWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
BaseGraphWindow(desc, STR_JUST_CURRENCY_SHORT)
|
||||
{
|
||||
this->num_on_x_axis = 20;
|
||||
|
@ -1176,7 +1176,7 @@ static WindowDesc _cargo_payment_rates_desc(
|
|||
|
||||
void ShowCargoPaymentRates()
|
||||
{
|
||||
AllocateWindowDescFront<PaymentRatesGraphWindow>(&_cargo_payment_rates_desc, 0);
|
||||
AllocateWindowDescFront<PaymentRatesGraphWindow>(_cargo_payment_rates_desc, 0);
|
||||
}
|
||||
|
||||
/*****************************/
|
||||
|
@ -1187,7 +1187,7 @@ struct PerformanceRatingDetailWindow : Window {
|
|||
static CompanyID company;
|
||||
int timeout;
|
||||
|
||||
PerformanceRatingDetailWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
PerformanceRatingDetailWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->UpdateCompanyStats();
|
||||
|
||||
|
@ -1470,7 +1470,7 @@ static WindowDesc _performance_rating_detail_desc(
|
|||
|
||||
void ShowPerformanceRatingDetail()
|
||||
{
|
||||
AllocateWindowDescFront<PerformanceRatingDetailWindow>(&_performance_rating_detail_desc, 0);
|
||||
AllocateWindowDescFront<PerformanceRatingDetailWindow>(_performance_rating_detail_desc, 0);
|
||||
}
|
||||
|
||||
void InitializeGraphGui()
|
||||
|
|
|
@ -388,7 +388,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
VehicleGroupWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
|
||||
VehicleGroupWindow(WindowDesc &desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -1170,10 +1170,10 @@ void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type, GroupID group
|
|||
const WindowNumber num = VehicleListIdentifier(VL_GROUP_LIST, vehicle_type, company).Pack();
|
||||
VehicleGroupWindow *w;
|
||||
if (vehicle_type == VEH_TRAIN) {
|
||||
w = AllocateWindowDescFront<VehicleGroupWindow>(&_train_group_desc, num, need_existing_window);
|
||||
w = AllocateWindowDescFront<VehicleGroupWindow>(_train_group_desc, num, need_existing_window);
|
||||
} else {
|
||||
_other_group_desc.cls = GetWindowClassForVehicleType(vehicle_type);
|
||||
w = AllocateWindowDescFront<VehicleGroupWindow>(&_other_group_desc, num, need_existing_window);
|
||||
w = AllocateWindowDescFront<VehicleGroupWindow>(_other_group_desc, num, need_existing_window);
|
||||
}
|
||||
if (w != nullptr) w->SelectGroup(group);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ struct GameManualTextfileWindow : public TextfileWindow {
|
|||
/** Window class displaying the help window. */
|
||||
struct HelpWindow : public Window {
|
||||
|
||||
HelpWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
||||
HelpWindow(WindowDesc &desc, WindowNumber number) : Window(desc)
|
||||
{
|
||||
this->InitNested(number);
|
||||
|
||||
|
@ -202,5 +202,5 @@ static WindowDesc _helpwin_desc(
|
|||
|
||||
void ShowHelpWindow()
|
||||
{
|
||||
AllocateWindowDescFront<HelpWindow>(&_helpwin_desc, 0);
|
||||
AllocateWindowDescFront<HelpWindow>(_helpwin_desc, 0);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ struct EndGameHighScoreBaseWindow : Window {
|
|||
uint32_t background_img;
|
||||
int8_t rank;
|
||||
|
||||
EndGameHighScoreBaseWindow(WindowDesc *desc) : Window(desc)
|
||||
EndGameHighScoreBaseWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested();
|
||||
CLRBITS(this->flags, WF_WHITE_BORDER);
|
||||
|
@ -96,7 +96,7 @@ struct EndGameHighScoreBaseWindow : Window {
|
|||
|
||||
/** End game window shown at the end of the game */
|
||||
struct EndGameWindow : EndGameHighScoreBaseWindow {
|
||||
EndGameWindow(WindowDesc *desc) : EndGameHighScoreBaseWindow(desc)
|
||||
EndGameWindow(WindowDesc &desc) : EndGameHighScoreBaseWindow(desc)
|
||||
{
|
||||
/* Pause in single-player to have a look at the highscore at your own leisure */
|
||||
if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
|
||||
|
@ -158,7 +158,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow {
|
|||
struct HighScoreWindow : EndGameHighScoreBaseWindow {
|
||||
bool game_paused_by_player; ///< True if the game was paused by the player when the highscore window was opened.
|
||||
|
||||
HighScoreWindow(WindowDesc *desc, int difficulty, int8_t ranking) : EndGameHighScoreBaseWindow(desc)
|
||||
HighScoreWindow(WindowDesc &desc, int difficulty, int8_t ranking) : EndGameHighScoreBaseWindow(desc)
|
||||
{
|
||||
/* pause game to show the chart */
|
||||
this->game_paused_by_player = _pause_mode == PM_PAUSED_NORMAL;
|
||||
|
@ -236,7 +236,7 @@ static WindowDesc _endgame_desc(
|
|||
void ShowHighscoreTable(int difficulty, int8_t ranking)
|
||||
{
|
||||
CloseWindowByClass(WC_HIGHSCORE);
|
||||
new HighScoreWindow(&_highscore_desc, difficulty, ranking);
|
||||
new HighScoreWindow(_highscore_desc, difficulty, ranking);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,7 +250,7 @@ void ShowEndGameChart()
|
|||
|
||||
HideVitalWindows();
|
||||
CloseWindowByClass(WC_ENDSCREEN);
|
||||
new EndGameWindow(&_endgame_desc);
|
||||
new EndGameWindow(_endgame_desc);
|
||||
}
|
||||
|
||||
static IntervalTimer<TimerGameCalendar> _check_end_game({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
|
||||
|
|
|
@ -403,7 +403,7 @@ class BuildIndustryWindow : public Window {
|
|||
}
|
||||
|
||||
public:
|
||||
BuildIndustryWindow() : Window(&_build_industry_desc)
|
||||
BuildIndustryWindow() : Window(_build_industry_desc)
|
||||
{
|
||||
this->selected_type = INVALID_INDUSTRYTYPE;
|
||||
|
||||
|
@ -812,7 +812,7 @@ class IndustryViewWindow : public Window
|
|||
int cheat_line_height; ///< Height of each line for the #WID_IV_INFO panel
|
||||
|
||||
public:
|
||||
IndustryViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
IndustryViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->flags |= WF_DISABLE_VP_SCROLL;
|
||||
this->editbox_line = IL_NONE;
|
||||
|
@ -1226,7 +1226,7 @@ static WindowDesc _industry_view_desc(
|
|||
|
||||
void ShowIndustryViewWindow(int industry)
|
||||
{
|
||||
AllocateWindowDescFront<IndustryViewWindow>(&_industry_view_desc, industry);
|
||||
AllocateWindowDescFront<IndustryViewWindow>(_industry_view_desc, industry);
|
||||
}
|
||||
|
||||
/** Widget definition of the industry directory gui */
|
||||
|
@ -1636,7 +1636,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
IndustryDirectoryWindow(WindowDesc *desc, WindowNumber) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH)
|
||||
IndustryDirectoryWindow(WindowDesc &desc, WindowNumber) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_ID_VSCROLLBAR);
|
||||
|
@ -1925,7 +1925,7 @@ static WindowDesc _industry_directory_desc(
|
|||
|
||||
void ShowIndustryDirectory()
|
||||
{
|
||||
AllocateWindowDescFront<IndustryDirectoryWindow>(&_industry_directory_desc, 0);
|
||||
AllocateWindowDescFront<IndustryDirectoryWindow>(_industry_directory_desc, 0);
|
||||
}
|
||||
|
||||
/** Widgets of the industry cargoes window. */
|
||||
|
@ -2542,7 +2542,7 @@ struct IndustryCargoesWindow : public Window {
|
|||
Dimension ind_textsize; ///< Size to hold any industry type text, as well as STR_INDUSTRY_CARGOES_SELECT_INDUSTRY.
|
||||
Scrollbar *vscroll;
|
||||
|
||||
IndustryCargoesWindow(int id) : Window(&_industry_cargoes_desc)
|
||||
IndustryCargoesWindow(int id) : Window(_industry_cargoes_desc)
|
||||
{
|
||||
this->OnInit();
|
||||
this->CreateNestedTree();
|
||||
|
|
|
@ -176,7 +176,7 @@ struct SelectGameWindow : public Window {
|
|||
}
|
||||
}
|
||||
|
||||
SelectGameWindow(WindowDesc *desc) : Window(desc)
|
||||
SelectGameWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->FinishInitNested(0);
|
||||
|
@ -465,7 +465,7 @@ static WindowDesc _select_game_desc(
|
|||
|
||||
void ShowSelectGameWindow()
|
||||
{
|
||||
new SelectGameWindow(&_select_game_desc);
|
||||
new SelectGameWindow(_select_game_desc);
|
||||
}
|
||||
|
||||
static void AskExitGameCallback(Window *, bool confirmed)
|
||||
|
|
|
@ -86,7 +86,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
PerformanceLeagueWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
PerformanceLeagueWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
this->companies.ForceRebuild();
|
||||
|
@ -209,7 +209,7 @@ static WindowDesc _performance_league_desc(
|
|||
|
||||
void ShowPerformanceLeagueTable()
|
||||
{
|
||||
AllocateWindowDescFront<PerformanceLeagueWindow>(&_performance_league_desc, 0);
|
||||
AllocateWindowDescFront<PerformanceLeagueWindow>(_performance_league_desc, 0);
|
||||
}
|
||||
|
||||
static void HandleLinkClick(Link link)
|
||||
|
@ -298,7 +298,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
ScriptLeagueWindow(WindowDesc *desc, LeagueTableID table) : Window(desc)
|
||||
ScriptLeagueWindow(WindowDesc &desc, LeagueTableID table) : Window(desc)
|
||||
{
|
||||
this->table = table;
|
||||
this->BuildTable();
|
||||
|
@ -445,7 +445,7 @@ static WindowDesc _script_league_desc(
|
|||
void ShowScriptLeagueTable(LeagueTableID table)
|
||||
{
|
||||
if (!LeagueTable::IsValidID(table)) return;
|
||||
AllocateWindowDescFront<ScriptLeagueWindow>(&_script_league_desc, table);
|
||||
AllocateWindowDescFront<ScriptLeagueWindow>(_script_league_desc, table);
|
||||
}
|
||||
|
||||
void ShowFirstLeagueTable()
|
||||
|
|
|
@ -548,10 +548,10 @@ static WindowDesc _linkgraph_legend_desc(
|
|||
*/
|
||||
void ShowLinkGraphLegend()
|
||||
{
|
||||
AllocateWindowDescFront<LinkGraphLegendWindow>(&_linkgraph_legend_desc, 0);
|
||||
AllocateWindowDescFront<LinkGraphLegendWindow>(_linkgraph_legend_desc, 0);
|
||||
}
|
||||
|
||||
LinkGraphLegendWindow::LinkGraphLegendWindow(WindowDesc *desc, int window_number) : Window(desc)
|
||||
LinkGraphLegendWindow::LinkGraphLegendWindow(WindowDesc &desc, int window_number) : Window(desc)
|
||||
{
|
||||
this->num_cargo = _sorted_cargo_specs.size();
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void ShowLinkGraphLegend();
|
|||
*/
|
||||
struct LinkGraphLegendWindow : Window {
|
||||
public:
|
||||
LinkGraphLegendWindow(WindowDesc *desc, int window_number);
|
||||
LinkGraphLegendWindow(WindowDesc &desc, int window_number);
|
||||
void SetOverlay(std::shared_ptr<LinkGraphOverlay> overlay);
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override;
|
||||
|
|
|
@ -211,7 +211,7 @@ enum {
|
|||
|
||||
struct MainWindow : Window
|
||||
{
|
||||
MainWindow(WindowDesc *desc) : Window(desc)
|
||||
MainWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested(0);
|
||||
CLRBITS(this->flags, WF_WHITE_BORDER);
|
||||
|
@ -548,7 +548,7 @@ void SetupColoursAndInitialWindow()
|
|||
}
|
||||
}
|
||||
|
||||
new MainWindow(&_main_window_desc);
|
||||
new MainWindow(_main_window_desc);
|
||||
|
||||
/* XXX: these are not done */
|
||||
switch (_game_mode) {
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
LandInfoWindow(Tile tile) : Window(&_land_info_desc), tile(tile)
|
||||
LandInfoWindow(Tile tile) : Window(_land_info_desc), tile(tile)
|
||||
{
|
||||
this->InitNested();
|
||||
|
||||
|
@ -477,7 +477,7 @@ struct AboutWindow : public Window {
|
|||
int line_height; ///< The height of a single line
|
||||
static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
|
||||
|
||||
AboutWindow() : Window(&_about_desc)
|
||||
AboutWindow() : Window(_about_desc)
|
||||
{
|
||||
this->InitNested(WN_GAME_OPTIONS_ABOUT);
|
||||
|
||||
|
@ -671,7 +671,7 @@ struct TooltipsWindow : public Window
|
|||
std::vector<StringParameterBackup> params; ///< The string parameters.
|
||||
TooltipCloseCondition close_cond; ///< Condition for closing the window.
|
||||
|
||||
TooltipsWindow(Window *parent, StringID str, uint paramcount, TooltipCloseCondition close_tooltip) : Window(&_tool_tips_desc)
|
||||
TooltipsWindow(Window *parent, StringID str, uint paramcount, TooltipCloseCondition close_tooltip) : Window(_tool_tips_desc)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->string_id = str;
|
||||
|
@ -971,7 +971,7 @@ struct QueryStringWindow : public Window
|
|||
QueryString editbox; ///< Editbox.
|
||||
QueryStringFlags flags; ///< Flags controlling behaviour of the window.
|
||||
|
||||
QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
|
||||
QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, WindowDesc &desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
|
||||
Window(desc), editbox(max_bytes, max_chars)
|
||||
{
|
||||
this->editbox.text.Assign(str);
|
||||
|
@ -1081,7 +1081,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *paren
|
|||
assert(parent != nullptr);
|
||||
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
|
||||
new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, _query_string_desc, parent, afilter, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1092,7 +1092,7 @@ struct QueryWindow : public Window {
|
|||
std::vector<StringParameterBackup> params; ///< local copy of #_global_string_params
|
||||
StringID message; ///< message shown for query window
|
||||
|
||||
QueryWindow(WindowDesc *desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window(desc)
|
||||
QueryWindow(WindowDesc &desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window(desc)
|
||||
{
|
||||
/* Create a backup of the variadic arguments to strings because it will be
|
||||
* overridden pretty often. We will copy these back for drawing */
|
||||
|
@ -1234,6 +1234,6 @@ void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallback
|
|||
break;
|
||||
}
|
||||
|
||||
QueryWindow *q = new QueryWindow(&_query_desc, caption, message, parent, callback);
|
||||
QueryWindow *q = new QueryWindow(_query_desc, caption, message, parent, callback);
|
||||
if (focus) SetFocusedWindow(q);
|
||||
}
|
||||
|
|
|
@ -477,7 +477,7 @@ void InitializeMusic()
|
|||
|
||||
|
||||
struct MusicTrackSelectionWindow : public Window {
|
||||
MusicTrackSelectionWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
||||
MusicTrackSelectionWindow(WindowDesc &desc, WindowNumber number) : Window(desc)
|
||||
{
|
||||
this->InitNested(number);
|
||||
this->LowerWidget(WID_MTS_LIST_LEFT);
|
||||
|
@ -676,11 +676,11 @@ static WindowDesc _music_track_selection_desc(
|
|||
|
||||
static void ShowMusicTrackSelection()
|
||||
{
|
||||
AllocateWindowDescFront<MusicTrackSelectionWindow>(&_music_track_selection_desc, 0);
|
||||
AllocateWindowDescFront<MusicTrackSelectionWindow>(_music_track_selection_desc, 0);
|
||||
}
|
||||
|
||||
struct MusicWindow : public Window {
|
||||
MusicWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
||||
MusicWindow(WindowDesc &desc, WindowNumber number) : Window(desc)
|
||||
{
|
||||
this->InitNested(number);
|
||||
this->LowerWidget(_settings_client.music.playlist + WID_M_ALL);
|
||||
|
@ -935,5 +935,5 @@ static WindowDesc _music_window_desc(
|
|||
|
||||
void ShowMusicWindow()
|
||||
{
|
||||
AllocateWindowDescFront<MusicWindow>(&_music_window_desc, 0);
|
||||
AllocateWindowDescFront<MusicWindow>(_music_window_desc, 0);
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ struct NetworkChatWindow : public Window {
|
|||
* @param type The type of destination.
|
||||
* @param dest The actual destination index.
|
||||
*/
|
||||
NetworkChatWindow(WindowDesc *desc, DestType type, int dest)
|
||||
NetworkChatWindow(WindowDesc &desc, DestType type, int dest)
|
||||
: Window(desc), message_editbox(NETWORK_CHAT_LENGTH), chat_tab_completion(&message_editbox.text)
|
||||
{
|
||||
this->dtype = type;
|
||||
|
@ -445,5 +445,5 @@ static WindowDesc _chat_window_desc(
|
|||
void ShowNetworkChatQueryWindow(DestType type, int dest)
|
||||
{
|
||||
CloseWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
new NetworkChatWindow(&_chat_window_desc, type, dest);
|
||||
new NetworkChatWindow(_chat_window_desc, type, dest);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ static WindowDesc _network_content_download_status_window_desc(
|
|||
std::begin(_nested_network_content_download_status_window_widgets), std::end(_nested_network_content_download_status_window_widgets)
|
||||
);
|
||||
|
||||
BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc *desc) :
|
||||
BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc &desc) :
|
||||
Window(desc), downloaded_bytes(0), downloaded_files(0), cur_id(UINT32_MAX)
|
||||
{
|
||||
_network_content_client.AddCallback(this);
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
* Create a new download window based on a list of content information
|
||||
* with flags whether to download them or not.
|
||||
*/
|
||||
NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(&_network_content_download_status_window_desc)
|
||||
NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(_network_content_download_status_window_desc)
|
||||
{
|
||||
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ public:
|
|||
* other types are only shown when content that depend on them are
|
||||
* selected.
|
||||
*/
|
||||
NetworkContentListWindow(WindowDesc *desc, bool select_all, const std::bitset<CONTENT_TYPE_END> &types) :
|
||||
NetworkContentListWindow(WindowDesc &desc, bool select_all, const std::bitset<CONTENT_TYPE_END> &types) :
|
||||
Window(desc),
|
||||
auto_select(select_all),
|
||||
filter_editbox(EDITBOX_MAX_SIZE),
|
||||
|
@ -1144,7 +1144,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT
|
|||
}
|
||||
|
||||
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
|
||||
new NetworkContentListWindow(&_network_content_list_desc, cv != nullptr, types);
|
||||
new NetworkContentListWindow(_network_content_list_desc, cv != nullptr, types);
|
||||
#else
|
||||
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
|
||||
/* Connection failed... clean up the mess */
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
* Create the window with the given description.
|
||||
* @param desc The description of the window.
|
||||
*/
|
||||
BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
|
||||
BaseNetworkContentDownloadStatusWindow(WindowDesc &desc);
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override;
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override;
|
||||
|
|
|
@ -430,7 +430,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
NetworkGameWindow(WindowDesc *desc) : Window(desc), name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120)
|
||||
NetworkGameWindow(WindowDesc &desc) : Window(desc), name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120)
|
||||
{
|
||||
this->list_pos = SLP_INVALID;
|
||||
this->server = nullptr;
|
||||
|
@ -976,14 +976,14 @@ void ShowNetworkGameWindow()
|
|||
}
|
||||
}
|
||||
|
||||
new NetworkGameWindow(&_network_game_window_desc);
|
||||
new NetworkGameWindow(_network_game_window_desc);
|
||||
}
|
||||
|
||||
struct NetworkStartServerWindow : public Window {
|
||||
WidgetID widget_id; ///< The widget that has the pop-up input menu
|
||||
QueryString name_editbox; ///< Server name editbox.
|
||||
|
||||
NetworkStartServerWindow(WindowDesc *desc) : Window(desc), name_editbox(NETWORK_NAME_LENGTH)
|
||||
NetworkStartServerWindow(WindowDesc &desc) : Window(desc), name_editbox(NETWORK_NAME_LENGTH)
|
||||
{
|
||||
this->InitNested(WN_NETWORK_WINDOW_START);
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ static void ShowNetworkStartServerWindow()
|
|||
|
||||
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||
|
||||
new NetworkStartServerWindow(&_network_start_server_window_desc);
|
||||
new NetworkStartServerWindow(_network_start_server_window_desc);
|
||||
}
|
||||
|
||||
/* The window below gives information about the connected clients
|
||||
|
@ -1630,7 +1630,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
NetworkClientListWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
NetworkClientListWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
Window(desc),
|
||||
hover_index(-1),
|
||||
player_self_index(-1),
|
||||
|
@ -2066,7 +2066,7 @@ public:
|
|||
|
||||
void ShowClientList()
|
||||
{
|
||||
AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0);
|
||||
AllocateWindowDescFront<NetworkClientListWindow>(_client_list_desc, 0);
|
||||
}
|
||||
|
||||
NetworkJoinStatus _network_join_status; ///< The status of joining.
|
||||
|
@ -2077,7 +2077,7 @@ uint32_t _network_join_bytes_total; ///< The total number of bytes to down
|
|||
struct NetworkJoinStatusWindow : Window {
|
||||
std::shared_ptr<NetworkAuthenticationPasswordRequest> request;
|
||||
|
||||
NetworkJoinStatusWindow(WindowDesc *desc) : Window(desc)
|
||||
NetworkJoinStatusWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||
this->InitNested(WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
|
@ -2201,7 +2201,7 @@ static WindowDesc _network_join_status_window_desc(
|
|||
void ShowJoinStatusWindow()
|
||||
{
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
new NetworkJoinStatusWindow(&_network_join_status_window_desc);
|
||||
new NetworkJoinStatusWindow(_network_join_status_window_desc);
|
||||
}
|
||||
|
||||
void ShowNetworkNeedPassword(std::shared_ptr<NetworkAuthenticationPasswordRequest> request)
|
||||
|
@ -2221,7 +2221,7 @@ struct NetworkAskRelayWindow : public Window {
|
|||
std::string relay_connection_string; ///< The relay server we want to connect to.
|
||||
std::string token; ///< The token for this connection.
|
||||
|
||||
NetworkAskRelayWindow(WindowDesc *desc, Window *parent, const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token) :
|
||||
NetworkAskRelayWindow(WindowDesc &desc, Window *parent, const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token) :
|
||||
Window(desc),
|
||||
server_connection_string(server_connection_string),
|
||||
relay_connection_string(relay_connection_string),
|
||||
|
@ -2326,14 +2326,14 @@ void ShowNetworkAskRelay(const std::string &server_connection_string, const std:
|
|||
CloseWindowByClass(WC_NETWORK_ASK_RELAY, NRWCD_HANDLED);
|
||||
|
||||
Window *parent = GetMainWindow();
|
||||
new NetworkAskRelayWindow(&_network_ask_relay_desc, parent, server_connection_string, relay_connection_string, token);
|
||||
new NetworkAskRelayWindow(_network_ask_relay_desc, parent, server_connection_string, relay_connection_string, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Window used for asking if the user wants to participate in the automated survey.
|
||||
*/
|
||||
struct NetworkAskSurveyWindow : public Window {
|
||||
NetworkAskSurveyWindow(WindowDesc *desc, Window *parent) :
|
||||
NetworkAskSurveyWindow(WindowDesc &desc, Window *parent) :
|
||||
Window(desc)
|
||||
{
|
||||
this->parent = parent;
|
||||
|
@ -2424,7 +2424,7 @@ void ShowNetworkAskSurvey()
|
|||
CloseWindowByClass(WC_NETWORK_ASK_SURVEY);
|
||||
|
||||
Window *parent = GetMainWindow();
|
||||
new NetworkAskSurveyWindow(&_network_ask_survey_desc, parent);
|
||||
new NetworkAskSurveyWindow(_network_ask_survey_desc, parent);
|
||||
}
|
||||
|
||||
/** Window for displaying the textfile of a survey result. */
|
||||
|
|
|
@ -338,7 +338,7 @@ struct NewGRFInspectWindow : Window {
|
|||
if (v == nullptr) this->chain_index = 0;
|
||||
}
|
||||
|
||||
NewGRFInspectWindow(WindowDesc *desc, WindowNumber wno) : Window(desc)
|
||||
NewGRFInspectWindow(WindowDesc &desc, WindowNumber wno) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_NGRFI_SCROLLBAR);
|
||||
|
@ -697,7 +697,7 @@ void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32_t
|
|||
if (!IsNewGRFInspectable(feature, index)) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
WindowDesc *desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? &_newgrf_inspect_chain_desc : &_newgrf_inspect_desc;
|
||||
WindowDesc &desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? _newgrf_inspect_chain_desc : _newgrf_inspect_desc;
|
||||
NewGRFInspectWindow *w = AllocateWindowDescFront<NewGRFInspectWindow>(desc, wno, true);
|
||||
w->SetCallerGRFID(grfid);
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ struct SpriteAlignerWindow : Window {
|
|||
static bool crosshair;
|
||||
const Action5Type *act5_type = nullptr; ///< Sprite Area of current selected sprite.
|
||||
|
||||
SpriteAlignerWindow(WindowDesc *desc, WindowNumber wno) : Window(desc)
|
||||
SpriteAlignerWindow(WindowDesc &desc, WindowNumber wno) : Window(desc)
|
||||
{
|
||||
/* On first opening, set initial zoom to current zoom level. */
|
||||
if (SpriteAlignerWindow::zoom == ZOOM_LVL_END) SpriteAlignerWindow::zoom = _gui_zoom;
|
||||
|
@ -1212,5 +1212,5 @@ static WindowDesc _sprite_aligner_desc(
|
|||
*/
|
||||
void ShowSpriteAlignerWindow()
|
||||
{
|
||||
AllocateWindowDescFront<SpriteAlignerWindow>(&_sprite_aligner_desc, 0);
|
||||
AllocateWindowDescFront<SpriteAlignerWindow>(_sprite_aligner_desc, 0);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ struct NewGRFParametersWindow : public Window {
|
|||
bool action14present; ///< True if action14 information is present.
|
||||
bool editable; ///< Allow editing parameters.
|
||||
|
||||
NewGRFParametersWindow(WindowDesc *desc, bool is_baseset, GRFConfig *c, bool editable) : Window(desc),
|
||||
NewGRFParametersWindow(WindowDesc &desc, bool is_baseset, GRFConfig *c, bool editable) : Window(desc),
|
||||
grf_config(c),
|
||||
clicked_button(INT32_MAX),
|
||||
clicked_dropdown(false),
|
||||
|
@ -551,7 +551,7 @@ static WindowDesc _newgrf_parameters_desc(
|
|||
void OpenGRFParameterWindow(bool is_baseset, GRFConfig *c, bool editable)
|
||||
{
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
new NewGRFParametersWindow(&_newgrf_parameters_desc, is_baseset, c, editable);
|
||||
new NewGRFParametersWindow(_newgrf_parameters_desc, is_baseset, c, editable);
|
||||
}
|
||||
|
||||
/** Window for displaying the textfile of a NewGRF. */
|
||||
|
@ -634,7 +634,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||
Scrollbar *vscroll;
|
||||
Scrollbar *vscroll2;
|
||||
|
||||
NewGRFWindow(WindowDesc *desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) : Window(desc), filter_editbox(EDITBOX_MAX_SIZE)
|
||||
NewGRFWindow(WindowDesc &desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) : Window(desc), filter_editbox(EDITBOX_MAX_SIZE)
|
||||
{
|
||||
this->avail_sel = nullptr;
|
||||
this->avail_pos = -1;
|
||||
|
@ -2020,7 +2020,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
|||
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
new NewGRFWindow(&_newgrf_desc, editable, show_params, exec_changes, config);
|
||||
new NewGRFWindow(_newgrf_desc, editable, show_params, exec_changes, config);
|
||||
}
|
||||
|
||||
/** Widget parts of the save preset window. */
|
||||
|
@ -2067,7 +2067,7 @@ struct SavePresetWindow : public Window {
|
|||
* Constructor of the save preset window.
|
||||
* @param initial_text Initial text to display in the edit box, or \c nullptr.
|
||||
*/
|
||||
SavePresetWindow(const char *initial_text) : Window(&_save_preset_desc), presetname_editbox(32)
|
||||
SavePresetWindow(const char *initial_text) : Window(_save_preset_desc), presetname_editbox(32)
|
||||
{
|
||||
this->presets = GetGRFPresetList();
|
||||
this->selected = -1;
|
||||
|
@ -2207,7 +2207,7 @@ struct ScanProgressWindow : public Window {
|
|||
int scanned; ///< The number of NewGRFs that we have seen.
|
||||
|
||||
/** Create the window. */
|
||||
ScanProgressWindow() : Window(&_scan_progress_desc), scanned(0)
|
||||
ScanProgressWindow() : Window(_scan_progress_desc), scanned(0)
|
||||
{
|
||||
this->InitNested(1);
|
||||
}
|
||||
|
|
|
@ -234,11 +234,11 @@ static WindowDesc *_news_window_layout[] = {
|
|||
&_company_news_desc, ///< NF_COMPANY
|
||||
};
|
||||
|
||||
WindowDesc *GetNewsWindowLayout(NewsFlag flags)
|
||||
WindowDesc &GetNewsWindowLayout(NewsFlag flags)
|
||||
{
|
||||
uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT);
|
||||
assert(layout < lengthof(_news_window_layout));
|
||||
return _news_window_layout[layout];
|
||||
return *_news_window_layout[layout];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,7 +284,7 @@ struct NewsWindow : Window {
|
|||
const NewsItem *ni; ///< News item to display.
|
||||
static int duration; ///< Remaining time for showing the current news message (may only be access while a news item is displayed).
|
||||
|
||||
NewsWindow(WindowDesc *desc, const NewsItem *ni) : Window(desc), ni(ni)
|
||||
NewsWindow(WindowDesc &desc, const NewsItem *ni) : Window(desc), ni(ni)
|
||||
{
|
||||
NewsWindow::duration = 16650;
|
||||
const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
|
@ -296,7 +296,7 @@ struct NewsWindow : Window {
|
|||
this->CreateNestedTree();
|
||||
|
||||
/* For company news with a face we have a separate headline in param[0] */
|
||||
if (desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0].data;
|
||||
if (&desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0].data;
|
||||
|
||||
NWidgetCore *nwid = this->GetWidget<NWidgetCore>(WID_N_SHOW_GROUP);
|
||||
if (ni->reftype1 == NR_VEHICLE && nwid != nullptr) {
|
||||
|
@ -1103,7 +1103,7 @@ struct MessageHistoryWindow : Window {
|
|||
|
||||
Scrollbar *vscroll;
|
||||
|
||||
MessageHistoryWindow(WindowDesc *desc) : Window(desc)
|
||||
MessageHistoryWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_MH_SCROLLBAR);
|
||||
|
@ -1208,5 +1208,5 @@ static WindowDesc _message_history_desc(
|
|||
void ShowMessageHistory()
|
||||
{
|
||||
CloseWindowById(WC_MESSAGE_HISTORY, 0);
|
||||
new MessageHistoryWindow(&_message_history_desc);
|
||||
new MessageHistoryWindow(_message_history_desc);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class BuildObjectWindow : public PickerWindow {
|
|||
int info_height; ///< The height of the info box.
|
||||
|
||||
public:
|
||||
BuildObjectWindow(WindowDesc *desc, WindowNumber) : PickerWindow(desc, nullptr, 0, ObjectPickerCallbacks::instance), info_height(1)
|
||||
BuildObjectWindow(WindowDesc &desc, WindowNumber) : PickerWindow(desc, nullptr, 0, ObjectPickerCallbacks::instance), info_height(1)
|
||||
{
|
||||
ResetObjectToPlace();
|
||||
this->ConstructWindow();
|
||||
|
@ -410,7 +410,7 @@ Window *ShowBuildObjectPicker()
|
|||
{
|
||||
/* Don't show the place object button when there are no objects to place. */
|
||||
if (ObjectPickerCallbacks::instance.IsActive()) {
|
||||
return AllocateWindowDescFront<BuildObjectWindow>(&_build_object_desc, 0);
|
||||
return AllocateWindowDescFront<BuildObjectWindow>(_build_object_desc, 0);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
OrdersWindow(WindowDesc *desc, const Vehicle *v) : Window(desc)
|
||||
OrdersWindow(WindowDesc &desc, const Vehicle *v) : Window(desc)
|
||||
{
|
||||
this->vehicle = v;
|
||||
|
||||
|
@ -1794,8 +1794,8 @@ void ShowOrdersWindow(const Vehicle *v)
|
|||
* TODO Rewrite the order GUI to not use different WindowDescs.
|
||||
*/
|
||||
if (v->owner != _local_company) {
|
||||
new OrdersWindow(&_other_orders_desc, v);
|
||||
new OrdersWindow(_other_orders_desc, v);
|
||||
} else {
|
||||
new OrdersWindow(v->IsGroundVehicle() ? &_orders_train_desc : &_orders_desc, v);
|
||||
new OrdersWindow(v->IsGroundVehicle() ? _orders_train_desc : _orders_desc, v);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ struct OskWindow : public Window {
|
|||
std::string orig_str; ///< Original string.
|
||||
bool shift; ///< Is the shift effectively pressed?
|
||||
|
||||
OskWindow(WindowDesc *desc, Window *parent, WidgetID button) : Window(desc)
|
||||
OskWindow(WindowDesc &desc, Window *parent, WidgetID button) : Window(desc)
|
||||
{
|
||||
this->parent = parent;
|
||||
assert(parent != nullptr);
|
||||
|
@ -397,7 +397,7 @@ void ShowOnScreenKeyboard(Window *parent, WidgetID button)
|
|||
CloseWindowById(WC_OSK, 0);
|
||||
|
||||
GetKeyboardLayout();
|
||||
new OskWindow(&_osk_desc, parent, button);
|
||||
new OskWindow(_osk_desc, parent, button);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -155,7 +155,7 @@ static const std::initializer_list<PickerClassList::FilterFunction * const> _cla
|
|||
static const std::initializer_list<PickerTypeList::SortFunction * const> _type_sorter_funcs = { TypeIDSorter }; ///< Sort functions of the #PickerTypeList.
|
||||
static const std::initializer_list<PickerTypeList::FilterFunction * const> _type_filter_funcs = { TypeTagNameFilter }; ///< Filter functions of the #PickerTypeList.
|
||||
|
||||
PickerWindow::PickerWindow(WindowDesc *desc, Window *parent, int window_number, PickerCallbacks &callbacks) : PickerWindowBase(desc, parent), callbacks(callbacks),
|
||||
PickerWindow::PickerWindow(WindowDesc &desc, Window *parent, int window_number, PickerCallbacks &callbacks) : PickerWindowBase(desc, parent), callbacks(callbacks),
|
||||
class_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE),
|
||||
type_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
|
||||
{
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
bool has_class_picker = false; ///< Set if this window has a class picker 'component'.
|
||||
bool has_type_picker = false; ///< Set if this window has a type picker 'component'.
|
||||
|
||||
PickerWindow(WindowDesc *desc, Window *parent, int window_number, PickerCallbacks &callbacks);
|
||||
PickerWindow(WindowDesc &desc, Window *parent, int window_number, PickerCallbacks &callbacks);
|
||||
void Close(int data = 0) override;
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override;
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override;
|
||||
|
|
|
@ -436,7 +436,7 @@ struct BuildRailToolbarWindow : Window {
|
|||
RailType railtype; ///< Rail type to build.
|
||||
int last_user_action; ///< Last started user action.
|
||||
|
||||
BuildRailToolbarWindow(WindowDesc *desc, RailType railtype) : Window(desc)
|
||||
BuildRailToolbarWindow(WindowDesc &desc, RailType railtype) : Window(desc)
|
||||
{
|
||||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->SetupRailToolbar(railtype);
|
||||
|
@ -922,7 +922,7 @@ Window *ShowBuildRailToolbar(RailType railtype)
|
|||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
_cur_railtype = railtype;
|
||||
_remove_button_clicked = false;
|
||||
return new BuildRailToolbarWindow(&_build_rail_desc, railtype);
|
||||
return new BuildRailToolbarWindow(_build_rail_desc, railtype);
|
||||
}
|
||||
|
||||
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks!
|
||||
|
@ -1076,7 +1076,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
BuildRailStationWindow(WindowDesc *desc, Window *parent) : PickerWindow(desc, parent, TRANSPORT_RAIL, StationPickerCallbacks::instance)
|
||||
BuildRailStationWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, TRANSPORT_RAIL, StationPickerCallbacks::instance)
|
||||
{
|
||||
this->coverage_height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
|
||||
this->ConstructWindow();
|
||||
|
@ -1437,7 +1437,7 @@ static WindowDesc _station_builder_desc(
|
|||
/** Open station build window */
|
||||
static Window *ShowStationBuilder(Window *parent)
|
||||
{
|
||||
return new BuildRailStationWindow(&_station_builder_desc, parent);
|
||||
return new BuildRailStationWindow(_station_builder_desc, parent);
|
||||
}
|
||||
|
||||
struct BuildSignalWindow : public PickerWindowBase {
|
||||
|
@ -1471,7 +1471,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
BuildSignalWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildSignalWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->SetSignalUIMode();
|
||||
|
@ -1694,11 +1694,11 @@ static WindowDesc _signal_builder_desc(
|
|||
*/
|
||||
static void ShowSignalBuilder(Window *parent)
|
||||
{
|
||||
new BuildSignalWindow(&_signal_builder_desc, parent);
|
||||
new BuildSignalWindow(_signal_builder_desc, parent);
|
||||
}
|
||||
|
||||
struct BuildRailDepotWindow : public PickerWindowBase {
|
||||
BuildRailDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildRailDepotWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->LowerWidget(WID_BRAD_DEPOT_NE + _build_depot_direction);
|
||||
|
@ -1772,7 +1772,7 @@ static WindowDesc _build_depot_desc(
|
|||
|
||||
static void ShowBuildTrainDepotPicker(Window *parent)
|
||||
{
|
||||
new BuildRailDepotWindow(&_build_depot_desc, parent);
|
||||
new BuildRailDepotWindow(_build_depot_desc, parent);
|
||||
}
|
||||
|
||||
class WaypointPickerCallbacks : public PickerCallbacksNewGRFClass<StationClass> {
|
||||
|
@ -1849,7 +1849,7 @@ public:
|
|||
/* static */ WaypointPickerCallbacks WaypointPickerCallbacks::instance;
|
||||
|
||||
struct BuildRailWaypointWindow : public PickerWindow {
|
||||
BuildRailWaypointWindow(WindowDesc *desc, Window *parent) : PickerWindow(desc, parent, TRANSPORT_RAIL, WaypointPickerCallbacks::instance)
|
||||
BuildRailWaypointWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, TRANSPORT_RAIL, WaypointPickerCallbacks::instance)
|
||||
{
|
||||
this->ConstructWindow();
|
||||
this->InvalidateData();
|
||||
|
@ -1885,7 +1885,7 @@ static WindowDesc _build_waypoint_desc(
|
|||
static void ShowBuildWaypointPicker(Window *parent)
|
||||
{
|
||||
if (!WaypointPickerCallbacks::instance.IsActive()) return;
|
||||
new BuildRailWaypointWindow(&_build_waypoint_desc, parent);
|
||||
new BuildRailWaypointWindow(_build_waypoint_desc, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -313,7 +313,7 @@ struct BuildRoadToolbarWindow : Window {
|
|||
const RoadTypeInfo *rti; ///< Information about current road type
|
||||
int last_started_action; ///< Last started user action.
|
||||
|
||||
BuildRoadToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
BuildRoadToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->Initialize(_cur_roadtype);
|
||||
this->InitNested(window_number);
|
||||
|
@ -918,7 +918,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype)
|
|||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
_cur_roadtype = roadtype;
|
||||
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD);
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? _build_road_desc : _build_tramway_desc, TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
static constexpr NWidgetPart _nested_build_road_scen_widgets[] = {
|
||||
|
@ -1002,11 +1002,11 @@ Window *ShowBuildRoadScenToolbar(RoadType roadtype)
|
|||
CloseWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
||||
_cur_roadtype = roadtype;
|
||||
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc, TRANSPORT_ROAD);
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? _build_road_scen_desc : _build_tramway_scen_desc, TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
BuildRoadDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
BuildRoadDepotWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -1091,7 +1091,7 @@ static WindowDesc _build_road_depot_desc(
|
|||
|
||||
static void ShowRoadDepotPicker(Window *parent)
|
||||
{
|
||||
new BuildRoadDepotWindow(&_build_road_depot_desc, parent);
|
||||
new BuildRoadDepotWindow(_build_road_depot_desc, parent);
|
||||
}
|
||||
|
||||
template <RoadStopType roadstoptype>
|
||||
|
@ -1222,7 +1222,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindow(desc, parent, TRANSPORT_ROAD, GetRoadStopPickerCallbacks(rs))
|
||||
BuildRoadStationWindow(WindowDesc &desc, Window *parent, RoadStopType rs) : PickerWindow(desc, parent, TRANSPORT_ROAD, GetRoadStopPickerCallbacks(rs))
|
||||
{
|
||||
this->coverage_height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
|
||||
|
||||
|
@ -1510,7 +1510,7 @@ static WindowDesc _tram_station_picker_desc(
|
|||
|
||||
static void ShowRVStationPicker(Window *parent, RoadStopType rs)
|
||||
{
|
||||
new BuildRoadStationWindow(RoadTypeIsRoad(_cur_roadtype) ? &_road_station_picker_desc : &_tram_station_picker_desc, parent, rs);
|
||||
new BuildRoadStationWindow(RoadTypeIsRoad(_cur_roadtype) ? _road_station_picker_desc : _tram_station_picker_desc, parent, rs);
|
||||
}
|
||||
|
||||
void InitializeRoadGui()
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "safeguards.h"
|
||||
|
||||
struct ScreenshotWindow : Window {
|
||||
ScreenshotWindow(WindowDesc *desc) : Window(desc)
|
||||
ScreenshotWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->FinishInitNested();
|
||||
|
@ -74,7 +74,7 @@ static WindowDesc _screenshot_window_desc(
|
|||
void ShowScreenshotWindow()
|
||||
{
|
||||
CloseWindowById(WC_SCREENSHOT, 0);
|
||||
new ScreenshotWindow(&_screenshot_window_desc);
|
||||
new ScreenshotWindow(_screenshot_window_desc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ struct ScriptListWindow : public Window {
|
|||
* @param slot The company we're changing the Script for.
|
||||
* @param show_all Whether to show all available versions.
|
||||
*/
|
||||
ScriptListWindow(WindowDesc *desc, CompanyID slot, bool show_all) : Window(desc),
|
||||
ScriptListWindow(WindowDesc &desc, CompanyID slot, bool show_all) : Window(desc),
|
||||
slot(slot), show_all(show_all)
|
||||
{
|
||||
if (slot == OWNER_DEITY) {
|
||||
|
@ -277,7 +277,7 @@ static WindowDesc _script_list_desc(
|
|||
void ShowScriptListWindow(CompanyID slot, bool show_all)
|
||||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
new ScriptListWindow(&_script_list_desc, slot, show_all);
|
||||
new ScriptListWindow(_script_list_desc, slot, show_all);
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,7 +302,7 @@ struct ScriptSettingsWindow : public Window {
|
|||
* @param desc The description of the window.
|
||||
* @param slot The company we're changing the settings for.
|
||||
*/
|
||||
ScriptSettingsWindow(WindowDesc *desc, CompanyID slot) : Window(desc),
|
||||
ScriptSettingsWindow(WindowDesc &desc, CompanyID slot) : Window(desc),
|
||||
slot(slot),
|
||||
clicked_button(-1),
|
||||
clicked_dropdown(false),
|
||||
|
@ -622,7 +622,7 @@ void ShowScriptSettingsWindow(CompanyID slot)
|
|||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
||||
new ScriptSettingsWindow(&_script_settings_desc, slot);
|
||||
new ScriptSettingsWindow(_script_settings_desc, slot);
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,7 +779,7 @@ struct ScriptDebugWindow : public Window {
|
|||
* @param desc The description of the window.
|
||||
* @param number The window number (actually unused).
|
||||
*/
|
||||
ScriptDebugWindow(WindowDesc *desc, WindowNumber number, Owner show_company) : Window(desc), break_editbox(MAX_BREAK_STR_STRING_LENGTH)
|
||||
ScriptDebugWindow(WindowDesc &desc, WindowNumber number, Owner show_company) : Window(desc), break_editbox(MAX_BREAK_STR_STRING_LENGTH)
|
||||
{
|
||||
this->filter = ScriptDebugWindow::initial_state;
|
||||
this->break_string_filter = {&this->filter.case_sensitive_break_check, false};
|
||||
|
@ -1325,7 +1325,7 @@ Window *ShowScriptDebugWindow(CompanyID show_company, bool new_window)
|
|||
return w;
|
||||
}
|
||||
}
|
||||
return new ScriptDebugWindow(&_script_debug_desc, i, show_company);
|
||||
return new ScriptDebugWindow(_script_debug_desc, i, show_company);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ struct GameOptionsWindow : Window {
|
|||
int gui_scale;
|
||||
static inline WidgetID active_tab = WID_GO_TAB_GENERAL;
|
||||
|
||||
GameOptionsWindow(WindowDesc *desc) : Window(desc)
|
||||
GameOptionsWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->opt = &GetGameSettings();
|
||||
this->reload = false;
|
||||
|
@ -1199,7 +1199,7 @@ static WindowDesc _game_options_desc(
|
|||
void ShowGameOptions()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
new GameOptionsWindow(&_game_options_desc);
|
||||
new GameOptionsWindow(_game_options_desc);
|
||||
}
|
||||
|
||||
static int SETTING_HEIGHT = 11; ///< Height of a single setting in the tree view in pixels
|
||||
|
@ -2334,7 +2334,7 @@ struct GameSettingsWindow : Window {
|
|||
|
||||
Scrollbar *vscroll;
|
||||
|
||||
GameSettingsWindow(WindowDesc *desc) : Window(desc), filter_editbox(50)
|
||||
GameSettingsWindow(WindowDesc &desc) : Window(desc), filter_editbox(50)
|
||||
{
|
||||
this->warn_missing = WHR_NONE;
|
||||
this->warn_lines = 0;
|
||||
|
@ -2909,7 +2909,7 @@ static WindowDesc _settings_selection_desc(
|
|||
void ShowGameSettings()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
new GameSettingsWindow(&_settings_selection_desc);
|
||||
new GameSettingsWindow(_settings_selection_desc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2985,7 +2985,7 @@ void DrawBoolButton(int x, int y, bool state, bool clickable)
|
|||
struct CustomCurrencyWindow : Window {
|
||||
int query_widget;
|
||||
|
||||
CustomCurrencyWindow(WindowDesc *desc) : Window(desc)
|
||||
CustomCurrencyWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested();
|
||||
|
||||
|
@ -3217,5 +3217,5 @@ static WindowDesc _cust_currency_desc(
|
|||
static void ShowCustCurrency()
|
||||
{
|
||||
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||
new CustomCurrencyWindow(&_cust_currency_desc);
|
||||
new CustomCurrencyWindow(_cust_currency_desc);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ struct SignListWindow : Window, SignList {
|
|||
int text_offset; ///< Offset of the sign text relative to the left edge of the WID_SIL_LIST widget.
|
||||
Scrollbar *vscroll;
|
||||
|
||||
SignListWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc), filter_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
|
||||
SignListWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc), filter_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SIL_SCROLLBAR);
|
||||
|
@ -398,7 +398,7 @@ static WindowDesc _sign_list_desc(
|
|||
*/
|
||||
Window *ShowSignList()
|
||||
{
|
||||
return AllocateWindowDescFront<SignListWindow>(&_sign_list_desc, 0);
|
||||
return AllocateWindowDescFront<SignListWindow>(_sign_list_desc, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,7 +418,7 @@ struct SignWindow : Window, SignList {
|
|||
QueryString name_editbox;
|
||||
SignID cur_sign;
|
||||
|
||||
SignWindow(WindowDesc *desc, const Sign *si) : Window(desc), name_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
|
||||
SignWindow(WindowDesc &desc, const Sign *si) : Window(desc), name_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
|
||||
{
|
||||
this->querystrings[WID_QES_TEXT] = &this->name_editbox;
|
||||
this->name_editbox.caption = STR_EDIT_SIGN_CAPTION;
|
||||
|
@ -582,7 +582,7 @@ void ShowRenameSignWindow(const Sign *si)
|
|||
/* Delete all other edit windows */
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
|
||||
new SignWindow(&_query_sign_edit_desc, si);
|
||||
new SignWindow(_query_sign_edit_desc, si);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1400,7 +1400,7 @@ protected:
|
|||
public:
|
||||
friend class NWidgetSmallmapDisplay;
|
||||
|
||||
SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc)
|
||||
SmallMapWindow(WindowDesc &desc, int window_number) : Window(desc)
|
||||
{
|
||||
_smallmap_industry_highlight = INVALID_INDUSTRYTYPE;
|
||||
this->overlay = std::make_unique<LinkGraphOverlay>(this, WID_SM_MAP, 0, this->GetOverlayCompanyMask(), 1);
|
||||
|
@ -1994,7 +1994,7 @@ static WindowDesc _smallmap_desc(
|
|||
*/
|
||||
void ShowSmallMap()
|
||||
{
|
||||
AllocateWindowDescFront<SmallMapWindow>(&_smallmap_desc, 0);
|
||||
AllocateWindowDescFront<SmallMapWindow>(_smallmap_desc, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -384,7 +384,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
CompanyStationsWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
CompanyStationsWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
/* Load initial filter state. */
|
||||
this->filter = CompanyStationsWindow::initial_state;
|
||||
|
@ -781,7 +781,7 @@ void ShowCompanyStations(CompanyID company)
|
|||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
|
||||
AllocateWindowDescFront<CompanyStationsWindow>(&_company_stations_desc, company);
|
||||
AllocateWindowDescFront<CompanyStationsWindow>(_company_stations_desc, company);
|
||||
}
|
||||
|
||||
static constexpr NWidgetPart _nested_station_view_widgets[] = {
|
||||
|
@ -1321,7 +1321,7 @@ struct StationViewWindow : public Window {
|
|||
CargoDataEntry cached_destinations; ///< Cache for the flows passing through this station.
|
||||
CargoDataVector displayed_rows; ///< Parent entry of currently displayed rows (including collapsed ones).
|
||||
|
||||
StationViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc),
|
||||
StationViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc),
|
||||
scroll_to_row(INT_MAX), grouping_index(0)
|
||||
{
|
||||
this->rating_lines = ALH_RATING;
|
||||
|
@ -2143,7 +2143,7 @@ static WindowDesc _station_view_desc(
|
|||
*/
|
||||
void ShowStationViewWindow(StationID station)
|
||||
{
|
||||
AllocateWindowDescFront<StationViewWindow>(&_station_view_desc, station);
|
||||
AllocateWindowDescFront<StationViewWindow>(_station_view_desc, station);
|
||||
}
|
||||
|
||||
/** Struct containing TileIndex and StationID */
|
||||
|
@ -2271,7 +2271,7 @@ struct SelectStationWindow : Window {
|
|||
TileArea area; ///< Location of new station
|
||||
Scrollbar *vscroll;
|
||||
|
||||
SelectStationWindow(WindowDesc *desc, TileArea ta, StationPickerCmdProc&& proc) :
|
||||
SelectStationWindow(WindowDesc &desc, TileArea ta, StationPickerCmdProc&& proc) :
|
||||
Window(desc),
|
||||
select_station_proc(std::move(proc)),
|
||||
area(ta)
|
||||
|
@ -2441,7 +2441,7 @@ void ShowSelectBaseStationIfNeeded(TileArea ta, StationPickerCmdProc&& proc)
|
|||
{
|
||||
if (StationJoinerNeeded<T>(ta, proc)) {
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
new SelectStationWindow<T>(&_select_station_desc, ta, std::move(proc));
|
||||
new SelectStationWindow<T>(_select_station_desc, ta, std::move(proc));
|
||||
} else {
|
||||
proc(false, INVALID_STATION);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ struct StatusBarWindow : Window {
|
|||
static const int COUNTER_STEP = 2; ///< this is subtracted from active counters every tick
|
||||
static constexpr auto REMINDER_START = std::chrono::milliseconds(1350); ///< time in ms for reminder notification (red dot on the right) to stay
|
||||
|
||||
StatusBarWindow(WindowDesc *desc) : Window(desc)
|
||||
StatusBarWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->ticker_scroll = TICKER_STOP;
|
||||
|
||||
|
@ -249,5 +249,5 @@ bool IsNewsTickerShown()
|
|||
*/
|
||||
void ShowStatusBar()
|
||||
{
|
||||
new StatusBarWindow(&_main_status_desc);
|
||||
new StatusBarWindow(_main_status_desc);
|
||||
}
|
||||
|
|
|
@ -590,7 +590,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
StoryBookWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
StoryBookWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SB_SCROLLBAR);
|
||||
|
@ -1052,6 +1052,6 @@ void ShowStoryBook(CompanyID company, uint16_t page_id, bool centered)
|
|||
{
|
||||
if (!Company::IsValidID(company)) company = (CompanyID)INVALID_COMPANY;
|
||||
|
||||
StoryBookWindow *w = AllocateWindowDescFront<StoryBookWindow>(centered ? &_story_book_gs_desc : &_story_book_desc, company, true);
|
||||
StoryBookWindow *w = AllocateWindowDescFront<StoryBookWindow>(centered ? _story_book_gs_desc : _story_book_desc, company, true);
|
||||
if (page_id != INVALID_STORY_PAGE) w->SetSelectedPage(page_id);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ struct SubsidyListWindow : Window {
|
|||
Scrollbar *vscroll;
|
||||
Dimension cargo_icon_size;
|
||||
|
||||
SubsidyListWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
SubsidyListWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SUL_SCROLLBAR);
|
||||
|
@ -277,5 +277,5 @@ static WindowDesc _subsidies_list_desc(
|
|||
|
||||
void ShowSubsidiesList()
|
||||
{
|
||||
AllocateWindowDescFront<SubsidyListWindow>(&_subsidies_list_desc, 0);
|
||||
AllocateWindowDescFront<SubsidyListWindow>(_subsidies_list_desc, 0);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ void PlaceProc_DemolishArea(TileIndex tile)
|
|||
struct TerraformToolbarWindow : Window {
|
||||
int last_user_action; ///< Last started user action.
|
||||
|
||||
TerraformToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
TerraformToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
/* This is needed as we like to have the tree available on OnInit. */
|
||||
this->CreateNestedTree();
|
||||
|
@ -371,13 +371,13 @@ Window *ShowTerraformToolbar(Window *link)
|
|||
|
||||
Window *w;
|
||||
if (link == nullptr) {
|
||||
w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
|
||||
w = AllocateWindowDescFront<TerraformToolbarWindow>(_terraform_desc, 0);
|
||||
return w;
|
||||
}
|
||||
|
||||
/* Delete the terraform toolbar to place it again. */
|
||||
CloseWindowById(WC_SCEN_LAND_GEN, 0, true);
|
||||
w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
|
||||
w = AllocateWindowDescFront<TerraformToolbarWindow>(_terraform_desc, 0);
|
||||
/* Align the terraform toolbar under the main toolbar. */
|
||||
w->top -= w->height;
|
||||
w->SetDirty();
|
||||
|
@ -536,7 +536,7 @@ static void ResetLandscapeConfirmationCallback(Window *, bool confirmed)
|
|||
struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
int last_user_action; ///< Last started user action.
|
||||
|
||||
ScenarioEditorLandscapeGenerationWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
ScenarioEditorLandscapeGenerationWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
|
||||
|
@ -750,5 +750,5 @@ static WindowDesc _scen_edit_land_gen_desc(
|
|||
*/
|
||||
Window *ShowEditorTerraformToolbar()
|
||||
{
|
||||
return AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
|
||||
return AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(_scen_edit_land_gen_desc, 0);
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ static WindowDesc _textfile_desc(
|
|||
std::begin(_nested_textfile_widgets), std::end(_nested_textfile_widgets)
|
||||
);
|
||||
|
||||
TextfileWindow::TextfileWindow(TextfileType file_type) : Window(&_textfile_desc), file_type(file_type)
|
||||
TextfileWindow::TextfileWindow(TextfileType file_type) : Window(_textfile_desc), file_type(file_type)
|
||||
{
|
||||
/* Init of nested tree is deferred.
|
||||
* TextfileWindow::ConstructWindow must be called by the inheriting window. */
|
||||
|
|
|
@ -207,7 +207,7 @@ struct TimetableWindow : Window {
|
|||
bool set_start_date_all; ///< Set start date using minutes text entry for all timetable entries (ctrl-click) action.
|
||||
bool change_timetable_all; ///< Set wait time or speed for all timetable entries (ctrl-click) action.
|
||||
|
||||
TimetableWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
TimetableWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
Window(desc),
|
||||
sel_index(-1),
|
||||
vehicle(Vehicle::Get(window_number)),
|
||||
|
@ -867,5 +867,5 @@ void ShowTimetableWindow(const Vehicle *v)
|
|||
{
|
||||
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||
CloseWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
|
||||
AllocateWindowDescFront<TimetableWindow>(_timetable_desc, v->index);
|
||||
}
|
||||
|
|
|
@ -1955,7 +1955,7 @@ static ToolbarButtonProc * const _toolbar_button_procs[] = {
|
|||
|
||||
/** Main toolbar. */
|
||||
struct MainToolbarWindow : Window {
|
||||
MainToolbarWindow(WindowDesc *desc) : Window(desc)
|
||||
MainToolbarWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested(0);
|
||||
|
||||
|
@ -2296,7 +2296,7 @@ enum MainToolbarEditorHotkeys {
|
|||
};
|
||||
|
||||
struct ScenarioEditorToolbarWindow : Window {
|
||||
ScenarioEditorToolbarWindow(WindowDesc *desc) : Window(desc)
|
||||
ScenarioEditorToolbarWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->InitNested(0);
|
||||
|
||||
|
@ -2562,8 +2562,8 @@ void AllocateToolbar()
|
|||
_last_built_tramtype = ROADTYPE_TRAM;
|
||||
|
||||
if (_game_mode == GM_EDITOR) {
|
||||
new ScenarioEditorToolbarWindow(&_toolb_scen_desc);
|
||||
new ScenarioEditorToolbarWindow(_toolb_scen_desc);
|
||||
} else {
|
||||
new MainToolbarWindow(&_toolb_normal_desc);
|
||||
new MainToolbarWindow(_toolb_normal_desc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
TownAuthorityWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc), sel_index(-1), displayed_actions_on_previous_painting(0), available_actions(TACT_NONE)
|
||||
TownAuthorityWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc), sel_index(-1), displayed_actions_on_previous_painting(0), available_actions(TACT_NONE)
|
||||
{
|
||||
this->town = Town::Get(window_number);
|
||||
this->enabled_actions = GetEnabledActions();
|
||||
|
@ -351,7 +351,7 @@ static WindowDesc _town_authority_desc(
|
|||
|
||||
static void ShowTownAuthorityWindow(uint town)
|
||||
{
|
||||
AllocateWindowDescFront<TownAuthorityWindow>(&_town_authority_desc, town);
|
||||
AllocateWindowDescFront<TownAuthorityWindow>(_town_authority_desc, town);
|
||||
}
|
||||
|
||||
|
||||
|
@ -363,7 +363,7 @@ private:
|
|||
public:
|
||||
static const int WID_TV_HEIGHT_NORMAL = 150;
|
||||
|
||||
TownViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
TownViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -677,9 +677,9 @@ static WindowDesc _town_editor_view_desc(
|
|||
void ShowTownViewWindow(TownID town)
|
||||
{
|
||||
if (_game_mode == GM_EDITOR) {
|
||||
AllocateWindowDescFront<TownViewWindow>(&_town_editor_view_desc, town);
|
||||
AllocateWindowDescFront<TownViewWindow>(_town_editor_view_desc, town);
|
||||
} else {
|
||||
AllocateWindowDescFront<TownViewWindow>(&_town_game_view_desc, town);
|
||||
AllocateWindowDescFront<TownViewWindow>(_town_game_view_desc, town);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
TownDirectoryWindow(WindowDesc *desc) : Window(desc), townname_editbox(MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_TOWN_NAME_CHARS)
|
||||
TownDirectoryWindow(WindowDesc &desc) : Window(desc), townname_editbox(MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_TOWN_NAME_CHARS)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ static WindowDesc _town_directory_desc(
|
|||
void ShowTownDirectory()
|
||||
{
|
||||
if (BringWindowToFrontById(WC_TOWN_DIRECTORY, 0)) return;
|
||||
new TownDirectoryWindow(&_town_directory_desc);
|
||||
new TownDirectoryWindow(_town_directory_desc);
|
||||
}
|
||||
|
||||
void CcFoundTown(Commands, const CommandCost &result, TileIndex tile)
|
||||
|
@ -1146,7 +1146,7 @@ private:
|
|||
TownNameParams params; ///< Town name parameters
|
||||
|
||||
public:
|
||||
FoundTownWindow(WindowDesc *desc, WindowNumber window_number) :
|
||||
FoundTownWindow(WindowDesc &desc, WindowNumber window_number) :
|
||||
Window(desc),
|
||||
town_size(TSZ_MEDIUM),
|
||||
town_layout(_settings_game.economy.town_layout),
|
||||
|
@ -1300,7 +1300,7 @@ static WindowDesc _found_town_desc(
|
|||
void ShowFoundTownWindow()
|
||||
{
|
||||
if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return;
|
||||
AllocateWindowDescFront<FoundTownWindow>(&_found_town_desc, 0);
|
||||
AllocateWindowDescFront<FoundTownWindow>(_found_town_desc, 0);
|
||||
}
|
||||
|
||||
void InitializeTownGui()
|
||||
|
@ -1558,7 +1558,7 @@ public:
|
|||
/* static */ HousePickerCallbacks HousePickerCallbacks::instance;
|
||||
|
||||
struct BuildHouseWindow : public PickerWindow {
|
||||
BuildHouseWindow(WindowDesc *desc, Window *parent) : PickerWindow(desc, parent, 0, HousePickerCallbacks::instance)
|
||||
BuildHouseWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, 0, HousePickerCallbacks::instance)
|
||||
{
|
||||
HousePickerCallbacks::instance.SetClimateMask();
|
||||
this->ConstructWindow();
|
||||
|
@ -1639,5 +1639,5 @@ static WindowDesc _build_house_desc(
|
|||
void ShowBuildHousePicker(Window *parent)
|
||||
{
|
||||
if (BringWindowToFrontById(WC_BUILD_HOUSE, 0)) return;
|
||||
new BuildHouseWindow(&_build_house_desc, parent);
|
||||
new BuildHouseWindow(_build_house_desc, parent);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ uint8_t _display_opt; ///< What do we want to draw/do?
|
|||
class TransparenciesWindow : public Window
|
||||
{
|
||||
public:
|
||||
TransparenciesWindow(WindowDesc *desc, int window_number) : Window(desc)
|
||||
TransparenciesWindow(WindowDesc &desc, int window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
}
|
||||
|
@ -160,5 +160,5 @@ static WindowDesc _transparency_desc(
|
|||
*/
|
||||
void ShowTransparencyToolbar()
|
||||
{
|
||||
AllocateWindowDescFront<TransparenciesWindow>(&_transparency_desc, 0);
|
||||
AllocateWindowDescFront<TransparenciesWindow>(_transparency_desc, 0);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ class BuildTreesWindow : public Window
|
|||
}
|
||||
|
||||
public:
|
||||
BuildTreesWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc), tree_to_plant(-1), mode(PM_NORMAL)
|
||||
BuildTreesWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc), tree_to_plant(-1), mode(PM_NORMAL)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
ResetObjectToPlace();
|
||||
|
@ -320,5 +320,5 @@ static WindowDesc _build_trees_desc(
|
|||
void ShowBuildTreesToolbar()
|
||||
{
|
||||
if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return;
|
||||
AllocateWindowDescFront<BuildTreesWindow>(&_build_trees_desc, 0);
|
||||
AllocateWindowDescFront<BuildTreesWindow>(_build_trees_desc, 0);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ const StringID BaseVehicleListWindow::vehicle_depot_name[] = {
|
|||
STR_VEHICLE_LIST_SEND_AIRCRAFT_TO_HANGAR
|
||||
};
|
||||
|
||||
BaseVehicleListWindow::BaseVehicleListWindow(WindowDesc *desc, WindowNumber wno) : Window(desc), vli(VehicleListIdentifier::UnPack(wno))
|
||||
BaseVehicleListWindow::BaseVehicleListWindow(WindowDesc &desc, WindowNumber wno) : Window(desc), vli(VehicleListIdentifier::UnPack(wno))
|
||||
{
|
||||
this->vehicle_sel = INVALID_VEHICLE;
|
||||
this->grouping = _grouping[vli.type][vli.vtype];
|
||||
|
@ -862,7 +862,7 @@ struct RefitWindow : public Window {
|
|||
this->selected_refit = nullptr;
|
||||
}
|
||||
|
||||
RefitWindow(WindowDesc *desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window(desc)
|
||||
RefitWindow(WindowDesc &desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window(desc)
|
||||
{
|
||||
this->auto_refit = auto_refit;
|
||||
this->order = order;
|
||||
|
@ -1293,7 +1293,7 @@ static WindowDesc _vehicle_refit_desc(
|
|||
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
|
||||
{
|
||||
CloseWindowById(WC_VEHICLE_REFIT, v->index);
|
||||
RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order, auto_refit);
|
||||
RefitWindow *w = new RefitWindow(_vehicle_refit_desc, v, order, auto_refit);
|
||||
w->parent = parent;
|
||||
}
|
||||
|
||||
|
@ -1871,7 +1871,7 @@ private:
|
|||
};
|
||||
|
||||
public:
|
||||
VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
|
||||
VehicleListWindow(WindowDesc &desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
|
@ -2236,10 +2236,10 @@ static void ShowVehicleListWindowLocal(CompanyID company, VehicleListType vlt, V
|
|||
|
||||
WindowNumber num = VehicleListIdentifier(vlt, vehicle_type, company, unique_number).Pack();
|
||||
if (vehicle_type == VEH_TRAIN) {
|
||||
AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_train_desc, num);
|
||||
AllocateWindowDescFront<VehicleListWindow>(_vehicle_list_train_desc, num);
|
||||
} else {
|
||||
_vehicle_list_other_desc.cls = GetWindowClassForVehicleType(vehicle_type);
|
||||
AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_other_desc, num);
|
||||
AllocateWindowDescFront<VehicleListWindow>(_vehicle_list_other_desc, num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2371,7 +2371,7 @@ struct VehicleDetailsWindow : Window {
|
|||
Scrollbar *vscroll;
|
||||
|
||||
/** Initialize a newly created vehicle details window */
|
||||
VehicleDetailsWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
VehicleDetailsWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
const Vehicle *v = Vehicle::Get(window_number);
|
||||
|
||||
|
@ -2795,7 +2795,7 @@ static void ShowVehicleDetailsWindow(const Vehicle *v)
|
|||
{
|
||||
CloseWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||
CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
|
||||
AllocateWindowDescFront<VehicleDetailsWindow>((v->type == VEH_TRAIN) ? &_train_vehicle_details_desc : &_nontrain_vehicle_details_desc, v->index);
|
||||
AllocateWindowDescFront<VehicleDetailsWindow>((v->type == VEH_TRAIN) ? _train_vehicle_details_desc : _nontrain_vehicle_details_desc, v->index);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2972,7 +2972,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
VehicleViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
VehicleViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->flags |= WF_DISABLE_VP_SCROLL;
|
||||
this->CreateNestedTree();
|
||||
|
@ -3405,7 +3405,7 @@ static WindowDesc _train_view_desc(
|
|||
/** Shows the vehicle view window of the given vehicle. */
|
||||
void ShowVehicleViewWindow(const Vehicle *v)
|
||||
{
|
||||
AllocateWindowDescFront<VehicleViewWindow>((v->type == VEH_TRAIN) ? &_train_view_desc : &_vehicle_view_desc, v->index);
|
||||
AllocateWindowDescFront<VehicleViewWindow>((v->type == VEH_TRAIN) ? _train_view_desc : _vehicle_view_desc, v->index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,7 +106,7 @@ struct BaseVehicleListWindow : public Window {
|
|||
static const std::initializer_list<VehicleGroupSortFunction * const> vehicle_group_none_sorter_funcs;
|
||||
static const std::initializer_list<VehicleGroupSortFunction * const> vehicle_group_shared_orders_sorter_funcs;
|
||||
|
||||
BaseVehicleListWindow(WindowDesc *desc, WindowNumber wno);
|
||||
BaseVehicleListWindow(WindowDesc &desc, WindowNumber wno);
|
||||
|
||||
void OnInit() override;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ static constexpr NWidgetPart _nested_extra_viewport_widgets[] = {
|
|||
|
||||
class ExtraViewportWindow : public Window {
|
||||
public:
|
||||
ExtraViewportWindow(WindowDesc *desc, int window_number, TileIndex tile) : Window(desc)
|
||||
ExtraViewportWindow(WindowDesc &desc, int window_number, TileIndex tile) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
|
||||
|
@ -160,7 +160,7 @@ void ShowExtraViewportWindow(TileIndex tile)
|
|||
/* find next free window number for extra viewport */
|
||||
while (FindWindowById(WC_EXTRA_VIEWPORT, i) != nullptr) i++;
|
||||
|
||||
new ExtraViewportWindow(&_extra_viewport_desc, i, tile);
|
||||
new ExtraViewportWindow(_extra_viewport_desc, i, tile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
* @param desc The description of the window.
|
||||
* @param window_number The window number, in this case the waypoint's ID.
|
||||
*/
|
||||
WaypointWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
WaypointWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->wp = Waypoint::Get(window_number);
|
||||
this->vt = (wp->string_id == STR_SV_STNAME_WAYPOINT) ? VEH_TRAIN : VEH_SHIP;
|
||||
|
@ -196,5 +196,5 @@ static WindowDesc _waypoint_view_desc(
|
|||
*/
|
||||
void ShowWaypointWindow(const Waypoint *wp)
|
||||
{
|
||||
AllocateWindowDescFront<WaypointWindow>(&_waypoint_view_desc, wp->index);
|
||||
AllocateWindowDescFront<WaypointWindow>(_waypoint_view_desc, wp->index);
|
||||
}
|
||||
|
|
|
@ -195,10 +195,10 @@ void WindowDesc::SaveToConfig()
|
|||
void Window::ApplyDefaults()
|
||||
{
|
||||
if (this->nested_root != nullptr && this->nested_root->GetWidgetOfType(WWT_STICKYBOX) != nullptr) {
|
||||
if (this->window_desc->pref_sticky) this->flags |= WF_STICKY;
|
||||
if (this->window_desc.pref_sticky) this->flags |= WF_STICKY;
|
||||
} else {
|
||||
/* There is no stickybox; clear the preference in case someone tried to be funny */
|
||||
this->window_desc->pref_sticky = false;
|
||||
this->window_desc.pref_sticky = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
|||
bool focused_widget_changed = false;
|
||||
/* If clicked on a window that previously did not have focus */
|
||||
if (_focused_window != w && // We already have focus, right?
|
||||
(w->window_desc->flags & WDF_NO_FOCUS) == 0 && // Don't lose focus to toolbars
|
||||
(w->window_desc.flags & WDF_NO_FOCUS) == 0 && // Don't lose focus to toolbars
|
||||
widget_type != WWT_CLOSEBOX) { // Don't change focused window if 'X' (close button) was clicked
|
||||
focused_widget_changed = true;
|
||||
SetFocusedWindow(w);
|
||||
|
@ -681,11 +681,11 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
|||
|
||||
case WWT_DEFSIZEBOX: {
|
||||
if (_ctrl_pressed) {
|
||||
w->window_desc->pref_width = w->width;
|
||||
w->window_desc->pref_height = w->height;
|
||||
w->window_desc.pref_width = w->width;
|
||||
w->window_desc.pref_height = w->height;
|
||||
} else {
|
||||
int16_t def_width = std::max<int16_t>(std::min<int16_t>(w->window_desc->GetDefaultWidth(), _screen.width), w->nested_root->smallest_x);
|
||||
int16_t def_height = std::max<int16_t>(std::min<int16_t>(w->window_desc->GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y);
|
||||
int16_t def_width = std::max<int16_t>(std::min<int16_t>(w->window_desc.GetDefaultWidth(), _screen.width), w->nested_root->smallest_x);
|
||||
int16_t def_height = std::max<int16_t>(std::min<int16_t>(w->window_desc.GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y);
|
||||
|
||||
int dx = (w->resize.step_width == 0) ? 0 : def_width - w->width;
|
||||
int dy = (w->resize.step_height == 0) ? 0 : def_height - w->height;
|
||||
|
@ -714,7 +714,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
|||
case WWT_STICKYBOX:
|
||||
w->flags ^= WF_STICKY;
|
||||
nw->SetDirty(w);
|
||||
if (_ctrl_pressed) w->window_desc->pref_sticky = (w->flags & WF_STICKY) != 0;
|
||||
if (_ctrl_pressed) w->window_desc.pref_sticky = (w->flags & WF_STICKY) != 0;
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -752,9 +752,9 @@ static void DispatchRightClickEvent(Window *w, int x, int y)
|
|||
}
|
||||
|
||||
/* Right-click close is enabled and there is a closebox. */
|
||||
if (_settings_client.gui.right_click_wnd_close == RCC_YES && (w->window_desc->flags & WDF_NO_CLOSE) == 0) {
|
||||
if (_settings_client.gui.right_click_wnd_close == RCC_YES && (w->window_desc.flags & WDF_NO_CLOSE) == 0) {
|
||||
w->Close();
|
||||
} else if (_settings_client.gui.right_click_wnd_close == RCC_YES_EXCEPT_STICKY && (w->flags & WF_STICKY) == 0 && (w->window_desc->flags & WDF_NO_CLOSE) == 0) {
|
||||
} else if (_settings_client.gui.right_click_wnd_close == RCC_YES_EXCEPT_STICKY && (w->flags & WF_STICKY) == 0 && (w->window_desc.flags & WDF_NO_CLOSE) == 0) {
|
||||
/* Right-click close is enabled, but excluding sticky windows. */
|
||||
w->Close();
|
||||
} else if (_settings_client.gui.hover_delay_ms == 0 && !w->OnTooltip(pt, wid->index, TCC_RIGHT_CLICK) && wid->tool_tip != 0) {
|
||||
|
@ -981,7 +981,7 @@ void Window::ReInit(int rx, int ry, bool reposition)
|
|||
if (reposition) {
|
||||
Point pt = this->OnInitialPosition(this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
|
||||
this->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
|
||||
this->FindWindowPlacementAndResize(this->window_desc->GetDefaultWidth(), this->window_desc->GetDefaultHeight());
|
||||
this->FindWindowPlacementAndResize(this->window_desc.GetDefaultWidth(), this->window_desc.GetDefaultHeight());
|
||||
}
|
||||
|
||||
ResizeWindow(this, dx, dy, true, false);
|
||||
|
@ -1365,9 +1365,9 @@ static void BringWindowToFront(Window *w, bool dirty)
|
|||
void Window::InitializeData(WindowNumber window_number)
|
||||
{
|
||||
/* Set up window properties; some of them are needed to set up smallest size below */
|
||||
this->window_class = this->window_desc->cls;
|
||||
this->window_class = this->window_desc.cls;
|
||||
this->SetWhiteBorder();
|
||||
if (this->window_desc->default_pos == WDP_CENTER) this->flags |= WF_CENTERED;
|
||||
if (this->window_desc.default_pos == WDP_CENTER) this->flags |= WF_CENTERED;
|
||||
this->owner = INVALID_OWNER;
|
||||
this->nested_focus = nullptr;
|
||||
this->window_number = window_number;
|
||||
|
@ -1650,17 +1650,17 @@ Point GetToolbarAlignedWindowPosition(int window_width)
|
|||
*
|
||||
* @return Coordinate of the top-left corner of the new window.
|
||||
*/
|
||||
static Point LocalGetWindowPlacement(const WindowDesc *desc, int16_t sm_width, int16_t sm_height, int window_number)
|
||||
static Point LocalGetWindowPlacement(const WindowDesc &desc, int16_t sm_width, int16_t sm_height, int window_number)
|
||||
{
|
||||
Point pt;
|
||||
const Window *w;
|
||||
|
||||
int16_t default_width = std::max(desc->GetDefaultWidth(), sm_width);
|
||||
int16_t default_height = std::max(desc->GetDefaultHeight(), sm_height);
|
||||
int16_t default_width = std::max(desc.GetDefaultWidth(), sm_width);
|
||||
int16_t default_height = std::max(desc.GetDefaultHeight(), sm_height);
|
||||
|
||||
if (desc->parent_cls != WC_NONE && (w = FindWindowById(desc->parent_cls, window_number)) != nullptr) {
|
||||
if (desc.parent_cls != WC_NONE && (w = FindWindowById(desc.parent_cls, window_number)) != nullptr) {
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
if (desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) {
|
||||
if (desc.parent_cls == WC_BUILD_TOOLBAR || desc.parent_cls == WC_SCEN_LAND_GEN) {
|
||||
pt.x = w->left + (rtl ? w->width - default_width : 0);
|
||||
pt.y = w->top + w->height;
|
||||
return pt;
|
||||
|
@ -1685,7 +1685,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16_t sm_width, i
|
|||
}
|
||||
}
|
||||
|
||||
switch (desc->default_pos) {
|
||||
switch (desc.default_pos) {
|
||||
case WDP_ALIGN_TOOLBAR: // Align to the toolbar
|
||||
return GetToolbarAlignedWindowPosition(default_width);
|
||||
|
||||
|
@ -1723,7 +1723,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16_t sm_width, i
|
|||
*/
|
||||
void Window::CreateNestedTree()
|
||||
{
|
||||
this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_begin, this->window_desc->nwid_end, &this->shade_select);
|
||||
this->nested_root = MakeWindowNWidgetTree(this->window_desc.nwid_begin, this->window_desc.nwid_end, &this->shade_select);
|
||||
this->nested_root->FillWidgetLookup(this->widget_lookup);
|
||||
}
|
||||
|
||||
|
@ -1737,7 +1737,7 @@ void Window::FinishInitNested(WindowNumber window_number)
|
|||
this->ApplyDefaults();
|
||||
Point pt = this->OnInitialPosition(this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
|
||||
this->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
|
||||
this->FindWindowPlacementAndResize(this->window_desc->GetDefaultWidth(), this->window_desc->GetDefaultHeight());
|
||||
this->FindWindowPlacementAndResize(this->window_desc.GetDefaultWidth(), this->window_desc.GetDefaultHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1754,7 +1754,7 @@ void Window::InitNested(WindowNumber window_number)
|
|||
* Empty constructor, initialization has been moved to #InitNested() called from the constructor of the derived class.
|
||||
* @param desc The description of the window.
|
||||
*/
|
||||
Window::Window(WindowDesc *desc) : window_desc(desc), scale(_gui_scale), mouse_capture_widget(-1)
|
||||
Window::Window(WindowDesc &desc) : window_desc(desc), scale(_gui_scale), mouse_capture_widget(-1)
|
||||
{
|
||||
this->z_position = _z_windows.insert(_z_windows.end(), this);
|
||||
}
|
||||
|
@ -2435,7 +2435,7 @@ static bool MaybeBringWindowToFront(Window *w)
|
|||
for (; !it.IsEnd(); ++it) {
|
||||
Window *u = *it;
|
||||
/* A modal child will prevent the activation of the parent window */
|
||||
if (u->parent == w && (u->window_desc->flags & WDF_MODAL)) {
|
||||
if (u->parent == w && (u->window_desc.flags & WDF_MODAL)) {
|
||||
u->SetWhiteBorder();
|
||||
u->SetDirty();
|
||||
return false;
|
||||
|
@ -2549,7 +2549,7 @@ void HandleToolbarHotkey(int hotkey)
|
|||
|
||||
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
||||
if (w != nullptr) {
|
||||
if (w->window_desc->hotkeys != nullptr) {
|
||||
if (w->window_desc.hotkeys != nullptr) {
|
||||
if (hotkey >= 0 && w->OnHotkey(hotkey) == ES_HANDLED) return;
|
||||
}
|
||||
}
|
||||
|
@ -2593,8 +2593,8 @@ void HandleKeypress(uint keycode, char32_t key)
|
|||
/* Call the event, start with the uppermost window, but ignore the toolbar. */
|
||||
for (Window *w : Window::IterateFromFront()) {
|
||||
if (w->window_class == WC_MAIN_TOOLBAR) continue;
|
||||
if (w->window_desc->hotkeys != nullptr) {
|
||||
int hotkey = w->window_desc->hotkeys->CheckMatch(keycode);
|
||||
if (w->window_desc.hotkeys != nullptr) {
|
||||
int hotkey = w->window_desc.hotkeys->CheckMatch(keycode);
|
||||
if (hotkey >= 0 && w->OnHotkey(hotkey) == ES_HANDLED) return;
|
||||
}
|
||||
if (w->OnKeyPress(key, keycode) == ES_HANDLED) return;
|
||||
|
@ -2603,8 +2603,8 @@ void HandleKeypress(uint keycode, char32_t key)
|
|||
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
||||
/* When there is no toolbar w is null, check for that */
|
||||
if (w != nullptr) {
|
||||
if (w->window_desc->hotkeys != nullptr) {
|
||||
int hotkey = w->window_desc->hotkeys->CheckMatch(keycode);
|
||||
if (w->window_desc.hotkeys != nullptr) {
|
||||
int hotkey = w->window_desc.hotkeys->CheckMatch(keycode);
|
||||
if (hotkey >= 0 && w->OnHotkey(hotkey) == ES_HANDLED) return;
|
||||
}
|
||||
if (w->OnKeyPress(key, keycode) == ES_HANDLED) return;
|
||||
|
@ -3243,7 +3243,7 @@ void CloseNonVitalWindows()
|
|||
{
|
||||
/* Note: the container remains stable, even when deleting windows. */
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if ((w->window_desc->flags & WDF_NO_CLOSE) == 0 &&
|
||||
if ((w->window_desc.flags & WDF_NO_CLOSE) == 0 &&
|
||||
(w->flags & WF_STICKY) == 0) { // do not delete windows which are 'pinned'
|
||||
|
||||
w->Close();
|
||||
|
@ -3262,7 +3262,7 @@ void CloseAllNonVitalWindows()
|
|||
{
|
||||
/* Note: the container remains stable, even when closing windows. */
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if ((w->window_desc->flags & WDF_NO_CLOSE) == 0) {
|
||||
if ((w->window_desc.flags & WDF_NO_CLOSE) == 0) {
|
||||
w->Close();
|
||||
}
|
||||
}
|
||||
|
@ -3287,7 +3287,7 @@ void CloseConstructionWindows()
|
|||
{
|
||||
/* Note: the container remains stable, even when deleting windows. */
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if (w->window_desc->flags & WDF_CONSTRUCTION) {
|
||||
if (w->window_desc.flags & WDF_CONSTRUCTION) {
|
||||
w->Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ protected:
|
|||
virtual ~Window();
|
||||
|
||||
public:
|
||||
Window(WindowDesc *desc);
|
||||
Window(WindowDesc &desc);
|
||||
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
*/
|
||||
inline void *operator new[](size_t size) = delete;
|
||||
|
||||
WindowDesc *window_desc; ///< Window description
|
||||
WindowDesc &window_desc; ///< Window description
|
||||
WindowFlags flags; ///< Window flags
|
||||
WindowClass window_class; ///< Window class
|
||||
WindowNumber window_number; ///< Window number within the window class
|
||||
|
@ -990,7 +990,7 @@ inline const NWID *Window::GetWidget(WidgetID widnum) const
|
|||
class PickerWindowBase : public Window {
|
||||
|
||||
public:
|
||||
PickerWindowBase(WindowDesc *desc, Window *parent) : Window(desc)
|
||||
PickerWindowBase(WindowDesc &desc, Window *parent) : Window(desc)
|
||||
{
|
||||
this->parent = parent;
|
||||
}
|
||||
|
@ -1016,9 +1016,9 @@ Window *BringWindowToFrontById(WindowClass cls, T number)
|
|||
* @return %Window pointer of the newly created window, or the existing one if \a return_existing is set, or \c nullptr.
|
||||
*/
|
||||
template <typename Wcls>
|
||||
Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing = false)
|
||||
Wcls *AllocateWindowDescFront(WindowDesc &desc, int window_number, bool return_existing = false)
|
||||
{
|
||||
Wcls *w = static_cast<Wcls *>(BringWindowToFrontById(desc->cls, window_number));
|
||||
Wcls *w = static_cast<Wcls *>(BringWindowToFrontById(desc.cls, window_number));
|
||||
if (w != nullptr) return return_existing ? w : nullptr;
|
||||
return new Wcls(desc, window_number);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue