mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-15 15:19:52 +00:00
Codechange: make WindowClass a scoped enum
This commit is contained in:
@@ -27,3 +27,114 @@ GSWindow.WN_NETWORK_WINDOW_CONTENT_LIST <- GSWindow.NetworkWindowNumber.ContentL
|
||||
GSWindow.WN_NETWORK_WINDOW_START <- GSWindow.NetworkWindowNumber.StartServer;
|
||||
GSWindow.WN_NETWORK_STATUS_WINDOW_JOIN <- GSWindow.NetworkStatusWindowNumber.Join;
|
||||
GSWindow.WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD <- GSWindow.NetworkStatusWindowNumber.ContentDownload;
|
||||
|
||||
GSWindow.WC_NONE <- GSWindow.WindowClass.None;
|
||||
GSWindow.WC_MAIN_WINDOW <- GSWindow.WindowClass.MainWindow;
|
||||
GSWindow.WC_MAIN_TOOLBAR <- GSWindow.WindowClass.MainToolbar;
|
||||
GSWindow.WC_STATUS_BAR <- GSWindow.WindowClass.Statusbar;
|
||||
GSWindow.WC_BUILD_TOOLBAR <- GSWindow.WindowClass.BuildToolbar;
|
||||
GSWindow.WC_SCEN_BUILD_TOOLBAR <- GSWindow.WindowClass.ScenarioBuildToolbar;
|
||||
GSWindow.WC_BUILD_TREES <- GSWindow.WindowClass.BuildTrees;
|
||||
GSWindow.WC_TRANSPARENCY_TOOLBAR <- GSWindow.WindowClass.TransparencyToolbar;
|
||||
GSWindow.WC_BUILD_SIGNAL <- GSWindow.WindowClass.BuildSignal;
|
||||
GSWindow.WC_SMALLMAP <- GSWindow.WindowClass.SmallMap;
|
||||
GSWindow.WC_ERRMSG <- GSWindow.WindowClass.ErrorMessage;
|
||||
GSWindow.WC_TOOLTIPS <- GSWindow.WindowClass.ToolTips;
|
||||
GSWindow.WC_QUERY_STRING <- GSWindow.WindowClass.QueryString;
|
||||
GSWindow.WC_CONFIRM_POPUP_QUERY <- GSWindow.WindowClass.ConfirmPopupQuery;
|
||||
GSWindow.WC_GOAL_QUESTION <- GSWindow.WindowClass.GoalQuestion;
|
||||
GSWindow.WC_SAVELOAD <- GSWindow.WindowClass.SaveLoad;
|
||||
GSWindow.WC_LAND_INFO <- GSWindow.WindowClass.LandInfo;
|
||||
GSWindow.WC_DROPDOWN_MENU <- GSWindow.WindowClass.DropdownMenu;
|
||||
GSWindow.WC_OSK <- GSWindow.WindowClass.OnScreenKeyboard;
|
||||
GSWindow.WC_SET_DATE <- GSWindow.WindowClass.SetDate;
|
||||
GSWindow.WC_SCRIPT_SETTINGS <- GSWindow.WindowClass.ScriptSettings;
|
||||
GSWindow.WC_GRF_PARAMETERS <- GSWindow.WindowClass.NewGRFParameters;
|
||||
GSWindow.WC_TEXTFILE <- GSWindow.WindowClass.Textfile;
|
||||
GSWindow.WC_TOWN_AUTHORITY <- GSWindow.WindowClass.TownAuthority;
|
||||
GSWindow.WC_VEHICLE_DETAILS <- GSWindow.WindowClass.VehicleDetails;
|
||||
GSWindow.WC_VEHICLE_REFIT <- GSWindow.WindowClass.VehicleRefit;
|
||||
GSWindow.WC_VEHICLE_ORDERS <- GSWindow.WindowClass.VehicleOrders;
|
||||
GSWindow.WC_REPLACE_VEHICLE <- GSWindow.WindowClass.ReplaceVehicle;
|
||||
GSWindow.WC_VEHICLE_TIMETABLE <- GSWindow.WindowClass.VehicleTimetable;
|
||||
GSWindow.WC_COMPANY_COLOUR <- GSWindow.WindowClass.CompanyLivery;
|
||||
GSWindow.WC_COMPANY_MANAGER_FACE <- GSWindow.WindowClass.CompanyManagerFace;
|
||||
GSWindow.WC_SELECT_STATION <- GSWindow.WindowClass.JoinStation;
|
||||
GSWindow.WC_NEWS_WINDOW <- GSWindow.WindowClass.News;
|
||||
GSWindow.WC_TOWN_DIRECTORY <- GSWindow.WindowClass.TownDirectory;
|
||||
GSWindow.WC_SUBSIDIES_LIST <- GSWindow.WindowClass.SubsidyList;
|
||||
GSWindow.WC_INDUSTRY_DIRECTORY <- GSWindow.WindowClass.IndustryDirectory;
|
||||
GSWindow.WC_MESSAGE_HISTORY <- GSWindow.WindowClass.MessageHistory;
|
||||
GSWindow.WC_SIGN_LIST <- GSWindow.WindowClass.SignList;
|
||||
GSWindow.WC_SCRIPT_LIST <- GSWindow.WindowClass.ScriptList;
|
||||
GSWindow.WC_GOALS_LIST <- GSWindow.WindowClass.GoalList;
|
||||
GSWindow.WC_STORY_BOOK <- GSWindow.WindowClass.StoryBook;
|
||||
GSWindow.WC_STATION_LIST <- GSWindow.WindowClass.StationList;
|
||||
GSWindow.WC_TRAINS_LIST <- GSWindow.WindowClass.TrainList;
|
||||
GSWindow.WC_ROADVEH_LIST <- GSWindow.WindowClass.RoadVehicleList;
|
||||
GSWindow.WC_SHIPS_LIST <- GSWindow.WindowClass.ShipList;
|
||||
GSWindow.WC_AIRCRAFT_LIST <- GSWindow.WindowClass.AircraftList;
|
||||
GSWindow.WC_TOWN_VIEW <- GSWindow.WindowClass.TownView;
|
||||
GSWindow.WC_VEHICLE_VIEW <- GSWindow.WindowClass.VehicleView;
|
||||
GSWindow.WC_STATION_VIEW <- GSWindow.WindowClass.StationView;
|
||||
GSWindow.WC_VEHICLE_DEPOT <- GSWindow.WindowClass.VehicleDepot;
|
||||
GSWindow.WC_WAYPOINT_VIEW <- GSWindow.WindowClass.WaypointView;
|
||||
GSWindow.WC_INDUSTRY_VIEW <- GSWindow.WindowClass.IndustryView;
|
||||
GSWindow.WC_COMPANY <- GSWindow.WindowClass.Company;
|
||||
GSWindow.WC_BUILD_OBJECT <- GSWindow.WindowClass.BuildObject;
|
||||
GSWindow.WC_BUILD_HOUSE <- GSWindow.WindowClass.BuildHouse;
|
||||
GSWindow.WC_BUILD_VEHICLE <- GSWindow.WindowClass.BuildVehicle;
|
||||
GSWindow.WC_BUILD_BRIDGE <- GSWindow.WindowClass.BuildBridge;
|
||||
GSWindow.WC_BUILD_STATION <- GSWindow.WindowClass.BuildStation;
|
||||
GSWindow.WC_BUS_STATION <- GSWindow.WindowClass.BuildBusStation;
|
||||
GSWindow.WC_TRUCK_STATION <- GSWindow.WindowClass.BuildTruckStation;
|
||||
GSWindow.WC_BUILD_DEPOT <- GSWindow.WindowClass.BuildDepot;
|
||||
GSWindow.WC_BUILD_WAYPOINT <- GSWindow.WindowClass.BuildWaypoint;
|
||||
GSWindow.WC_FOUND_TOWN <- GSWindow.WindowClass.FoundTown;
|
||||
GSWindow.WC_BUILD_INDUSTRY <- GSWindow.WindowClass.BuildIndustry;
|
||||
GSWindow.WC_SELECT_GAME <- GSWindow.WindowClass.SelectGame;
|
||||
GSWindow.WC_SCEN_LAND_GEN <- GSWindow.WindowClass.ScenarioGenerateLandscape;
|
||||
GSWindow.WC_GENERATE_LANDSCAPE <- GSWindow.WindowClass.GenerateLandscape;
|
||||
GSWindow.WC_MODAL_PROGRESS <- GSWindow.WindowClass.ModalProgress;
|
||||
GSWindow.WC_NETWORK_WINDOW <- GSWindow.WindowClass.Network;
|
||||
GSWindow.WC_CLIENT_LIST <- GSWindow.WindowClass.NetworkClientList;
|
||||
GSWindow.WC_NETWORK_STATUS_WINDOW <- GSWindow.WindowClass.NetworkStatus;
|
||||
GSWindow.WC_NETWORK_ASK_RELAY <- GSWindow.WindowClass.NetworkAskRelay;
|
||||
GSWindow.WC_NETWORK_ASK_SURVEY <- GSWindow.WindowClass.NetworkAskSurvey;
|
||||
GSWindow.WC_SEND_NETWORK_MSG <- GSWindow.WindowClass.NetworkChat;
|
||||
GSWindow.WC_INDUSTRY_CARGOES <- GSWindow.WindowClass.IndustryCargoes;
|
||||
GSWindow.WC_GRAPH_LEGEND <- GSWindow.WindowClass.GraphLegend;
|
||||
GSWindow.WC_FINANCES <- GSWindow.WindowClass.Finances;
|
||||
GSWindow.WC_INCOME_GRAPH <- GSWindow.WindowClass.IncomeGraph;
|
||||
GSWindow.WC_OPERATING_PROFIT <- GSWindow.WindowClass.OperatingProfitGraph;
|
||||
GSWindow.WC_DELIVERED_CARGO <- GSWindow.WindowClass.DeliveredCargoGraph;
|
||||
GSWindow.WC_PERFORMANCE_HISTORY <- GSWindow.WindowClass.PerformanceGraph;
|
||||
GSWindow.WC_COMPANY_VALUE <- GSWindow.WindowClass.CompanyValueGraph;
|
||||
GSWindow.WC_COMPANY_LEAGUE <- GSWindow.WindowClass.CompanyLeague;
|
||||
GSWindow.WC_PAYMENT_RATES <- GSWindow.WindowClass.CargoPaymentRatesGraph;
|
||||
GSWindow.WC_PERFORMANCE_DETAIL <- GSWindow.WindowClass.PerformanceDetail;
|
||||
GSWindow.WC_INDUSTRY_PRODUCTION <- GSWindow.WindowClass.IndustryProductionGraph;
|
||||
GSWindow.WC_TOWN_CARGO_GRAPH <- GSWindow.WindowClass.TownCargoGraph;
|
||||
GSWindow.WC_COMPANY_INFRASTRUCTURE <- GSWindow.WindowClass.CompanyInfrastructure;
|
||||
GSWindow.WC_BUY_COMPANY <- GSWindow.WindowClass.BuyCompany;
|
||||
GSWindow.WC_ENGINE_PREVIEW <- GSWindow.WindowClass.EnginePreview;
|
||||
GSWindow.WC_MUSIC_WINDOW <- GSWindow.WindowClass.Music;
|
||||
GSWindow.WC_MUSIC_TRACK_SELECTION <- GSWindow.WindowClass.MusicTrackSelection;
|
||||
GSWindow.WC_GAME_OPTIONS <- GSWindow.WindowClass.GameOptions;
|
||||
GSWindow.WC_CUSTOM_CURRENCY <- GSWindow.WindowClass.CustomCurrenty;
|
||||
GSWindow.WC_CHEATS <- GSWindow.WindowClass.Cheat;
|
||||
GSWindow.WC_EXTRA_VIEWPORT <- GSWindow.WindowClass.ExtraViewport;
|
||||
GSWindow.WC_CONSOLE <- GSWindow.WindowClass.Console;
|
||||
GSWindow.WC_BOOTSTRAP <- GSWindow.WindowClass.Bootstrap;
|
||||
GSWindow.WC_HIGHSCORE <- GSWindow.WindowClass.Highscore;
|
||||
GSWindow.WC_ENDSCREEN <- GSWindow.WindowClass.Endscreen;
|
||||
GSWindow.WC_SCRIPT_DEBUG <- GSWindow.WindowClass.ScriptDebug;
|
||||
GSWindow.WC_NEWGRF_INSPECT <- GSWindow.WindowClass.NewGRFInspect;
|
||||
GSWindow.WC_SPRITE_ALIGNER <- GSWindow.WindowClass.SpriteAligner;
|
||||
GSWindow.WC_LINKGRAPH_LEGEND <- GSWindow.WindowClass.LinkGraphLegend;
|
||||
GSWindow.WC_SAVE_PRESET <- GSWindow.WindowClass.SavePreset;
|
||||
GSWindow.WC_FRAMERATE_DISPLAY <- GSWindow.WindowClass.FramerateDisplay;
|
||||
GSWindow.WC_FRAMETIME_GRAPH <- GSWindow.WindowClass.FrametimeGraph;
|
||||
GSWindow.WC_SCREENSHOT <- GSWindow.WindowClass.Screenshot;
|
||||
GSWindow.WC_HELPWIN <- GSWindow.WindowClass.Help;
|
||||
GSWindow.WC_INVALID <- GSWindow.WindowClass.Invalid;
|
||||
|
||||
+5
-5
@@ -65,7 +65,7 @@
|
||||
c->ai_instance->LoadOnStack(config->GetToLoadData());
|
||||
config->SetToLoadData(nullptr);
|
||||
|
||||
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, -1);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptDebug, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
c->ai_info = nullptr;
|
||||
c->ai_config.reset();
|
||||
|
||||
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, -1);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptDebug, -1);
|
||||
}
|
||||
|
||||
/* static */ void AI::Pause(CompanyID company)
|
||||
@@ -307,9 +307,9 @@
|
||||
AI::scanner_library->RescanDir();
|
||||
ResetConfig();
|
||||
|
||||
InvalidateWindowData(WC_SCRIPT_LIST, 0, 1);
|
||||
SetWindowClassesDirty(WC_SCRIPT_DEBUG);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_SETTINGS);
|
||||
InvalidateWindowData(WindowClass::ScriptList, 0, 1);
|
||||
SetWindowClassesDirty(WindowClass::ScriptDebug);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -85,7 +85,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_ai_config_widgets =
|
||||
/** Window definition for the configure AI window. */
|
||||
static WindowDesc _ai_config_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WindowClass::GameOptions, WindowClass::None,
|
||||
{},
|
||||
_nested_ai_config_widgets
|
||||
);
|
||||
@@ -111,8 +111,8 @@ struct AIConfigWindow : public Window {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
||||
CloseWindowByClass(WindowClass::ScriptList);
|
||||
CloseWindowByClass(WindowClass::ScriptSettings);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ struct AIConfigWindow : public Window {
|
||||
/** Open the AI config window. */
|
||||
void ShowAIConfigWindow()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
new AIConfigWindow();
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -427,10 +427,10 @@ static void CheckIfAircraftNeedsService(Aircraft *v)
|
||||
/* only goto depot if the target airport has a depot */
|
||||
if (st->airport.HasHangar() && CanVehicleUseStation(v, st)) {
|
||||
v->current_order.MakeGoToDepot(st->index, OrderDepotTypeFlag::Service);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
} else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||
v->current_order.MakeDummy();
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,8 +470,8 @@ void Aircraft::OnNewEconomyDay()
|
||||
|
||||
SubtractMoneyFromCompanyFract(this->owner, cost);
|
||||
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, this->index);
|
||||
SetWindowClassesDirty(WindowClass::AircraftList);
|
||||
}
|
||||
|
||||
static void HelicopterTickHandler(Aircraft *v)
|
||||
@@ -683,7 +683,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
|
||||
/* updates statusbar only if speed have changed to save CPU time */
|
||||
if (spd != v->cur_speed) {
|
||||
v->cur_speed = spd;
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
/* Adjust distance moved by plane speed setting */
|
||||
@@ -1497,8 +1497,8 @@ void AircraftLeaveHangar(Aircraft *v, Direction exit_dir)
|
||||
VehicleServiceInDepot(v);
|
||||
v->LeaveUnbunchingDepot();
|
||||
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, v->tile);
|
||||
SetWindowClassesDirty(WindowClass::AircraftList);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1583,7 +1583,7 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass *
|
||||
v->date_of_last_service_newgrf = TimerGameCalendar::date;
|
||||
v->breakdowns_since_last_service = 0;
|
||||
v->reliability = v->GetEngine()->reliability;
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, v->index);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -2077,7 +2077,7 @@ static void AircraftHandleDestTooFar(Aircraft *v, bool too_far)
|
||||
if (too_far) {
|
||||
if (!v->flags.Test(VehicleAirFlag::DestinationTooFar)) {
|
||||
v->flags.Set(VehicleAirFlag::DestinationTooFar);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
AI::NewEvent(v->owner, new ScriptEventAircraftDestTooFar(v->index));
|
||||
if (v->owner == _local_company) {
|
||||
/* Post a news message. */
|
||||
@@ -2090,7 +2090,7 @@ static void AircraftHandleDestTooFar(Aircraft *v, bool too_far)
|
||||
if (v->flags.Test(VehicleAirFlag::DestinationTooFar)) {
|
||||
/* Not too far anymore, clear flag and message. */
|
||||
v->flags.Reset(VehicleAirFlag::DestinationTooFar);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
DeleteVehicleNews(v->index, AdviceType::AircraftDestinationTooFar);
|
||||
}
|
||||
}
|
||||
@@ -2196,7 +2196,7 @@ void UpdateAirplanesOnNewStation(const Station *st)
|
||||
if (o->IsType(OT_GOTO_DEPOT) && !o->GetDepotOrderType().Test(OrderDepotTypeFlag::PartOfOrders) && o->GetDestination() == st->index &&
|
||||
(!st->airport.HasHangar() || !CanVehicleUseStation(v, st))) {
|
||||
o->MakeDummy();
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
v->pos = v->previous_pos = AircraftGetEntryPoint(v, ap, rotation);
|
||||
UpdateAircraftCache(v);
|
||||
|
||||
+8
-8
@@ -96,7 +96,7 @@ struct BuildAirToolbarWindow : Window {
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WindowClass::ScenarioGenerateLandscape, 0, false);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ struct BuildAirToolbarWindow : Window {
|
||||
bool can_build = CanBuildVehicleInfrastructure(VehicleType::Aircraft);
|
||||
this->SetWidgetDisabledState(WID_AT_AIRPORT, !can_build);
|
||||
if (!can_build) {
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_AIR);
|
||||
|
||||
/* Show in the tooltip why this button is disabled. */
|
||||
this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
|
||||
@@ -179,8 +179,8 @@ struct BuildAirToolbarWindow : Window {
|
||||
|
||||
this->RaiseButtons();
|
||||
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_AIR);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +218,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_air_toolbar_widgets
|
||||
/** Window definition for the air toolbar. */
|
||||
static WindowDesc _air_toolbar_desc(
|
||||
WindowPosition::Manual, "toolbar_air", 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::BuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_air_toolbar_widgets,
|
||||
&BuildAirToolbarWindow::hotkeys
|
||||
@@ -235,7 +235,7 @@ Window *ShowBuildAirToolbar()
|
||||
{
|
||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
CloseWindowByClass(WindowClass::BuildToolbar);
|
||||
return AllocateWindowDescFront<BuildAirToolbarWindow>(_air_toolbar_desc, TRANSPORT_AIR);
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
this->PickerWindowBase::Close();
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_airport_widget
|
||||
/** Window definition for the airport build window. */
|
||||
static WindowDesc _build_airport_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildStation, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_airport_widgets
|
||||
);
|
||||
|
||||
@@ -853,7 +853,7 @@ CommandCost CmdSetAutoReplace(DoCommandFlags flags, GroupID id_g, EngineID old_e
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
GroupStatistics::UpdateAutoreplace(_current_company);
|
||||
if (IsLocalCompany()) SetWindowDirty(WC_REPLACE_VEHICLE, Engine::Get(old_engine_type)->type);
|
||||
if (IsLocalCompany()) SetWindowDirty(WindowClass::ReplaceVehicle, Engine::Get(old_engine_type)->type);
|
||||
|
||||
const VehicleType vt = Engine::Get(old_engine_type)->type;
|
||||
SetWindowDirty(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).ToWindowNumber());
|
||||
|
||||
@@ -58,7 +58,7 @@ void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
|
||||
/* We don't have any of this engine type.
|
||||
* Either we just sold the last one, we build a new one or we stopped replacing it.
|
||||
* In all cases, we need to update the left list */
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, Engine::Get(e)->type, 1);
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, Engine::Get(e)->type, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
|
||||
*/
|
||||
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
|
||||
{
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // The build windows needs updating as well
|
||||
}
|
||||
|
||||
static const StringID _start_replace_dropdown[] = {
|
||||
@@ -599,8 +599,8 @@ public:
|
||||
Engine *engine = Engine::Get(item.variant_id);
|
||||
engine->display_flags.Flip(EngineDisplayFlag::IsFolded);
|
||||
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, this->window_number, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, this->window_number, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // The build windows needs updating as well
|
||||
return;
|
||||
}
|
||||
if (!item.flags.Test(EngineDisplayFlag::Shaded)) e = item.engine_id;
|
||||
@@ -763,7 +763,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_replace_rail_vehicle
|
||||
/** Window definition for the replace rail vehicle window. */
|
||||
static WindowDesc _replace_rail_vehicle_desc(
|
||||
WindowPosition::Automatic, "replace_vehicle_train", 500, 140,
|
||||
WC_REPLACE_VEHICLE, WC_NONE,
|
||||
WindowClass::ReplaceVehicle, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_replace_rail_vehicle_widgets
|
||||
);
|
||||
@@ -822,7 +822,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_replace_road_vehicle
|
||||
/** Window definition for the replace road vehicle window. */
|
||||
static WindowDesc _replace_road_vehicle_desc(
|
||||
WindowPosition::Automatic, "replace_vehicle_road", 500, 140,
|
||||
WC_REPLACE_VEHICLE, WC_NONE,
|
||||
WindowClass::ReplaceVehicle, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_replace_road_vehicle_widgets
|
||||
);
|
||||
@@ -877,7 +877,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_replace_vehicle_widg
|
||||
/** Window definition for the replace ship/aircraft window. */
|
||||
static WindowDesc _replace_vehicle_desc(
|
||||
WindowPosition::Automatic, "replace_vehicle", 456, 118,
|
||||
WC_REPLACE_VEHICLE, WC_NONE,
|
||||
WindowClass::ReplaceVehicle, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_replace_vehicle_widgets
|
||||
);
|
||||
@@ -889,7 +889,7 @@ static WindowDesc _replace_vehicle_desc(
|
||||
*/
|
||||
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
||||
{
|
||||
CloseWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
||||
CloseWindowById(WindowClass::ReplaceVehicle, vehicletype);
|
||||
switch (vehicletype) {
|
||||
case VehicleType::Train: new ReplaceVehicleWindow(_replace_rail_vehicle_desc, vehicletype, id_g); break;
|
||||
case VehicleType::Road: new ReplaceVehicleWindow(_replace_road_vehicle_desc, vehicletype, id_g); break;
|
||||
|
||||
@@ -43,7 +43,7 @@ static constexpr std::initializer_list<NWidgetPart> _background_widgets = {
|
||||
*/
|
||||
static WindowDesc _background_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_BOOTSTRAP, WC_NONE,
|
||||
WindowClass::Bootstrap, WindowClass::None,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_background_widgets
|
||||
);
|
||||
@@ -79,7 +79,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_bootstrap_errmsg_wid
|
||||
/** Window description for the error window. */
|
||||
static WindowDesc _bootstrap_errmsg_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_BOOTSTRAP, WC_NONE,
|
||||
WindowClass::Bootstrap, WindowClass::None,
|
||||
{WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose},
|
||||
_nested_bootstrap_errmsg_widgets
|
||||
);
|
||||
@@ -136,7 +136,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_bootstrap_download_s
|
||||
/** Window description for the download window */
|
||||
static WindowDesc _bootstrap_download_status_window_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WindowClass::NetworkStatus, WindowClass::None,
|
||||
{WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose},
|
||||
_nested_bootstrap_download_status_window_widgets
|
||||
);
|
||||
@@ -188,7 +188,7 @@ static constexpr std::initializer_list<NWidgetPart> _bootstrap_query_widgets = {
|
||||
/** The window description for the query. */
|
||||
static WindowDesc _bootstrap_query_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_CONFIRM_POPUP_QUERY, WC_NONE,
|
||||
WindowClass::ConfirmPopupQuery, WindowClass::None,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_bootstrap_query_widgets
|
||||
);
|
||||
|
||||
+3
-3
@@ -178,7 +178,7 @@ public:
|
||||
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->SetString((transport_type == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION);
|
||||
this->FinishInitNested(transport_type); // Initializes 'this->icon_width'.
|
||||
|
||||
this->parent = FindWindowById(WC_BUILD_TOOLBAR, transport_type);
|
||||
this->parent = FindWindowById(WindowClass::BuildToolbar, transport_type);
|
||||
this->bridges.SetListing(BuildBridgeWindow::last_sorting);
|
||||
this->bridges.SetSortFuncs(BuildBridgeWindow::sorter_funcs);
|
||||
this->bridges.NeedResort();
|
||||
@@ -351,7 +351,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_bridge_widgets
|
||||
/** Window definition for the rail bridge selection window. */
|
||||
static WindowDesc _build_bridge_desc(
|
||||
WindowPosition::Automatic, "build_bridge", 200, 114,
|
||||
WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildBridge, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_bridge_widgets
|
||||
);
|
||||
@@ -369,7 +369,7 @@ static WindowDesc _build_bridge_desc(
|
||||
*/
|
||||
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, RailType railtype, RoadType roadtype)
|
||||
{
|
||||
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||
CloseWindowByClass(WindowClass::BuildBridge);
|
||||
|
||||
/* The bridge length without ramps. */
|
||||
const uint bridge_len = GetTunnelBridgeLength(start, end);
|
||||
|
||||
@@ -1713,8 +1713,8 @@ struct BuildVehicleWindow : Window {
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, this->vehicle_type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, this->vehicle_type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // The build windows needs updating as well
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1748,8 +1748,8 @@ struct BuildVehicleWindow : Window {
|
||||
Engine *engine = Engine::Get(item.variant_id);
|
||||
engine->display_flags.Flip(EngineDisplayFlag::IsFolded);
|
||||
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, this->vehicle_type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, this->vehicle_type, 0); // Update the autoreplace window
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // The build windows needs updating as well
|
||||
return;
|
||||
}
|
||||
if (!item.flags.Test(EngineDisplayFlag::Shaded)) e = item.engine_id;
|
||||
@@ -1999,7 +1999,7 @@ struct BuildVehicleWindow : Window {
|
||||
if (reopen) {
|
||||
ReplaceDropDownList(this, this->BuildBadgeConfigurationList(), -1);
|
||||
} else {
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
}
|
||||
|
||||
/* We need to refresh if a filter is removed. */
|
||||
@@ -2042,7 +2042,7 @@ struct BuildVehicleWindow : Window {
|
||||
/** Window definition for the build vehicle window. */
|
||||
static WindowDesc _build_vehicle_desc(
|
||||
WindowPosition::Automatic, "build_vehicle", 240, 268,
|
||||
WC_BUILD_VEHICLE, WC_NONE,
|
||||
WindowClass::BuildVehicle, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_vehicle_widgets,
|
||||
&BuildVehicleWindow::hotkeys
|
||||
@@ -2058,7 +2058,7 @@ void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
|
||||
|
||||
assert(IsCompanyBuildableVehicleType(type));
|
||||
|
||||
CloseWindowById(WC_BUILD_VEHICLE, num);
|
||||
CloseWindowById(WindowClass::BuildVehicle, num);
|
||||
|
||||
new BuildVehicleWindow(_build_vehicle_desc, tile, type);
|
||||
}
|
||||
|
||||
+10
-10
@@ -92,7 +92,7 @@ static int32_t ClickChangeCompanyCheat(int32_t new_value, int32_t change_directi
|
||||
static int32_t ClickSetProdCheat(int32_t new_value, int32_t)
|
||||
{
|
||||
_cheats.setup_prod.value = (new_value != 0);
|
||||
InvalidateWindowClassesData(WC_INDUSTRY_VIEW);
|
||||
InvalidateWindowClassesData(WindowClass::IndustryView);
|
||||
return _cheats.setup_prod.value;
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ static int32_t ClickChangeDateCheat(int32_t new_value, int32_t)
|
||||
}
|
||||
|
||||
CalendarEnginesMonthlyLoop();
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
InvalidateWindowClassesData(WC_BUILD_STATION, 0);
|
||||
InvalidateWindowClassesData(WC_BUS_STATION, 0);
|
||||
InvalidateWindowClassesData(WC_TRUCK_STATION, 0);
|
||||
InvalidateWindowClassesData(WC_BUILD_OBJECT, 0);
|
||||
InvalidateWindowClassesData(WC_FINANCES, 0);
|
||||
SetWindowDirty(WindowClass::Statusbar, 0);
|
||||
InvalidateWindowClassesData(WindowClass::BuildStation, 0);
|
||||
InvalidateWindowClassesData(WindowClass::BuildBusStation, 0);
|
||||
InvalidateWindowClassesData(WindowClass::BuildTruckStation, 0);
|
||||
InvalidateWindowClassesData(WindowClass::BuildObject, 0);
|
||||
InvalidateWindowClassesData(WindowClass::Finances, 0);
|
||||
ResetSignalVariant();
|
||||
return TimerGameCalendar::year.base();
|
||||
}
|
||||
@@ -163,7 +163,7 @@ static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
|
||||
ReloadNewGRFData();
|
||||
|
||||
/* The smallmap uses an index from heightlevels to colours. Trigger rebuilding it. */
|
||||
InvalidateWindowClassesData(WC_SMALLMAP, 2);
|
||||
InvalidateWindowClassesData(WindowClass::SmallMap, 2);
|
||||
|
||||
return _settings_game.construction.map_height_limit;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ struct CheatWindow : Window {
|
||||
/** Window description of the cheats GUI. */
|
||||
static WindowDesc _cheats_desc(
|
||||
WindowPosition::Automatic, "cheats", 0, 0,
|
||||
WC_CHEATS, WC_NONE,
|
||||
WindowClass::Cheat, WindowClass::None,
|
||||
{},
|
||||
_nested_cheat_widgets
|
||||
);
|
||||
@@ -650,6 +650,6 @@ static WindowDesc _cheats_desc(
|
||||
/** Open cheat window. */
|
||||
void ShowCheatWindow()
|
||||
{
|
||||
CloseWindowById(WC_CHEATS, 0);
|
||||
CloseWindowById(WindowClass::Cheat, 0);
|
||||
new CheatWindow(_cheats_desc);
|
||||
}
|
||||
|
||||
+38
-38
@@ -76,7 +76,7 @@ Company::Company(CompanyID index, StringID name_1, bool is_ai) : CompanyPool::Po
|
||||
this->tree_limit = (uint32_t)_settings_game.construction.tree_frame_burst << 16;
|
||||
this->build_object_limit = (uint32_t)_settings_game.construction.build_object_frame_burst << 16;
|
||||
|
||||
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, CompanyID::Invalid());
|
||||
InvalidateWindowData(WindowClass::PerformanceDetail, 0, CompanyID::Invalid());
|
||||
}
|
||||
|
||||
/** Close the associated company windows. */
|
||||
@@ -93,12 +93,12 @@ Company::~Company()
|
||||
*/
|
||||
void Company::PostDestructor(size_t index)
|
||||
{
|
||||
InvalidateWindowData(WC_GRAPH_LEGEND, 0, (int)index);
|
||||
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, (int)index);
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0);
|
||||
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
|
||||
InvalidateWindowData(WindowClass::GraphLegend, 0, static_cast<int>(index));
|
||||
InvalidateWindowData(WindowClass::PerformanceDetail, 0, static_cast<int>(index));
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, 0, 0);
|
||||
InvalidateWindowData(WindowClass::LinkGraphLegend, 0);
|
||||
/* If the currently shown error message has this company in it, then close it. */
|
||||
InvalidateWindowData(WC_ERRMSG, 0);
|
||||
InvalidateWindowData(WindowClass::ErrorMessage, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,15 +126,15 @@ void SetLocalCompany(CompanyID new_company)
|
||||
bool switching_company = _local_company != new_company;
|
||||
|
||||
/* Delete the chat window, if you were team chatting. */
|
||||
if (switching_company) InvalidateWindowData(WC_SEND_NETWORK_MSG, NetworkChatDestinationType::Team, _local_company);
|
||||
if (switching_company) InvalidateWindowData(WindowClass::NetworkChat, NetworkChatDestinationType::Team, _local_company);
|
||||
|
||||
assert(IsLocalCompany());
|
||||
|
||||
_current_company = _local_company = new_company;
|
||||
|
||||
if (switching_company) {
|
||||
InvalidateWindowClassesData(WC_COMPANY);
|
||||
InvalidateWindowClassesData(WC_VEHICLE_VIEW);
|
||||
InvalidateWindowClassesData(WindowClass::Company);
|
||||
InvalidateWindowClassesData(WindowClass::VehicleView);
|
||||
/* Delete any construction windows... */
|
||||
CloseConstructionWindows();
|
||||
/* Update the default rail based on most used */
|
||||
@@ -143,9 +143,9 @@ void SetLocalCompany(CompanyID new_company)
|
||||
|
||||
/* ... and redraw the whole screen. */
|
||||
MarkWholeScreenDirty();
|
||||
InvalidateWindowClassesData(WC_SIGN_LIST, -1);
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WC_COMPANY_COLOUR, -1);
|
||||
InvalidateWindowClassesData(WindowClass::SignList, -1);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
InvalidateWindowClassesData(WindowClass::CompanyLivery, -1);
|
||||
ResetVehicleColourMap();
|
||||
}
|
||||
|
||||
@@ -218,8 +218,8 @@ void InvalidateCompanyWindows(const Company *company)
|
||||
*/
|
||||
static const IntervalTimer<TimerWindow> invalidate_company_windows_interval(std::chrono::milliseconds(1), [](auto) {
|
||||
for (CompanyID cid : _dirty_company_finances) {
|
||||
if (cid == _local_company) SetWindowWidgetDirty(WC_STATUS_BAR, 0, WID_S_RIGHT);
|
||||
Window *w = FindWindowById(WC_FINANCES, cid);
|
||||
if (cid == _local_company) SetWindowWidgetDirty(WindowClass::Statusbar, 0, WID_S_RIGHT);
|
||||
Window *w = FindWindowById(WindowClass::Finances, cid);
|
||||
if (w != nullptr) {
|
||||
w->SetWidgetDirty(WID_CF_EXPS_PRICE3);
|
||||
w->SetWidgetDirty(WID_CF_OWN_VALUE);
|
||||
@@ -227,7 +227,7 @@ static const IntervalTimer<TimerWindow> invalidate_company_windows_interval(std:
|
||||
w->SetWidgetDirty(WID_CF_BALANCE_VALUE);
|
||||
w->SetWidgetDirty(WID_CF_MAXLOAN_VALUE);
|
||||
}
|
||||
SetWindowWidgetDirty(WC_COMPANY, cid, WID_C_DESC_COMPANY_VALUE);
|
||||
SetWindowWidgetDirty(WindowClass::Company, cid, WID_C_DESC_COMPANY_VALUE);
|
||||
}
|
||||
_dirty_company_finances.Reset();
|
||||
});
|
||||
@@ -633,11 +633,11 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = CompanyID::Invalid(
|
||||
|
||||
GeneratePresidentName(c);
|
||||
|
||||
SetWindowDirty(WC_GRAPH_LEGEND, 0);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
|
||||
SetWindowDirty(WindowClass::GraphLegend, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
InvalidateWindowData(WindowClass::LinkGraphLegend, 0);
|
||||
BuildOwnerLegend();
|
||||
InvalidateWindowData(WC_SMALLMAP, 0, 1);
|
||||
InvalidateWindowData(WindowClass::SmallMap, 0, 1);
|
||||
|
||||
if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
|
||||
|
||||
@@ -808,7 +808,7 @@ static const IntervalTimer<TimerGameEconomy> _economy_companies_yearly({TimerGam
|
||||
/* Move expenses to previous years. */
|
||||
std::rotate(std::rbegin(c->yearly_expenses), std::rbegin(c->yearly_expenses) + 1, std::rend(c->yearly_expenses));
|
||||
c->yearly_expenses[0].fill(0);
|
||||
InvalidateWindowData(WC_FINANCES, c->index);
|
||||
InvalidateWindowData(WindowClass::Finances, c->index);
|
||||
}
|
||||
|
||||
if (_settings_client.gui.show_finances && _local_company != COMPANY_SPECTATOR) {
|
||||
@@ -875,7 +875,7 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
|
||||
*/
|
||||
CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id)
|
||||
{
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0);
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, 0, 0);
|
||||
|
||||
switch (cca) {
|
||||
case CompanyCtrlAction::New: { // Create a new company
|
||||
@@ -888,7 +888,7 @@ CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyI
|
||||
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
|
||||
|
||||
/* Delete multiplayer progress bar */
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
Company *c = DoStartupNewCompany(false);
|
||||
|
||||
@@ -978,8 +978,8 @@ CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyI
|
||||
Game::NewEvent(new ScriptEventCompanyBankrupt(c_index));
|
||||
CompanyAdminRemove(c_index, (CompanyRemoveReason)reason);
|
||||
|
||||
if (StoryPage::GetNumItems() == 0 || Goal::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
if (StoryPage::GetNumItems() == 0 || Goal::GetNumItems() == 0) InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -987,9 +987,9 @@ CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyI
|
||||
default: return CMD_ERROR;
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_SETTINGS);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GameOptions);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptSettings);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptList);
|
||||
|
||||
return CommandCost();
|
||||
}
|
||||
@@ -1048,8 +1048,8 @@ CommandCost CmdCompanyAllowListCtrl(DoCommandFlags flags, CompanyAllowListCtrlAc
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
if (ExecuteAllowListCtrlAction(action, c, public_key)) {
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
SetWindowDirty(WC_COMPANY, _current_company);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
SetWindowDirty(WindowClass::Company, _current_company);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1159,15 +1159,15 @@ CommandCost CmdSetCompanyColour(DoCommandFlags flags, LiveryScheme scheme, bool
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
/* All graph related to companies use the company colour. */
|
||||
InvalidateWindowData(WC_INCOME_GRAPH, 0);
|
||||
InvalidateWindowData(WC_OPERATING_PROFIT, 0);
|
||||
InvalidateWindowData(WC_DELIVERED_CARGO, 0);
|
||||
InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
|
||||
InvalidateWindowData(WC_COMPANY_VALUE, 0);
|
||||
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
|
||||
InvalidateWindowData(WindowClass::IncomeGraph, 0);
|
||||
InvalidateWindowData(WindowClass::OperatingProfitGraph, 0);
|
||||
InvalidateWindowData(WindowClass::DeliveredCargoGraph, 0);
|
||||
InvalidateWindowData(WindowClass::PerformanceGraph, 0);
|
||||
InvalidateWindowData(WindowClass::CompanyValueGraph, 0);
|
||||
InvalidateWindowData(WindowClass::LinkGraphLegend, 0);
|
||||
/* The smallmap owner view also stores the company colours. */
|
||||
BuildOwnerLegend();
|
||||
InvalidateWindowData(WC_SMALLMAP, 0, 1);
|
||||
InvalidateWindowData(WindowClass::SmallMap, 0, 1);
|
||||
|
||||
/* Company colour data is indirectly cached. */
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
@@ -1216,7 +1216,7 @@ CommandCost CmdRenameCompany(DoCommandFlags flags, const std::string &text)
|
||||
c->name = text;
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_COMPANY, WID_C_COMPANY_NAME);
|
||||
InvalidateWindowClassesData(WindowClass::Company, WID_C_COMPANY_NAME);
|
||||
MarkWholeScreenDirty();
|
||||
CompanyAdminUpdate(c);
|
||||
|
||||
@@ -1270,7 +1270,7 @@ CommandCost CmdRenamePresident(DoCommandFlags flags, const std::string &text)
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_COMPANY, WID_C_PRESIDENT_NAME);
|
||||
InvalidateWindowClassesData(WindowClass::Company, WID_C_PRESIDENT_NAME);
|
||||
MarkWholeScreenDirty();
|
||||
CompanyAdminUpdate(c);
|
||||
|
||||
|
||||
+12
-12
@@ -567,7 +567,7 @@ Money CompanyFinancesWindow::max_money = INT32_MAX;
|
||||
/** Window definition for the company finances window. */
|
||||
static WindowDesc _company_finances_desc(
|
||||
WindowPosition::Automatic, "company_finances", 0, 0,
|
||||
WC_FINANCES, WC_NONE,
|
||||
WindowClass::Finances, WindowClass::None,
|
||||
{},
|
||||
_nested_company_finances_widgets
|
||||
);
|
||||
@@ -580,7 +580,7 @@ static WindowDesc _company_finances_desc(
|
||||
void ShowCompanyFinances(CompanyID company)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
if (BringWindowToFrontById(WC_FINANCES, company)) return;
|
||||
if (BringWindowToFrontById(WindowClass::Finances, company)) return;
|
||||
|
||||
new CompanyFinancesWindow(_company_finances_desc, company);
|
||||
}
|
||||
@@ -1108,14 +1108,14 @@ static constexpr std::initializer_list<NWidgetPart> _nested_select_company_liver
|
||||
/** Window definition for the company livery configuration window. */
|
||||
static WindowDesc _select_company_livery_desc(
|
||||
WindowPosition::Automatic, "company_colour_scheme", 0, 0,
|
||||
WC_COMPANY_COLOUR, WC_NONE,
|
||||
WindowClass::CompanyLivery, WindowClass::None,
|
||||
{},
|
||||
_nested_select_company_livery_widgets
|
||||
);
|
||||
|
||||
void ShowCompanyLiveryWindow(CompanyID company, GroupID group)
|
||||
{
|
||||
SelectCompanyLiveryWindow *w = (SelectCompanyLiveryWindow *)BringWindowToFrontById(WC_COMPANY_COLOUR, company);
|
||||
SelectCompanyLiveryWindow *w = (SelectCompanyLiveryWindow *)BringWindowToFrontById(WindowClass::CompanyLivery, company);
|
||||
if (w == nullptr) {
|
||||
new SelectCompanyLiveryWindow(_select_company_livery_desc, company, group);
|
||||
} else if (group != GroupID::Invalid()) {
|
||||
@@ -1530,7 +1530,7 @@ public:
|
||||
/** Company manager face selection window description */
|
||||
static WindowDesc _select_company_manager_face_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_COMPANY_MANAGER_FACE, WC_NONE,
|
||||
WindowClass::CompanyManagerFace, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_select_company_manager_face_widgets
|
||||
);
|
||||
@@ -1544,7 +1544,7 @@ static void DoSelectCompanyManagerFace(Window *parent)
|
||||
{
|
||||
if (!Company::IsValidID(parent->window_number)) return;
|
||||
|
||||
if (BringWindowToFrontById(WC_COMPANY_MANAGER_FACE, parent->window_number)) return;
|
||||
if (BringWindowToFrontById(WindowClass::CompanyManagerFace, parent->window_number)) return;
|
||||
new SelectCompanyManagerFaceWindow(_select_company_manager_face_desc, parent);
|
||||
}
|
||||
|
||||
@@ -1838,7 +1838,7 @@ struct CompanyInfrastructureWindow : Window
|
||||
/** Window definition for the company infrastructure statistics window. */
|
||||
static WindowDesc _company_infrastructure_desc(
|
||||
WindowPosition::Automatic, "company_infrastructure", 0, 0,
|
||||
WC_COMPANY_INFRASTRUCTURE, WC_NONE,
|
||||
WindowClass::CompanyInfrastructure, WindowClass::None,
|
||||
{},
|
||||
_nested_company_infrastructure_widgets
|
||||
);
|
||||
@@ -2318,7 +2318,7 @@ struct CompanyWindow : Window
|
||||
/** Window definition for the company window. */
|
||||
static WindowDesc _company_desc(
|
||||
WindowPosition::Automatic, "company", 0, 0,
|
||||
WC_COMPANY, WC_NONE,
|
||||
WindowClass::Company, WindowClass::None,
|
||||
{},
|
||||
_nested_company_widgets
|
||||
);
|
||||
@@ -2340,8 +2340,8 @@ void ShowCompany(CompanyID company)
|
||||
*/
|
||||
void DirtyCompanyInfrastructureWindows(CompanyID company)
|
||||
{
|
||||
SetWindowDirty(WC_COMPANY, company);
|
||||
SetWindowDirty(WC_COMPANY_INFRASTRUCTURE, company);
|
||||
SetWindowDirty(WindowClass::Company, company);
|
||||
SetWindowDirty(WindowClass::CompanyInfrastructure, company);
|
||||
}
|
||||
|
||||
struct BuyCompanyWindow : Window {
|
||||
@@ -2450,7 +2450,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_buy_company_widgets
|
||||
/** Window definition for the window to buy a company. */
|
||||
static WindowDesc _buy_company_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUY_COMPANY, WC_NONE,
|
||||
WindowClass::BuyCompany, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_buy_company_widgets
|
||||
);
|
||||
@@ -2462,7 +2462,7 @@ static WindowDesc _buy_company_desc(
|
||||
*/
|
||||
void ShowBuyCompanyDialog(CompanyID company, bool hostile_takeover)
|
||||
{
|
||||
auto window = BringWindowToFrontById(WC_BUY_COMPANY, company);
|
||||
auto window = BringWindowToFrontById(WindowClass::BuyCompany, company);
|
||||
if (window == nullptr) {
|
||||
new BuyCompanyWindow(_buy_company_desc, company, hostile_takeover);
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ static bool ConClearBuffer(std::span<std::string_view> argv)
|
||||
}
|
||||
|
||||
IConsoleClearBuffer();
|
||||
SetWindowDirty(WC_CONSOLE, 0);
|
||||
SetWindowDirty(WindowClass::Console, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -121,7 +121,7 @@ static void IConsoleClearCommand()
|
||||
{
|
||||
_iconsole_cmdline.DeleteAll();
|
||||
_iconsole_tab_completion.Reset();
|
||||
SetWindowDirty(WC_CONSOLE, 0);
|
||||
SetWindowDirty(WindowClass::Console, 0);
|
||||
}
|
||||
|
||||
static inline void IConsoleResetHistoryPos()
|
||||
@@ -140,7 +140,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_console_window_widge
|
||||
/** Window definition for the console window. */
|
||||
static WindowDesc _console_window_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_CONSOLE, WC_NONE,
|
||||
WindowClass::Console, WindowClass::None,
|
||||
{},
|
||||
_nested_console_window_widgets
|
||||
);
|
||||
@@ -435,7 +435,7 @@ void IConsoleSwitch()
|
||||
break;
|
||||
|
||||
case ICONSOLE_OPENED: case ICONSOLE_FULL:
|
||||
CloseWindowById(WC_CONSOLE, 0);
|
||||
CloseWindowById(WindowClass::Console, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ static void IConsoleHistoryNavigate(int direction)
|
||||
void IConsoleGUIPrint(ExtendedTextColour colour_code, const std::string &str)
|
||||
{
|
||||
_iconsole_buffer.push_front(IConsoleLine(str, colour_code));
|
||||
SetWindowDirty(WC_CONSOLE, 0);
|
||||
SetWindowDirty(WindowClass::Console, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_set_date_widgets = {
|
||||
/** Description of the date setting window. */
|
||||
static WindowDesc _set_date_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_SET_DATE, WC_NONE,
|
||||
WindowClass::SetDate, WindowClass::None,
|
||||
{},
|
||||
_nested_set_date_widgets
|
||||
);
|
||||
@@ -213,6 +213,6 @@ 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)
|
||||
{
|
||||
CloseWindowByClass(WC_SET_DATE);
|
||||
CloseWindowByClass(WindowClass::SetDate);
|
||||
new SetDateWindow(_set_date_desc, window_number, parent, initial_date, min_year, max_year, std::move(callback));
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ Depot::~Depot()
|
||||
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
||||
|
||||
/* Delete the depot-window */
|
||||
CloseWindowById(WC_VEHICLE_DEPOT, this->xy);
|
||||
CloseWindowById(WindowClass::VehicleDepot, this->xy);
|
||||
|
||||
/* Delete the depot list */
|
||||
VehicleType vt = GetDepotVehicleType(this->xy);
|
||||
|
||||
+2
-2
@@ -67,8 +67,8 @@ CommandCost CmdRenameDepot(DoCommandFlags flags, DepotID depot_id, const std::st
|
||||
}
|
||||
|
||||
/* Update the orders and depot */
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowDirty(WC_VEHICLE_DEPOT, d->xy);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
SetWindowDirty(WindowClass::VehicleDepot, d->xy);
|
||||
|
||||
/* Update the depot list */
|
||||
VehicleType vt = GetDepotVehicleType(d->xy);
|
||||
|
||||
+7
-7
@@ -89,7 +89,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_train_depot_widgets
|
||||
/** Window definition for the train depot window. */
|
||||
static WindowDesc _train_depot_desc(
|
||||
WindowPosition::Automatic, "depot_train", 362, 123,
|
||||
WC_VEHICLE_DEPOT, WC_NONE,
|
||||
WindowClass::VehicleDepot, WindowClass::None,
|
||||
{},
|
||||
_nested_train_depot_widgets
|
||||
);
|
||||
@@ -97,7 +97,7 @@ static WindowDesc _train_depot_desc(
|
||||
/** Window definition for the road depot window. */
|
||||
static WindowDesc _road_depot_desc(
|
||||
WindowPosition::Automatic, "depot_roadveh", 316, 97,
|
||||
WC_VEHICLE_DEPOT, WC_NONE,
|
||||
WindowClass::VehicleDepot, WindowClass::None,
|
||||
{},
|
||||
_nested_train_depot_widgets
|
||||
);
|
||||
@@ -105,7 +105,7 @@ static WindowDesc _road_depot_desc(
|
||||
/** Window definition for the ship depot window. */
|
||||
static WindowDesc _ship_depot_desc(
|
||||
WindowPosition::Automatic, "depot_ship", 306, 99,
|
||||
WC_VEHICLE_DEPOT, WC_NONE,
|
||||
WindowClass::VehicleDepot, WindowClass::None,
|
||||
{},
|
||||
_nested_train_depot_widgets
|
||||
);
|
||||
@@ -113,7 +113,7 @@ static WindowDesc _ship_depot_desc(
|
||||
/** Window definition for the aircraft depot window. */
|
||||
static WindowDesc _aircraft_depot_desc(
|
||||
WindowPosition::Automatic, "depot_aircraft", 332, 99,
|
||||
WC_VEHICLE_DEPOT, WC_NONE,
|
||||
WindowClass::VehicleDepot, WindowClass::None,
|
||||
{},
|
||||
_nested_train_depot_widgets
|
||||
);
|
||||
@@ -301,7 +301,7 @@ struct DepotWindow : Window {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_BUILD_VEHICLE, this->window_number);
|
||||
CloseWindowById(WindowClass::BuildVehicle, this->window_number);
|
||||
CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDestinationIndex()).ToWindowNumber(), false);
|
||||
OrderBackup::Reset(TileIndex(this->window_number));
|
||||
this->Window::Close();
|
||||
@@ -1182,7 +1182,7 @@ static void DepotSellAllConfirmationCallback(Window *win, bool confirmed)
|
||||
*/
|
||||
void ShowDepotWindow(TileIndex tile, VehicleType type)
|
||||
{
|
||||
if (BringWindowToFrontById(WC_VEHICLE_DEPOT, tile) != nullptr) return;
|
||||
if (BringWindowToFrontById(WindowClass::VehicleDepot, tile) != nullptr) return;
|
||||
|
||||
switch (type) {
|
||||
default: NOT_REACHED();
|
||||
@@ -1206,7 +1206,7 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v)
|
||||
*/
|
||||
if (_special_mouse_mode != WSM_DRAGDROP) return;
|
||||
|
||||
w = dynamic_cast<DepotWindow*>(FindWindowById(WC_VEHICLE_DEPOT, v->tile));
|
||||
w = dynamic_cast<DepotWindow*>(FindWindowById(WindowClass::VehicleDepot, v->tile));
|
||||
if (w != nullptr) {
|
||||
if (w->sel == v->index) ResetObjectToPlace();
|
||||
}
|
||||
|
||||
+13
-13
@@ -110,7 +110,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WindowClass::ScenarioGenerateLandscape, 0, false);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ struct BuildDocksToolbarWindow : Window {
|
||||
WID_DT_STATION,
|
||||
WID_DT_BUOY);
|
||||
if (!can_build) {
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_WATER);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_WATER);
|
||||
}
|
||||
|
||||
if (_game_mode != GM_EDITOR) {
|
||||
@@ -284,10 +284,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||
|
||||
this->RaiseButtons();
|
||||
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_WATER);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_WATER);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
CloseWindowByClass(WindowClass::BuildBridge);
|
||||
}
|
||||
|
||||
void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile_from) override
|
||||
@@ -359,7 +359,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_docks_toolbar_
|
||||
/** Window definition for the water/docks toolbar. */
|
||||
static WindowDesc _build_docks_toolbar_desc(
|
||||
WindowPosition::Manual, "toolbar_water", 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::BuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_docks_toolbar_widgets,
|
||||
&BuildDocksToolbarWindow::hotkeys
|
||||
@@ -376,7 +376,7 @@ Window *ShowBuildDocksToolbar()
|
||||
{
|
||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
CloseWindowByClass(WindowClass::BuildToolbar);
|
||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(_build_docks_toolbar_desc, TRANSPORT_WATER);
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_docks_scen_too
|
||||
/** Window definition for the build docks in scenario editor window. */
|
||||
static WindowDesc _build_docks_scen_toolbar_desc(
|
||||
WindowPosition::Automatic, "toolbar_water_scen", 0, 0,
|
||||
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::ScenarioBuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_docks_scen_toolbar_widgets
|
||||
);
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
this->PickerWindowBase::Close();
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_dock_station_w
|
||||
/** Window definition for the dock building window. */
|
||||
static WindowDesc _build_dock_station_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildStation, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_dock_station_widgets
|
||||
);
|
||||
@@ -602,7 +602,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_docks_depot_wi
|
||||
/** Window definition for the ship depot window. */
|
||||
static WindowDesc _build_docks_depot_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildDepot, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_docks_depot_widgets
|
||||
);
|
||||
|
||||
+3
-3
@@ -116,7 +116,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_dropdown_menu_widget
|
||||
/** Window description for dropdown menus. */
|
||||
static WindowDesc _dropdown_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_DROPDOWN_MENU, WC_NONE,
|
||||
WindowClass::DropdownMenu, WindowClass::None,
|
||||
{},
|
||||
_nested_dropdown_menu_widgets
|
||||
);
|
||||
@@ -535,7 +535,7 @@ struct DropdownWindow : Window {
|
||||
|
||||
void ReplaceDropDownList(Window *parent, DropDownList &&list, std::optional<int> selected_result)
|
||||
{
|
||||
DropdownWindow *ddw = dynamic_cast<DropdownWindow *>(parent->FindChildWindow(WC_DROPDOWN_MENU));
|
||||
DropdownWindow *ddw = dynamic_cast<DropdownWindow *>(parent->FindChildWindow(WindowClass::DropdownMenu));
|
||||
if (ddw != nullptr) ddw->ReplaceList(std::move(list), selected_result);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ Dimension GetDropDownListDimension(const DropDownList &list)
|
||||
*/
|
||||
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, WidgetID button, Rect wi_rect, Colours wi_colour, DropDownOptions options, std::string * const persistent_filter_text)
|
||||
{
|
||||
CloseWindowByClass(WC_DROPDOWN_MENU);
|
||||
CloseWindowByClass(WindowClass::DropdownMenu);
|
||||
new DropdownWindow(w, std::move(list), selected, button, wi_rect, wi_colour, options, persistent_filter_text);
|
||||
}
|
||||
|
||||
|
||||
+21
-21
@@ -310,7 +310,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
|
||||
c->old_economy[0].company_value = CalculateCompanyValue(c);
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_PERFORMANCE_DETAIL, 0);
|
||||
SetWindowDirty(WindowClass::PerformanceDetail, 0);
|
||||
return score;
|
||||
}
|
||||
|
||||
@@ -681,12 +681,12 @@ static void CompaniesGenStatistics()
|
||||
if (c->block_preview != 0) c->block_preview--;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_INCOME_GRAPH, 0);
|
||||
SetWindowDirty(WC_OPERATING_PROFIT, 0);
|
||||
SetWindowDirty(WC_DELIVERED_CARGO, 0);
|
||||
SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
|
||||
SetWindowDirty(WC_COMPANY_VALUE, 0);
|
||||
SetWindowDirty(WC_COMPANY_LEAGUE, 0);
|
||||
SetWindowDirty(WindowClass::IncomeGraph, 0);
|
||||
SetWindowDirty(WindowClass::OperatingProfitGraph, 0);
|
||||
SetWindowDirty(WindowClass::DeliveredCargoGraph, 0);
|
||||
SetWindowDirty(WindowClass::PerformanceGraph, 0);
|
||||
SetWindowDirty(WindowClass::CompanyValueGraph, 0);
|
||||
SetWindowDirty(WindowClass::CompanyLeague, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -791,11 +791,11 @@ void RecomputePrices()
|
||||
cs->current_payment = (cs->initial_payment * (int64_t)_economy.inflation_payment) >> 16;
|
||||
}
|
||||
|
||||
SetWindowClassesDirty(WC_BUILD_VEHICLE);
|
||||
SetWindowClassesDirty(WC_REPLACE_VEHICLE);
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowClassesDirty(WC_COMPANY_INFRASTRUCTURE);
|
||||
InvalidateWindowData(WC_PAYMENT_RATES, 0);
|
||||
SetWindowClassesDirty(WindowClass::BuildVehicle);
|
||||
SetWindowClassesDirty(WindowClass::ReplaceVehicle);
|
||||
SetWindowClassesDirty(WindowClass::VehicleDetails);
|
||||
SetWindowClassesDirty(WindowClass::CompanyInfrastructure);
|
||||
InvalidateWindowData(WindowClass::CargoPaymentRatesGraph, 0);
|
||||
}
|
||||
|
||||
/** Let all companies pay the monthly interest on their loan. */
|
||||
@@ -1146,7 +1146,7 @@ static void TriggerIndustryProduction(Industry *i)
|
||||
if (cbm.Test(IndustryCallbackMask::ProductionCargoArrival)) {
|
||||
IndustryProductionCallback(i, 0);
|
||||
} else {
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
|
||||
SetWindowDirty(WindowClass::IndustryView, i->index);
|
||||
}
|
||||
} else {
|
||||
for (auto ita = std::begin(i->accepted); ita != std::end(i->accepted); ++ita) {
|
||||
@@ -1908,13 +1908,13 @@ static void LoadUnloadVehicle(Vehicle *front)
|
||||
|
||||
if (dirty_vehicle) {
|
||||
SetWindowDirty(GetWindowClassForVehicleType(front->type), front->owner);
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, front->index);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, front->index);
|
||||
front->MarkDirty();
|
||||
}
|
||||
if (dirty_station) {
|
||||
st->MarkTilesDirty(true);
|
||||
SetWindowDirty(WC_STATION_VIEW, st->index);
|
||||
SetWindowDirty(WC_STATION_LIST, st->owner);
|
||||
SetWindowDirty(WindowClass::StationView, st->index);
|
||||
SetWindowDirty(WindowClass::StationList, st->owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1997,11 +1997,11 @@ static void DoAcquireCompany(Company *c, bool hostile_takeover)
|
||||
if (c->is_ai) AI::Stop(c->index);
|
||||
|
||||
CloseCompanyWindows(ci);
|
||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||
InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
|
||||
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowClassesData(WindowClass::TrainList, 0);
|
||||
InvalidateWindowClassesData(WindowClass::ShipList, 0);
|
||||
InvalidateWindowClassesData(WindowClass::RoadVehicleList, 0);
|
||||
InvalidateWindowClassesData(WindowClass::AircraftList, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
delete c;
|
||||
}
|
||||
|
||||
+17
-17
@@ -626,7 +626,7 @@ bool EngineOverrideManager::ResetToCurrentNewGRFConfig()
|
||||
*/
|
||||
void SetupEngines()
|
||||
{
|
||||
CloseWindowByClass(WC_ENGINE_PREVIEW);
|
||||
CloseWindowByClass(WindowClass::EnginePreview);
|
||||
_engine_pool.CleanPool();
|
||||
|
||||
for (VehicleType type = VehicleType::Begin; type != VehicleType::CompanyEnd; type++) {
|
||||
@@ -844,10 +844,10 @@ void StartupEngines()
|
||||
}
|
||||
|
||||
/* Invalidate any open purchase lists */
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE);
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle);
|
||||
|
||||
SetWindowClassesDirty(WC_BUILD_VEHICLE);
|
||||
SetWindowClassesDirty(WC_REPLACE_VEHICLE);
|
||||
SetWindowClassesDirty(WindowClass::BuildVehicle);
|
||||
SetWindowClassesDirty(WindowClass::ReplaceVehicle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -871,10 +871,10 @@ static void EnableEngineForCompany(EngineID eid, CompanyID company)
|
||||
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
|
||||
|
||||
/* Update the toolbar. */
|
||||
InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
if (e->type == VehicleType::Road) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
||||
if (e->type == VehicleType::Ship) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_WATER);
|
||||
if (e->type == VehicleType::Aircraft) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR);
|
||||
InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
if (e->type == VehicleType::Road) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_ROAD);
|
||||
if (e->type == VehicleType::Ship) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_WATER);
|
||||
if (e->type == VehicleType::Aircraft) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,7 +921,7 @@ static void AcceptEnginePreview(EngineID eid, CompanyID company, int recursion_d
|
||||
* In singleplayer this function is called from the preview window, so
|
||||
* we have to use the GUI-scope scheduling of InvalidateWindowData.
|
||||
*/
|
||||
InvalidateWindowClassesData(WC_ENGINE_PREVIEW);
|
||||
InvalidateWindowClassesData(WindowClass::EnginePreview);
|
||||
|
||||
/* Don't search for variants to include if we are 10 levels deep already. */
|
||||
if (recursion_depth >= 10) return;
|
||||
@@ -1000,7 +1000,7 @@ static const IntervalTimer<TimerGameCalendar> _calendar_engines_daily({TimerGame
|
||||
if (e->flags.Test(EngineFlag::ExclusivePreview)) {
|
||||
if (e->preview_company != CompanyID::Invalid()) {
|
||||
if (!--e->preview_wait) {
|
||||
InvalidateWindowClassesData(WC_ENGINE_PREVIEW);
|
||||
InvalidateWindowClassesData(WindowClass::EnginePreview);
|
||||
e->preview_company = CompanyID::Invalid();
|
||||
}
|
||||
} else if (e->preview_asked.Count() < MAX_COMPANIES) {
|
||||
@@ -1155,12 +1155,12 @@ static void NewVehicleAvailable(Engine *e)
|
||||
}
|
||||
|
||||
/* Update the toolbar. */
|
||||
if (e->type == VehicleType::Road) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
||||
if (e->type == VehicleType::Ship) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_WATER);
|
||||
if (e->type == VehicleType::Aircraft) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR);
|
||||
if (e->type == VehicleType::Road) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_ROAD);
|
||||
if (e->type == VehicleType::Ship) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_WATER);
|
||||
if (e->type == VehicleType::Aircraft) InvalidateWindowData(WindowClass::BuildToolbar, TRANSPORT_AIR);
|
||||
|
||||
/* Remove from preview windows */
|
||||
InvalidateWindowClassesData(WC_ENGINE_PREVIEW);
|
||||
InvalidateWindowClassesData(WindowClass::EnginePreview);
|
||||
}
|
||||
|
||||
/** Monthly update of the availability, reliability, and preview offers of the engines. */
|
||||
@@ -1202,11 +1202,11 @@ void CalendarEnginesMonthlyLoop()
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // rebuild the purchase list (esp. when sorted by reliability)
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // rebuild the purchase list (esp. when sorted by reliability)
|
||||
|
||||
if (refresh) {
|
||||
SetWindowClassesDirty(WC_BUILD_VEHICLE);
|
||||
SetWindowClassesDirty(WC_REPLACE_VEHICLE);
|
||||
SetWindowClassesDirty(WindowClass::BuildVehicle);
|
||||
SetWindowClassesDirty(WindowClass::ReplaceVehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -276,7 +276,7 @@ struct EnginePreviewWindow : Window {
|
||||
/** Window definition for the engine preview window. */
|
||||
static WindowDesc _engine_preview_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_ENGINE_PREVIEW, WC_NONE,
|
||||
WindowClass::EnginePreview, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_engine_preview_widgets
|
||||
);
|
||||
@@ -284,7 +284,7 @@ static WindowDesc _engine_preview_desc(
|
||||
|
||||
void ShowEnginePreviewWindow(EngineID engine)
|
||||
{
|
||||
EnginePreviewWindow *w = dynamic_cast<EnginePreviewWindow *>(FindWindowByClass(WC_ENGINE_PREVIEW));
|
||||
EnginePreviewWindow *w = dynamic_cast<EnginePreviewWindow *>(FindWindowByClass(WindowClass::EnginePreview));
|
||||
if (w == nullptr) {
|
||||
new EnginePreviewWindow(_engine_preview_desc, engine);
|
||||
} else {
|
||||
|
||||
+5
-5
@@ -46,7 +46,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_errmsg_widgets = {
|
||||
/** Window definition for the error message window. */
|
||||
static WindowDesc _errmsg_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_ERRMSG, WC_NONE,
|
||||
WindowClass::ErrorMessage, WindowClass::None,
|
||||
{},
|
||||
_nested_errmsg_widgets
|
||||
);
|
||||
@@ -67,7 +67,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_errmsg_face_widgets
|
||||
/** Window definition for the error message with company president face window. */
|
||||
static WindowDesc _errmsg_face_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_ERRMSG, WC_NONE,
|
||||
WindowClass::ErrorMessage, WindowClass::None,
|
||||
{},
|
||||
_nested_errmsg_face_widgets
|
||||
);
|
||||
@@ -280,7 +280,7 @@ void ShowFirstError()
|
||||
*/
|
||||
void UnshowCriticalError()
|
||||
{
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WC_ERRMSG, 0));
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WindowClass::ErrorMessage, 0));
|
||||
if (_window_system_initialized && w != nullptr) {
|
||||
if (w->IsCritical()) _error_list.push_front(*w);
|
||||
_window_system_initialized = false;
|
||||
@@ -340,7 +340,7 @@ void ShowErrorMessage(EncodedString &&summary_msg, EncodedString &&detailed_msg,
|
||||
|
||||
ErrorMessageData data(std::move(summary_msg), std::move(detailed_msg), is_critical, x, y, std::move(extra_msg), company);
|
||||
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WC_ERRMSG, 0));
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WindowClass::ErrorMessage, 0));
|
||||
if (w != nullptr) {
|
||||
if (w->IsCritical()) {
|
||||
/* A critical error is currently shown. */
|
||||
@@ -364,7 +364,7 @@ void ShowErrorMessage(EncodedString &&summary_msg, EncodedString &&detailed_msg,
|
||||
*/
|
||||
bool HideActiveErrorMessage()
|
||||
{
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WC_ERRMSG, 0));
|
||||
ErrmsgWindow *w = dynamic_cast<ErrmsgWindow *>(FindWindowById(WindowClass::ErrorMessage, 0));
|
||||
if (w == nullptr) return false;
|
||||
w->Close();
|
||||
return true;
|
||||
|
||||
+6
-6
@@ -460,7 +460,7 @@ public:
|
||||
if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) {
|
||||
Command<Commands::Pause>::Post(PauseMode::SaveLoad, true);
|
||||
}
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WindowClass::MainWindow, 0);
|
||||
|
||||
this->OnInvalidateData(SLIWD_RESCAN_FILES);
|
||||
|
||||
@@ -983,7 +983,7 @@ public:
|
||||
/** Load game/scenario */
|
||||
static WindowDesc _load_dialog_desc(
|
||||
WindowPosition::Center, "load_game", 500, 294,
|
||||
WC_SAVELOAD, WC_NONE,
|
||||
WindowClass::SaveLoad, WindowClass::None,
|
||||
{},
|
||||
_nested_load_dialog_widgets
|
||||
);
|
||||
@@ -991,7 +991,7 @@ static WindowDesc _load_dialog_desc(
|
||||
/** Load heightmap */
|
||||
static WindowDesc _load_heightmap_dialog_desc(
|
||||
WindowPosition::Center, "load_heightmap", 257, 320,
|
||||
WC_SAVELOAD, WC_NONE,
|
||||
WindowClass::SaveLoad, WindowClass::None,
|
||||
{},
|
||||
_nested_load_heightmap_dialog_widgets
|
||||
);
|
||||
@@ -999,7 +999,7 @@ static WindowDesc _load_heightmap_dialog_desc(
|
||||
/** Load town data */
|
||||
static WindowDesc _load_town_data_dialog_desc(
|
||||
WindowPosition::Center, "load_town_data", 257, 320,
|
||||
WC_SAVELOAD, WC_NONE,
|
||||
WindowClass::SaveLoad, WindowClass::None,
|
||||
{},
|
||||
_nested_load_town_data_dialog_widgets
|
||||
);
|
||||
@@ -1007,7 +1007,7 @@ static WindowDesc _load_town_data_dialog_desc(
|
||||
/** Save game/scenario */
|
||||
static WindowDesc _save_dialog_desc(
|
||||
WindowPosition::Center, "save_game", 500, 294,
|
||||
WC_SAVELOAD, WC_NONE,
|
||||
WindowClass::SaveLoad, WindowClass::None,
|
||||
{},
|
||||
_nested_save_dialog_widgets
|
||||
);
|
||||
@@ -1019,7 +1019,7 @@ static WindowDesc _save_dialog_desc(
|
||||
*/
|
||||
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
|
||||
{
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
CloseWindowById(WindowClass::SaveLoad, 0);
|
||||
|
||||
if (fop == SaveLoadOperation::Save) {
|
||||
new SaveLoadWindow(_save_dialog_desc, abstract_filetype, fop);
|
||||
|
||||
@@ -722,7 +722,7 @@ struct FramerateWindow : Window {
|
||||
/** Window definition for the frame rate window. */
|
||||
static WindowDesc _framerate_display_desc(
|
||||
WindowPosition::Automatic, "framerate_display", 0, 0,
|
||||
WC_FRAMERATE_DISPLAY, WC_NONE,
|
||||
WindowClass::FramerateDisplay, WindowClass::None,
|
||||
{},
|
||||
_framerate_window_widgets
|
||||
);
|
||||
@@ -1018,7 +1018,7 @@ struct FrametimeGraphWindow : Window {
|
||||
/** Window definition for the frame rate graph window. */
|
||||
static WindowDesc _frametime_graph_window_desc(
|
||||
WindowPosition::Automatic, "frametime_graph", 140, 90,
|
||||
WC_FRAMETIME_GRAPH, WC_NONE,
|
||||
WindowClass::FrametimeGraph, WindowClass::None,
|
||||
{},
|
||||
_frametime_graph_window_widgets
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
Game::instance->LoadOnStack(config->GetToLoadData());
|
||||
config->SetToLoadData(nullptr);
|
||||
|
||||
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, -1);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptDebug, -1);
|
||||
}
|
||||
|
||||
/* static */ void Game::Uninitialize(bool keepConfig)
|
||||
@@ -176,10 +176,10 @@
|
||||
Game::scanner_library->RescanDir();
|
||||
ResetConfig();
|
||||
|
||||
InvalidateWindowData(WC_SCRIPT_LIST, 0, 1);
|
||||
SetWindowClassesDirty(WC_SCRIPT_DEBUG);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_SETTINGS);
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS);
|
||||
InvalidateWindowData(WindowClass::ScriptList, 0, 1);
|
||||
SetWindowClassesDirty(WindowClass::ScriptDebug);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptSettings);
|
||||
InvalidateWindowClassesData(WindowClass::GameOptions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_gs_config_widgets =
|
||||
/** Window definition for the configure GS window. */
|
||||
static WindowDesc _gs_config_desc(
|
||||
WindowPosition::Center, "settings_gs_config", 500, 350,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WindowClass::GameOptions, WindowClass::None,
|
||||
{},
|
||||
_nested_gs_config_widgets
|
||||
);
|
||||
@@ -112,7 +112,7 @@ struct GSConfigWindow : public Window {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
CloseWindowByClass(WindowClass::ScriptList);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ struct GSConfigWindow : public Window {
|
||||
|
||||
int num = it - this->visible_settings.begin();
|
||||
if (this->clicked_row != num) {
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_row = num;
|
||||
this->clicked_dropdown = false;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ struct GSConfigWindow : public Window {
|
||||
if (!bool_item && IsInsideMM(x, 0, SETTING_BUTTON_WIDTH) && config_item.complete_labels) {
|
||||
if (this->clicked_dropdown) {
|
||||
/* unclick the dropdown */
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_dropdown = false;
|
||||
this->closing_dropdown = false;
|
||||
} else {
|
||||
@@ -400,8 +400,8 @@ struct GSConfigWindow : public Window {
|
||||
this->SetWidgetDisabledState(WID_GSC_TEXTFILE + tft, !config->GetTextfile(tft, OWNER_DEITY).has_value());
|
||||
}
|
||||
this->RebuildVisibleSettings();
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
}
|
||||
private:
|
||||
bool IsEditableItem(const ScriptConfigItem &config_item) const
|
||||
@@ -424,6 +424,6 @@ private:
|
||||
/** Open the GS config window. */
|
||||
void ShowGSConfigWindow()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
new GSConfigWindow();
|
||||
}
|
||||
|
||||
+3
-3
@@ -87,7 +87,7 @@ static void CleanupGeneration()
|
||||
GenWorldInfo::proc = nullptr;
|
||||
GenWorldInfo::abortp = nullptr;
|
||||
|
||||
CloseWindowByClass(WC_MODAL_PROGRESS);
|
||||
CloseWindowByClass(WindowClass::ModalProgress);
|
||||
ShowFirstError();
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ static void _GenerateWorld()
|
||||
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
|
||||
_random.SetSeed(_settings_game.game_creation.generation_seed);
|
||||
SetGeneratingWorldProgress(GenWorldProgress::Init, 2);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WindowClass::MainWindow, 0);
|
||||
ScriptObject::InitializeRandomizers();
|
||||
|
||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
|
||||
@@ -339,7 +339,7 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
|
||||
|
||||
/* Create toolbars */
|
||||
SetupColoursAndInitialWindow();
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WindowClass::MainWindow, 0);
|
||||
|
||||
UnshowCriticalError();
|
||||
CloseAllNonVitalWindows();
|
||||
|
||||
+12
-12
@@ -70,8 +70,8 @@ static uint GetMapHeightLimit()
|
||||
void SetNewLandscapeType(LandscapeType landscape)
|
||||
{
|
||||
_settings_newgame.game_creation.landscape = landscape;
|
||||
InvalidateWindowClassesData(WC_SELECT_GAME);
|
||||
InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE);
|
||||
InvalidateWindowClassesData(WindowClass::SelectGame);
|
||||
InvalidateWindowClassesData(WindowClass::GenerateLandscape);
|
||||
}
|
||||
|
||||
/** Widgets of GenerateLandscapeWindow when generating world */
|
||||
@@ -897,7 +897,7 @@ struct GenerateLandscapeWindow : public Window {
|
||||
case WID_GL_TOWNNAME_DROPDOWN: // Town names
|
||||
if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
|
||||
_settings_newgame.game_creation.town_name = index;
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1019,7 +1019,7 @@ struct GenerateLandscapeWindow : public Window {
|
||||
/** Window definition for the landscape generation window. */
|
||||
static WindowDesc _generate_landscape_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
WindowClass::GenerateLandscape, WindowClass::None,
|
||||
{},
|
||||
_nested_generate_landscape_widgets
|
||||
);
|
||||
@@ -1027,7 +1027,7 @@ static WindowDesc _generate_landscape_desc(
|
||||
/** Window definition for the heightmap configuration window. */
|
||||
static WindowDesc _heightmap_load_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
WindowClass::GenerateLandscape, WindowClass::None,
|
||||
{},
|
||||
_nested_heightmap_load_widgets
|
||||
);
|
||||
@@ -1037,7 +1037,7 @@ static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode)
|
||||
uint x = 0;
|
||||
uint y = 0;
|
||||
|
||||
CloseWindowByClass(WC_GENERATE_LANDSCAPE);
|
||||
CloseWindowByClass(WindowClass::GenerateLandscape);
|
||||
|
||||
/* Generate a new seed when opening the window */
|
||||
_settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
||||
@@ -1056,7 +1056,7 @@ static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode)
|
||||
w->name = _file_to_saveload.title;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
|
||||
SetWindowDirty(WindowClass::GenerateLandscape, mode);
|
||||
}
|
||||
|
||||
/** Start with a normal game. */
|
||||
@@ -1328,7 +1328,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_create_scenario_widg
|
||||
/** Window definition for the create scenario window. */
|
||||
static WindowDesc _create_scenario_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
WindowClass::GenerateLandscape, WindowClass::None,
|
||||
{},
|
||||
_nested_create_scenario_widgets
|
||||
);
|
||||
@@ -1336,7 +1336,7 @@ static WindowDesc _create_scenario_desc(
|
||||
/** Show the window to create a scenario. */
|
||||
void ShowCreateScenario()
|
||||
{
|
||||
CloseWindowByClass(WC_GENERATE_LANDSCAPE);
|
||||
CloseWindowByClass(WindowClass::GenerateLandscape);
|
||||
new CreateScenarioWindow(_create_scenario_desc, GLWM_SCENARIO);
|
||||
}
|
||||
|
||||
@@ -1355,7 +1355,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_generate_progress_wi
|
||||
/** Window definition for the map generation progress window. */
|
||||
static WindowDesc _generate_progress_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_MODAL_PROGRESS, WC_NONE,
|
||||
WindowClass::ModalProgress, WindowClass::None,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_generate_progress_widgets
|
||||
);
|
||||
@@ -1474,7 +1474,7 @@ void PrepareGenerateWorldProgress()
|
||||
*/
|
||||
void ShowGenerateWorldProgress()
|
||||
{
|
||||
if (BringWindowToFrontById(WC_MODAL_PROGRESS, 0)) return;
|
||||
if (BringWindowToFrontById(WindowClass::ModalProgress, 0)) return;
|
||||
new GenerateProgressWindow();
|
||||
}
|
||||
|
||||
@@ -1527,7 +1527,7 @@ static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uin
|
||||
return;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_MODAL_PROGRESS, 0);
|
||||
SetWindowDirty(WindowClass::ModalProgress, 0);
|
||||
|
||||
VideoDriver::GetInstance()->GameLoopPause();
|
||||
}
|
||||
|
||||
+14
-14
@@ -88,11 +88,11 @@ std::tuple<CommandCost, GoalID> CmdCreateGoal(DoCommandFlags flags, CompanyID co
|
||||
Goal *g = Goal::Create(type, dest, company, text);
|
||||
|
||||
if (g->company == CompanyID::Invalid()) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
} else {
|
||||
InvalidateWindowData(WC_GOALS_LIST, g->company);
|
||||
InvalidateWindowData(WindowClass::GoalList, g->company);
|
||||
}
|
||||
if (Goal::GetNumItems() == 1) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
if (Goal::GetNumItems() == 1) InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
|
||||
return { CommandCost(), g->index };
|
||||
}
|
||||
@@ -117,11 +117,11 @@ CommandCost CmdRemoveGoal(DoCommandFlags flags, GoalID goal)
|
||||
delete g;
|
||||
|
||||
if (c == CompanyID::Invalid()) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
} else {
|
||||
InvalidateWindowData(WC_GOALS_LIST, c);
|
||||
InvalidateWindowData(WindowClass::GoalList, c);
|
||||
}
|
||||
if (Goal::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
if (Goal::GetNumItems() == 0) InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -168,9 +168,9 @@ CommandCost CmdSetGoalText(DoCommandFlags flags, GoalID goal, const EncodedStrin
|
||||
g->text = text;
|
||||
|
||||
if (g->company == CompanyID::Invalid()) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
} else {
|
||||
InvalidateWindowData(WC_GOALS_LIST, g->company);
|
||||
InvalidateWindowData(WindowClass::GoalList, g->company);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ CommandCost CmdSetGoalProgress(DoCommandFlags flags, GoalID goal, const EncodedS
|
||||
g->progress = text;
|
||||
|
||||
if (g->company == CompanyID::Invalid()) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
} else {
|
||||
InvalidateWindowData(WC_GOALS_LIST, g->company);
|
||||
InvalidateWindowData(WindowClass::GoalList, g->company);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ CommandCost CmdSetGoalCompleted(DoCommandFlags flags, GoalID goal, bool complete
|
||||
g->completed = completed;
|
||||
|
||||
if (g->company == CompanyID::Invalid()) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
InvalidateWindowClassesData(WindowClass::GoalList);
|
||||
} else {
|
||||
InvalidateWindowData(WC_GOALS_LIST, g->company);
|
||||
InvalidateWindowData(WindowClass::GoalList, g->company);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,13 +290,13 @@ CommandCost CmdGoalQuestionAnswer(DoCommandFlags flags, uint16_t uniqueid, uint8
|
||||
|
||||
if (_current_company == OWNER_DEITY) {
|
||||
/* It has been requested to close this specific question on all clients */
|
||||
if (flags.Test(DoCommandFlag::Execute)) CloseWindowById(WC_GOAL_QUESTION, uniqueid);
|
||||
if (flags.Test(DoCommandFlag::Execute)) CloseWindowById(WindowClass::GoalQuestion, uniqueid);
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
if (_networking && _local_company == _current_company) {
|
||||
/* Somebody in the same company answered the question. Close the window */
|
||||
if (flags.Test(DoCommandFlag::Execute)) CloseWindowById(WC_GOAL_QUESTION, uniqueid);
|
||||
if (flags.Test(DoCommandFlag::Execute)) CloseWindowById(WindowClass::GoalQuestion, uniqueid);
|
||||
if (!_network_server) return CommandCost();
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -299,7 +299,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_goals_list_widgets =
|
||||
/** Window definition for the goal listing window. */
|
||||
static WindowDesc _goals_list_desc(
|
||||
WindowPosition::Automatic, "list_goals", 500, 127,
|
||||
WC_GOALS_LIST, WC_NONE,
|
||||
WindowClass::GoalList, WindowClass::None,
|
||||
{},
|
||||
_nested_goals_list_widgets
|
||||
);
|
||||
@@ -442,25 +442,25 @@ static constexpr auto _nested_goal_question_widgets_error = NestedGoalWidgets
|
||||
static WindowDesc _goal_question_list_desc[] = {
|
||||
{
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowClass::GoalQuestion, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_question,
|
||||
},
|
||||
{
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowClass::GoalQuestion, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_info,
|
||||
},
|
||||
{
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowClass::GoalQuestion, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_warning,
|
||||
},
|
||||
{
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowClass::GoalQuestion, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_error,
|
||||
},
|
||||
|
||||
+16
-16
@@ -88,11 +88,11 @@ struct GraphLegendWindow : Window {
|
||||
_legend_excluded_companies.Flip(static_cast<CompanyID>(widget - WID_GL_FIRST_COMPANY));
|
||||
this->ToggleWidgetLoweredState(widget);
|
||||
this->SetDirty();
|
||||
InvalidateWindowData(WC_INCOME_GRAPH, 0);
|
||||
InvalidateWindowData(WC_OPERATING_PROFIT, 0);
|
||||
InvalidateWindowData(WC_DELIVERED_CARGO, 0);
|
||||
InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
|
||||
InvalidateWindowData(WC_COMPANY_VALUE, 0);
|
||||
InvalidateWindowData(WindowClass::IncomeGraph, 0);
|
||||
InvalidateWindowData(WindowClass::OperatingProfitGraph, 0);
|
||||
InvalidateWindowData(WindowClass::DeliveredCargoGraph, 0);
|
||||
InvalidateWindowData(WindowClass::PerformanceGraph, 0);
|
||||
InvalidateWindowData(WindowClass::CompanyValueGraph, 0);
|
||||
|
||||
SndClickBeep();
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_graph_legend_widgets
|
||||
/** Window definition for the graph legend window. */
|
||||
static WindowDesc _graph_legend_desc(
|
||||
WindowPosition::Automatic, "graph_legend", 0, 0,
|
||||
WC_GRAPH_LEGEND, WC_NONE,
|
||||
WindowClass::GraphLegend, WindowClass::None,
|
||||
{},
|
||||
_nested_graph_legend_widgets
|
||||
);
|
||||
@@ -635,7 +635,7 @@ protected:
|
||||
Window(desc),
|
||||
format_str_y_axis(format_str_y_axis)
|
||||
{
|
||||
SetWindowDirty(WC_GRAPH_LEGEND, 0);
|
||||
SetWindowDirty(WindowClass::GraphLegend, 0);
|
||||
}
|
||||
|
||||
const IntervalTimer<TimerWindow> blink_interval = {TIMER_BLINK_INTERVAL, [this](auto) {
|
||||
@@ -965,7 +965,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_operating_profit_wid
|
||||
/** Window definition for the operating profit graph window. */
|
||||
static WindowDesc _operating_profit_desc(
|
||||
WindowPosition::Automatic, "graph_operating_profit", 0, 0,
|
||||
WC_OPERATING_PROFIT, WC_NONE,
|
||||
WindowClass::OperatingProfitGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_operating_profit_widgets
|
||||
);
|
||||
@@ -1019,7 +1019,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_income_graph_widgets
|
||||
/** Window definition for the income graph window. */
|
||||
static WindowDesc _income_graph_desc(
|
||||
WindowPosition::Automatic, "graph_income", 0, 0,
|
||||
WC_INCOME_GRAPH, WC_NONE,
|
||||
WindowClass::IncomeGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_income_graph_widgets
|
||||
);
|
||||
@@ -1071,7 +1071,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_delivered_cargo_grap
|
||||
/** Window definition for the delivered cargo graph window. */
|
||||
static WindowDesc _delivered_cargo_graph_desc(
|
||||
WindowPosition::Automatic, "graph_delivered_cargo", 0, 0,
|
||||
WC_DELIVERED_CARGO, WC_NONE,
|
||||
WindowClass::DeliveredCargoGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_delivered_cargo_graph_widgets
|
||||
);
|
||||
@@ -1130,7 +1130,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_performance_history_
|
||||
/** Window definition for the performance history graph window. */
|
||||
static WindowDesc _performance_history_desc(
|
||||
WindowPosition::Automatic, "graph_performance", 0, 0,
|
||||
WC_PERFORMANCE_HISTORY, WC_NONE,
|
||||
WindowClass::PerformanceGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_performance_history_widgets
|
||||
);
|
||||
@@ -1182,7 +1182,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_company_value_graph_
|
||||
/** Window definition for the company value graph window. */
|
||||
static WindowDesc _company_value_graph_desc(
|
||||
WindowPosition::Automatic, "graph_company_value", 0, 0,
|
||||
WC_COMPANY_VALUE, WC_NONE,
|
||||
WindowClass::CompanyValueGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_company_value_graph_widgets
|
||||
);
|
||||
@@ -1471,7 +1471,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_cargo_payment_rates_
|
||||
/** Window definition for the cargo payment rates graph window. */
|
||||
static WindowDesc _cargo_payment_rates_desc(
|
||||
WindowPosition::Automatic, "graph_cargo_payment_rates", 0, 0,
|
||||
WC_PAYMENT_RATES, WC_NONE,
|
||||
WindowClass::CargoPaymentRatesGraph, WindowClass::None,
|
||||
{},
|
||||
_nested_cargo_payment_rates_widgets
|
||||
);
|
||||
@@ -1876,7 +1876,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_industry_production_
|
||||
/** Window definition for the industry production graph window. */
|
||||
static WindowDesc _industry_production_desc(
|
||||
WindowPosition::Automatic, "graph_industry_production", 0, 0,
|
||||
WC_INDUSTRY_PRODUCTION, WC_INDUSTRY_VIEW,
|
||||
WindowClass::IndustryProductionGraph, WindowClass::IndustryView,
|
||||
{},
|
||||
_nested_industry_production_widgets
|
||||
);
|
||||
@@ -2040,7 +2040,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_town_cargo_graph_wid
|
||||
/** Window definition for the town cargo graph window. */
|
||||
static WindowDesc _town_cargo_graph_desc(
|
||||
WindowPosition::Automatic, "graph_town_cargo", 0, 0,
|
||||
WC_TOWN_CARGO_GRAPH, WC_TOWN_VIEW,
|
||||
WindowClass::TownCargoGraph, WindowClass::TownView,
|
||||
{},
|
||||
_nested_town_cargo_graph_widgets
|
||||
);
|
||||
@@ -2104,7 +2104,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_performance_rating_d
|
||||
/** Window definition for the performance rating details window. */
|
||||
static WindowDesc _performance_rating_detail_desc(
|
||||
WindowPosition::Automatic, "league_details", 0, 0,
|
||||
WC_PERFORMANCE_DETAIL, WC_NONE,
|
||||
WindowClass::PerformanceDetail, WindowClass::None,
|
||||
{},
|
||||
_nested_performance_rating_detail_widgets
|
||||
);
|
||||
|
||||
@@ -64,8 +64,8 @@ void GroundVehicle<T, Type>::PowerChanged()
|
||||
|
||||
this->gcache.cached_power = total_power;
|
||||
this->gcache.cached_max_te = max_te;
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, this->index);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, this->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
this->gcache.cached_max_track_speed = max_track_speed;
|
||||
|
||||
@@ -361,7 +361,7 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
|
||||
inline void SetLastSpeed()
|
||||
{
|
||||
if (this->cur_speed != this->gcache.last_speed) {
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, this->index, WID_VV_START_STOP);
|
||||
this->gcache.last_speed = this->cur_speed;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -377,7 +377,7 @@ std::tuple<CommandCost, GroupID> CmdCreateGroup(DoCommandFlags flags, VehicleTyp
|
||||
}
|
||||
|
||||
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).ToWindowNumber());
|
||||
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
|
||||
InvalidateWindowData(WindowClass::CompanyLivery, g->owner, g->vehicle_type);
|
||||
|
||||
return { CommandCost(), g->index };
|
||||
}
|
||||
@@ -429,11 +429,11 @@ CommandCost CmdDeleteGroup(DoCommandFlags flags, GroupID group_id)
|
||||
VehicleType vt = g->vehicle_type;
|
||||
|
||||
/* Delete the Replace Vehicle Windows */
|
||||
CloseWindowById(WC_REPLACE_VEHICLE, g->vehicle_type);
|
||||
CloseWindowById(WindowClass::ReplaceVehicle, g->vehicle_type);
|
||||
delete g;
|
||||
|
||||
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).ToWindowNumber());
|
||||
InvalidateWindowData(WC_COMPANY_COLOUR, _current_company, vt);
|
||||
InvalidateWindowData(WindowClass::CompanyLivery, _current_company, vt);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -507,11 +507,11 @@ CommandCost CmdAlterGroup(DoCommandFlags flags, AlterGroupMode mode, GroupID gro
|
||||
}
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, g->vehicle_type, 1);
|
||||
InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).ToWindowNumber());
|
||||
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
|
||||
InvalidateWindowClassesData(WC_VEHICLE_VIEW);
|
||||
InvalidateWindowClassesData(WC_VEHICLE_DETAILS);
|
||||
InvalidateWindowData(WindowClass::CompanyLivery, g->owner, g->vehicle_type);
|
||||
InvalidateWindowClassesData(WindowClass::VehicleView);
|
||||
InvalidateWindowClassesData(WindowClass::VehicleDetails);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -546,8 +546,8 @@ static void AddVehicleToGroup(Vehicle *v, GroupID new_g)
|
||||
break;
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
|
||||
InvalidateWindowData(WC_VEHICLE_DETAILS, v->index);
|
||||
InvalidateWindowData(WindowClass::VehicleView, v->index);
|
||||
InvalidateWindowData(WindowClass::VehicleDetails, v->index);
|
||||
|
||||
GroupStatistics::CountVehicle(v, 1);
|
||||
}
|
||||
@@ -606,13 +606,13 @@ std::tuple<CommandCost, GroupID> CmdAddVehicleGroup(DoCommandFlags flags, GroupI
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
|
||||
SetWindowDirty(WindowClass::VehicleDepot, v->tile);
|
||||
}
|
||||
|
||||
GroupStatistics::UpdateAutoreplace(_current_company);
|
||||
|
||||
/* Update the Replace Vehicle Windows */
|
||||
SetWindowDirty(WC_REPLACE_VEHICLE, vtype);
|
||||
SetWindowDirty(WindowClass::ReplaceVehicle, vtype);
|
||||
InvalidateWindowData(GetWindowClassForVehicleType(vtype), VehicleListIdentifier(VL_GROUP_LIST, vtype, _current_company).ToWindowNumber());
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ CommandCost CmdSetGroupFlag(DoCommandFlags flags, GroupID group_id, GroupFlag fl
|
||||
SetGroupFlag(g, flag, value, recursive);
|
||||
|
||||
SetWindowDirty(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).ToWindowNumber());
|
||||
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type);
|
||||
InvalidateWindowData(WindowClass::ReplaceVehicle, g->vehicle_type);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -785,7 +785,7 @@ void SetTrainGroupID(Train *v, GroupID new_g)
|
||||
|
||||
/* Update the Replace Vehicle Windows */
|
||||
GroupStatistics::UpdateAutoreplace(v->owner);
|
||||
SetWindowDirty(WC_REPLACE_VEHICLE, VehicleType::Train);
|
||||
SetWindowDirty(WindowClass::ReplaceVehicle, VehicleType::Train);
|
||||
}
|
||||
|
||||
|
||||
@@ -811,7 +811,7 @@ void UpdateTrainGroupID(Train *v)
|
||||
|
||||
/* Update the Replace Vehicle Windows */
|
||||
GroupStatistics::UpdateAutoreplace(v->owner);
|
||||
SetWindowDirty(WC_REPLACE_VEHICLE, VehicleType::Train);
|
||||
SetWindowDirty(WindowClass::ReplaceVehicle, VehicleType::Train);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-7
@@ -543,14 +543,14 @@ public:
|
||||
|
||||
/* Process ID-invalidation in command-scope as well */
|
||||
if (this->group_rename != GroupID::Invalid() && !Group::IsValidID(this->group_rename)) {
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
CloseWindowByClass(WindowClass::QueryString);
|
||||
this->group_rename = GroupID::Invalid();
|
||||
}
|
||||
|
||||
GroupID group = this->vli.ToGroupID();
|
||||
if (!(IsAllGroupID(group) || IsDefaultGroupID(group) || Group::IsValidID(group))) {
|
||||
this->vli.SetIndex(ALL_GROUP);
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
}
|
||||
this->SetDirty();
|
||||
}
|
||||
@@ -595,7 +595,7 @@ public:
|
||||
/* The drop down menu is out, *but* it may not be used, retract it. */
|
||||
if (this->vehicles.empty() && this->IsWidgetLowered(WID_GL_MANAGE_VEHICLES_DROPDOWN)) {
|
||||
this->RaiseWidget(WID_GL_MANAGE_VEHICLES_DROPDOWN);
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
}
|
||||
|
||||
/* Disable all lists management button when the list is empty */
|
||||
@@ -1194,25 +1194,25 @@ public:
|
||||
static VehicleTypeIndexArray<WindowDesc> _vehicle_group_desc = {{
|
||||
WindowDesc{
|
||||
WindowPosition::Automatic, "list_groups_train", 525, 246,
|
||||
WC_TRAINS_LIST, WC_NONE,
|
||||
WindowClass::TrainList, WindowClass::None,
|
||||
{},
|
||||
_nested_group_widgets
|
||||
},
|
||||
WindowDesc{
|
||||
WindowPosition::Automatic, "list_groups_roadveh", 460, 246,
|
||||
WC_ROADVEH_LIST, WC_NONE,
|
||||
WindowClass::RoadVehicleList, WindowClass::None,
|
||||
{},
|
||||
_nested_group_widgets
|
||||
},
|
||||
WindowDesc{
|
||||
WindowPosition::Automatic, "list_groups_ship", 460, 246,
|
||||
WC_SHIPS_LIST, WC_NONE,
|
||||
WindowClass::ShipList, WindowClass::None,
|
||||
{},
|
||||
_nested_group_widgets
|
||||
},
|
||||
WindowDesc{
|
||||
WindowPosition::Automatic, "list_groups_aircraft", 460, 246,
|
||||
WC_AIRCRAFT_LIST, WC_NONE,
|
||||
WindowClass::AircraftList, WindowClass::None,
|
||||
{},
|
||||
_nested_group_widgets
|
||||
},
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_helpwin_widgets = {
|
||||
/** Window definition for the help window. */
|
||||
static WindowDesc _helpwin_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_HELPWIN, WC_NONE,
|
||||
WindowClass::Help, WindowClass::None,
|
||||
{},
|
||||
_nested_helpwin_widgets
|
||||
);
|
||||
|
||||
@@ -228,7 +228,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_highscore_widgets =
|
||||
/** Window definition for the highscore window. */
|
||||
static WindowDesc _highscore_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_HIGHSCORE, WC_NONE,
|
||||
WindowClass::Highscore, WindowClass::None,
|
||||
{},
|
||||
_nested_highscore_widgets
|
||||
);
|
||||
@@ -236,7 +236,7 @@ static WindowDesc _highscore_desc(
|
||||
/** Window definition for the endgame window. */
|
||||
static WindowDesc _endgame_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_ENDSCREEN, WC_NONE,
|
||||
WindowClass::Endscreen, WindowClass::None,
|
||||
{},
|
||||
_nested_highscore_widgets
|
||||
);
|
||||
@@ -250,7 +250,7 @@ static WindowDesc _endgame_desc(
|
||||
*/
|
||||
void ShowHighscoreTable(int difficulty, int8_t ranking)
|
||||
{
|
||||
CloseWindowByClass(WC_HIGHSCORE);
|
||||
CloseWindowByClass(WindowClass::Highscore);
|
||||
new HighScoreWindow(_highscore_desc, difficulty, ranking);
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ void ShowEndGameChart()
|
||||
if (_network_dedicated || (!_networking && !Company::IsValidID(_local_company))) return;
|
||||
|
||||
HideVitalWindows();
|
||||
CloseWindowByClass(WC_ENDSCREEN);
|
||||
CloseWindowByClass(WindowClass::Endscreen);
|
||||
new EndGameWindow(_endgame_desc);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -197,8 +197,8 @@ Industry::~Industry()
|
||||
industries.erase(this->index);
|
||||
|
||||
DeleteIndustryNews(this->index);
|
||||
CloseWindowById(WC_INDUSTRY_VIEW, this->index);
|
||||
CloseWindowById(WC_INDUSTRY_PRODUCTION, this->index);
|
||||
CloseWindowById(WindowClass::IndustryView, this->index);
|
||||
CloseWindowById(WindowClass::IndustryProductionGraph, this->index);
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Industries, this->index);
|
||||
|
||||
Source src{this->index, SourceType::Industry};
|
||||
@@ -216,8 +216,8 @@ Industry::~Industry()
|
||||
*/
|
||||
void Industry::PostDestructor(size_t)
|
||||
{
|
||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
|
||||
SetWindowDirty(WC_BUILD_INDUSTRY, 0);
|
||||
InvalidateWindowData(WindowClass::IndustryDirectory, 0, IDIWD_FORCE_REBUILD);
|
||||
SetWindowDirty(WindowClass::BuildIndustry, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1975,8 +1975,8 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::PlantOnBuild)) {
|
||||
for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
|
||||
}
|
||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
|
||||
SetWindowDirty(WC_BUILD_INDUSTRY, 0);
|
||||
InvalidateWindowData(WindowClass::IndustryDirectory, 0, IDIWD_FORCE_REBUILD);
|
||||
SetWindowDirty(WindowClass::BuildIndustry, 0);
|
||||
|
||||
if (!_generating_world) PopulateStationsNearby(i);
|
||||
}
|
||||
@@ -2268,7 +2268,7 @@ CommandCost CmdIndustrySetText(DoCommandFlags flags, IndustryID ind_id, const En
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
ind->text.clear();
|
||||
if (!text.empty()) ind->text = text;
|
||||
InvalidateWindowData(WC_INDUSTRY_VIEW, ind->index);
|
||||
InvalidateWindowData(WindowClass::IndustryView, ind->index);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -3034,7 +3034,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
|
||||
/* Close if needed and allowed */
|
||||
if (closeit && !CheckIndustryCloseDownProtection(i->type) && !i->ctlflags.Test(IndustryControlFlag::NoClosure)) {
|
||||
i->prod_level = PRODLEVEL_CLOSURE;
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
|
||||
SetWindowDirty(WindowClass::IndustryView, i->index);
|
||||
str = indspec->closure_text;
|
||||
}
|
||||
|
||||
@@ -3109,13 +3109,13 @@ static const IntervalTimer<TimerGameEconomy> _economy_industries_daily({TimerGam
|
||||
Industry *i = Industry::GetRandom();
|
||||
if (i != nullptr) {
|
||||
ChangeIndustryProduction(i, false);
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
|
||||
SetWindowDirty(WindowClass::IndustryView, i->index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* production-change */
|
||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_PRODUCTION_CHANGE);
|
||||
InvalidateWindowData(WindowClass::IndustryDirectory, 0, IDIWD_PRODUCTION_CHANGE);
|
||||
});
|
||||
|
||||
/** Economy monthly loop for industries. */
|
||||
@@ -3131,12 +3131,12 @@ static const IntervalTimer<TimerGameEconomy> _economy_industries_monthly({TimerG
|
||||
delete i;
|
||||
} else {
|
||||
ChangeIndustryProduction(i, true);
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
|
||||
SetWindowDirty(WindowClass::IndustryView, i->index);
|
||||
}
|
||||
}
|
||||
|
||||
/* production-change */
|
||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_PRODUCTION_CHANGE);
|
||||
InvalidateWindowData(WindowClass::IndustryDirectory, 0, IDIWD_PRODUCTION_CHANGE);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_industry_widge
|
||||
/** Window definition of the dynamic place industries gui */
|
||||
static WindowDesc _build_industry_desc(
|
||||
WindowPosition::Automatic, "build_industry", 170, 212,
|
||||
WC_BUILD_INDUSTRY, WC_NONE,
|
||||
WindowClass::BuildIndustry, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_industry_widgets
|
||||
);
|
||||
@@ -765,7 +765,7 @@ public:
|
||||
void ShowBuildIndustryWindow()
|
||||
{
|
||||
if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return;
|
||||
if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return;
|
||||
if (BringWindowToFrontById(WindowClass::BuildIndustry, 0)) return;
|
||||
new BuildIndustryWindow();
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ public:
|
||||
/** Close the industry production window. */
|
||||
~IndustryViewWindow() override
|
||||
{
|
||||
CloseWindowById(WC_INDUSTRY_PRODUCTION, this->window_number, false);
|
||||
CloseWindowById(WindowClass::IndustryProductionGraph, this->window_number, false);
|
||||
}
|
||||
|
||||
void OnInit() override
|
||||
@@ -1222,7 +1222,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_industry_view_widget
|
||||
/** Window definition of the view industry gui */
|
||||
static WindowDesc _industry_view_desc(
|
||||
WindowPosition::Automatic, "view_industry", 260, 120,
|
||||
WC_INDUSTRY_VIEW, WC_NONE,
|
||||
WindowClass::IndustryView, WindowClass::None,
|
||||
{},
|
||||
_nested_industry_view_widgets
|
||||
);
|
||||
@@ -1916,7 +1916,7 @@ CargoType IndustryDirectoryWindow::produced_cargo_filter = CargoFilterCriteria::
|
||||
/** Window definition of the industry directory gui */
|
||||
static WindowDesc _industry_directory_desc(
|
||||
WindowPosition::Automatic, "list_industries", 428, 190,
|
||||
WC_INDUSTRY_DIRECTORY, WC_NONE,
|
||||
WindowClass::IndustryDirectory, WindowClass::None,
|
||||
{},
|
||||
_nested_industry_directory_widgets,
|
||||
&IndustryDirectoryWindow::hotkeys
|
||||
@@ -1955,7 +1955,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_industry_cargoes_wid
|
||||
/** Window description for the industry cargoes window. */
|
||||
static WindowDesc _industry_cargoes_desc(
|
||||
WindowPosition::Automatic, "industry_cargoes", 300, 210,
|
||||
WC_INDUSTRY_CARGOES, WC_NONE,
|
||||
WindowClass::IndustryCargoes, WindowClass::None,
|
||||
{},
|
||||
_nested_industry_cargoes_widgets
|
||||
);
|
||||
@@ -2786,7 +2786,7 @@ struct IndustryCargoesWindow : public Window {
|
||||
|
||||
/* Only notify the smallmap window if it exists. In particular, do not
|
||||
* bring it to the front to prevent messing up any nice layout of the user. */
|
||||
InvalidateWindowClassesData(WC_SMALLMAP, 0);
|
||||
InvalidateWindowClassesData(WindowClass::SmallMap, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3076,7 +3076,7 @@ struct IndustryCargoesWindow : public Window {
|
||||
SndClickBeep();
|
||||
|
||||
if (this->IsWidgetLowered(WID_IC_NOTIFY)) {
|
||||
if (FindWindowByClass(WC_SMALLMAP) == nullptr) ShowSmallMap();
|
||||
if (FindWindowByClass(WindowClass::SmallMap) == nullptr) ShowSmallMap();
|
||||
this->NotifySmallmap();
|
||||
}
|
||||
break;
|
||||
@@ -3190,7 +3190,7 @@ static void ShowIndustryCargoesWindow(IndustryType id)
|
||||
if (id >= NUM_INDUSTRYTYPES) return;
|
||||
}
|
||||
|
||||
Window *w = BringWindowToFrontById(WC_INDUSTRY_CARGOES, 0);
|
||||
Window *w = BringWindowToFrontById(WindowClass::IndustryCargoes, 0);
|
||||
if (w != nullptr) {
|
||||
w->InvalidateData(id);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -391,7 +391,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_select_game_widgets
|
||||
/** Window definition for the select game window. */
|
||||
static WindowDesc _select_game_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_SELECT_GAME, WC_NONE,
|
||||
WindowClass::SelectGame, WindowClass::None,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_select_game_widgets
|
||||
);
|
||||
|
||||
+4
-4
@@ -90,7 +90,7 @@ std::tuple<CommandCost, LeagueTableElementID> CmdCreateLeagueTableElement(DoComm
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
LeagueTableElement *lte = LeagueTableElement::Create(table, rating, company, text, score, link);
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, table);
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, table);
|
||||
return { CommandCost(), lte->index };
|
||||
}
|
||||
return { CommandCost(), LeagueTableElementID::Invalid() };
|
||||
@@ -119,7 +119,7 @@ CommandCost CmdUpdateLeagueTableElementData(DoCommandFlags flags, LeagueTableEle
|
||||
lte->company = company;
|
||||
lte->text = text;
|
||||
lte->link = link;
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, lte->table);
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, lte->table);
|
||||
}
|
||||
return CommandCost();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlags flags, LeagueTableEl
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
lte->rating = rating;
|
||||
lte->score = score;
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, lte->table);
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, lte->table);
|
||||
}
|
||||
return CommandCost();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ CommandCost CmdRemoveLeagueTableElement(DoCommandFlags flags, LeagueTableElement
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
auto table = lte->table;
|
||||
delete lte;
|
||||
InvalidateWindowData(WC_COMPANY_LEAGUE, table);
|
||||
InvalidateWindowData(WindowClass::CompanyLeague, table);
|
||||
}
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
+2
-2
@@ -194,7 +194,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_performance_league_w
|
||||
/** Window definition for the performance league window. */
|
||||
static WindowDesc _performance_league_desc(
|
||||
WindowPosition::Automatic, "performance_league", 0, 0,
|
||||
WC_COMPANY_LEAGUE, WC_NONE,
|
||||
WindowClass::CompanyLeague, WindowClass::None,
|
||||
{},
|
||||
_nested_performance_league_widgets
|
||||
);
|
||||
@@ -431,7 +431,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_script_league_widget
|
||||
/** Window definition for the script league window. */
|
||||
static WindowDesc _script_league_desc(
|
||||
WindowPosition::Automatic, "script_league", 0, 0,
|
||||
WC_COMPANY_LEAGUE, WC_NONE,
|
||||
WindowClass::CompanyLeague, WindowClass::None,
|
||||
{},
|
||||
_nested_script_league_widgets
|
||||
);
|
||||
|
||||
@@ -535,7 +535,7 @@ static_assert(WID_LGL_SATURATION_LAST - WID_LGL_SATURATION_FIRST ==
|
||||
/** Window definition for the linkgraph toolbar. */
|
||||
static WindowDesc _linkgraph_legend_desc(
|
||||
WindowPosition::Automatic, "toolbar_linkgraph", 0, 0,
|
||||
WC_LINKGRAPH_LEGEND, WC_NONE,
|
||||
WindowClass::LinkGraphLegend, WindowClass::None,
|
||||
{},
|
||||
_nested_linkgraph_legend_widgets
|
||||
);
|
||||
|
||||
@@ -172,7 +172,7 @@ LinkGraphJob::~LinkGraphJob()
|
||||
}
|
||||
geflows.insert(flows.begin(), flows.end());
|
||||
if (ge.GetData().IsEmpty()) ge.ClearData();
|
||||
InvalidateWindowData(WC_STATION_VIEW, st->index, this->Cargo());
|
||||
InvalidateWindowData(WindowClass::StationView, st->index, this->Cargo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -475,7 +475,7 @@ struct MainWindow : Window
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
/* Forward the message to the appropriate toolbar (ingame or scenario editor) */
|
||||
InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
|
||||
InvalidateWindowData(WindowClass::MainToolbar, 0, data, true);
|
||||
}
|
||||
|
||||
static inline HotkeyList hotkeys{"global", {
|
||||
@@ -528,7 +528,7 @@ struct MainWindow : Window
|
||||
/** Window definition for the main window. */
|
||||
static WindowDesc _main_window_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_MAIN_WINDOW, WC_NONE,
|
||||
WindowClass::MainWindow, WindowClass::None,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_main_window_widgets,
|
||||
&MainWindow::hotkeys
|
||||
|
||||
+2
-2
@@ -212,8 +212,8 @@ CommandCost CmdPause(DoCommandFlags flags, PauseMode mode, bool pause)
|
||||
VideoDriver::GetInstance()->SetScreensaverInhibited(_pause_mode.None());
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
SetWindowDirty(WC_MAIN_TOOLBAR, 0);
|
||||
SetWindowDirty(WindowClass::Statusbar, 0);
|
||||
SetWindowDirty(WindowClass::MainToolbar, 0);
|
||||
}
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
+16
-16
@@ -57,7 +57,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_land_info_widgets =
|
||||
/** Window definition for the land information window. */
|
||||
static WindowDesc _land_info_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_LAND_INFO, WC_NONE,
|
||||
WindowClass::LandInfo, WindowClass::None,
|
||||
{},
|
||||
_nested_land_info_widgets
|
||||
);
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
*/
|
||||
void ShowLandInfo(TileIndex tile)
|
||||
{
|
||||
CloseWindowById(WC_LAND_INFO, 0);
|
||||
CloseWindowById(WindowClass::LandInfo, 0);
|
||||
new LandInfoWindow(tile);
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_about_widgets = {
|
||||
/** Window definition for the about window. */
|
||||
static WindowDesc _about_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WindowClass::GameOptions, WindowClass::None,
|
||||
{},
|
||||
_nested_about_widgets
|
||||
);
|
||||
@@ -477,7 +477,7 @@ struct AboutWindow : public Window {
|
||||
|
||||
void ShowAboutWindow()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
new AboutWindow();
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_tooltips_widgets = {
|
||||
/** Window definition for the tool tip window. */
|
||||
static WindowDesc _tool_tips_desc(
|
||||
WindowPosition::Manual, {}, 0, 0, // Coordinates and sizes are not used,
|
||||
WC_TOOLTIPS, WC_NONE,
|
||||
WindowClass::ToolTips, WindowClass::None,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_tooltips_widgets
|
||||
);
|
||||
@@ -689,7 +689,7 @@ struct TooltipsWindow : public Window
|
||||
*/
|
||||
void GuiShowTooltips(Window *parent, EncodedString &&text, TooltipCloseCondition close_tooltip)
|
||||
{
|
||||
CloseWindowById(WC_TOOLTIPS, 0);
|
||||
CloseWindowById(WindowClass::ToolTips, 0);
|
||||
|
||||
if (text.empty() || !_cursor.in_window) return;
|
||||
|
||||
@@ -702,7 +702,7 @@ void QueryString::HandleEditBox(Window *w, WidgetID wid)
|
||||
w->SetWidgetDirty(wid);
|
||||
|
||||
/* For the OSK also invalidate the parent window */
|
||||
if (w->window_class == WC_OSK) w->InvalidateData();
|
||||
if (w->window_class == WindowClass::OnScreenKeyboard) w->InvalidateData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ void QueryString::ClickEditBox(Window *w, Point pt, WidgetID wid, int click_coun
|
||||
return;
|
||||
}
|
||||
|
||||
if (w->window_class != WC_OSK && _settings_client.gui.osk_activation != OskActivation::Disabled &&
|
||||
if (w->window_class != WindowClass::OnScreenKeyboard && _settings_client.gui.osk_activation != OskActivation::Disabled &&
|
||||
(!focus_changed || _settings_client.gui.osk_activation == OskActivation::Immediately) &&
|
||||
(click_count == 2 || _settings_client.gui.osk_activation != OskActivation::DoubleClick)) {
|
||||
/* Open the OSK window */
|
||||
@@ -996,8 +996,8 @@ private:
|
||||
/** Clear parent window station/waypoint viewport rect. */
|
||||
void ClearViewportRect()
|
||||
{
|
||||
if (this->parent->window_class == WC_STATION_VIEW) SetViewportStationRect(Station::Get(this->parent->window_number), false);
|
||||
if (this->parent->window_class == WC_WAYPOINT_VIEW) SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), false);
|
||||
if (this->parent->window_class == WindowClass::StationView) SetViewportStationRect(Station::Get(this->parent->window_number), false);
|
||||
if (this->parent->window_class == WindowClass::WaypointView) SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), false);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -1049,7 +1049,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_query_string_widgets
|
||||
/** Window definition for the string query window. */
|
||||
static WindowDesc _query_string_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_QUERY_STRING, WC_NONE,
|
||||
WindowClass::QueryString, WindowClass::None,
|
||||
{},
|
||||
_nested_query_string_widgets
|
||||
);
|
||||
@@ -1067,7 +1067,7 @@ void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Windo
|
||||
{
|
||||
assert(parent != nullptr);
|
||||
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
CloseWindowByClass(WindowClass::QueryString);
|
||||
new QueryStringWindow(str, caption, (flags.Test(QueryStringFlag::LengthIsInChars) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, _query_string_desc, parent, afilter, flags);
|
||||
}
|
||||
|
||||
@@ -1077,7 +1077,7 @@ void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Windo
|
||||
*/
|
||||
void UpdateQueryStringDefault(std::string_view str)
|
||||
{
|
||||
QueryStringWindow *w = dynamic_cast<QueryStringWindow *>(FindWindowByClass(WC_QUERY_STRING));
|
||||
QueryStringWindow *w = dynamic_cast<QueryStringWindow *>(FindWindowByClass(WindowClass::QueryString));
|
||||
if (w != nullptr) w->editbox.orig = str;
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_query_widgets = {
|
||||
/** Window definition for the query window. */
|
||||
static WindowDesc _query_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_CONFIRM_POPUP_QUERY, WC_NONE,
|
||||
WindowClass::ConfirmPopupQuery, WindowClass::None,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_query_widgets
|
||||
);
|
||||
@@ -1210,7 +1210,7 @@ static WindowDesc _query_desc(
|
||||
* @param caption string shown as window caption
|
||||
* @param message string that will be shown for the window
|
||||
* @param parent pointer to parent window, if this pointer is nullptr the parent becomes
|
||||
* the main window WC_MAIN_WINDOW
|
||||
* the main window WindowClass::MainWindow
|
||||
* @param callback callback function pointer to set in the window descriptor
|
||||
* @param focus whether the window should be focussed (by default false)
|
||||
*/
|
||||
@@ -1219,7 +1219,7 @@ void ShowQuery(EncodedString &&caption, EncodedString &&message, Window *parent,
|
||||
if (parent == nullptr) parent = GetMainWindow();
|
||||
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
|
||||
if (w->window_class != WindowClass::ConfirmPopupQuery) continue;
|
||||
|
||||
QueryWindow *qw = dynamic_cast<QueryWindow *>(w);
|
||||
assert(qw != nullptr);
|
||||
|
||||
+18
-18
@@ -159,8 +159,8 @@ void MusicSystem::ChangePlaylist(PlaylistChoices pl)
|
||||
if (_settings_client.music.playing) this->Play();
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,9 +175,9 @@ void MusicSystem::ChangeMusicSet(const std::string &set_name)
|
||||
this->BuildPlaylists();
|
||||
this->ChangePlaylist(this->selected_playlist);
|
||||
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions, 0, true);
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0, 1, true);
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0, 1, true);
|
||||
InvalidateWindowData(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions, 0, true);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0, 1, true);
|
||||
InvalidateWindowData(WindowClass::Music, 0, 1, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,8 +216,8 @@ void MusicSystem::Shuffle()
|
||||
}
|
||||
this->SetPositionBySetIndex(set_index);
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,8 +231,8 @@ void MusicSystem::Unshuffle()
|
||||
this->active_playlist = this->standard_playlists[this->selected_playlist];
|
||||
this->SetPositionBySetIndex(set_index);
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/** Start/restart playback at current song */
|
||||
@@ -251,7 +251,7 @@ void MusicSystem::Play()
|
||||
if (_game_mode == GM_MENU && this->selected_playlist == PLCH_THEMEONLY) song.loop = true;
|
||||
MusicDriver::GetInstance()->PlaySong(song);
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/** Stop playback and set flag that we don't intend to play music */
|
||||
@@ -260,7 +260,7 @@ void MusicSystem::Stop()
|
||||
MusicDriver::GetInstance()->StopSong();
|
||||
_settings_client.music.playing = false;
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/** Skip to next track */
|
||||
@@ -269,7 +269,7 @@ void MusicSystem::Next()
|
||||
this->ChangePlaylistPosition(+1);
|
||||
if (_settings_client.music.playing) this->Play();
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/** Skip to previous track */
|
||||
@@ -278,7 +278,7 @@ void MusicSystem::Prev()
|
||||
this->ChangePlaylistPosition(-1);
|
||||
if (_settings_client.music.playing) this->Play();
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
||||
InvalidateWindowData(WindowClass::Music, 0);
|
||||
}
|
||||
|
||||
/** Check that music is playing if it should, and that appropriate playlist is active for game/main menu */
|
||||
@@ -366,7 +366,7 @@ void MusicSystem::PlaylistAdd(size_t song_index)
|
||||
|
||||
this->SaveCustomPlaylist(this->selected_playlist);
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,7 +400,7 @@ void MusicSystem::PlaylistRemove(size_t song_index)
|
||||
|
||||
this->SaveCustomPlaylist(this->selected_playlist);
|
||||
|
||||
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
||||
InvalidateWindowData(WindowClass::MusicTrackSelection, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -673,7 +673,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_music_track_selectio
|
||||
/** Window definition for the music track selection window. */
|
||||
static WindowDesc _music_track_selection_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_MUSIC_TRACK_SELECTION, WC_NONE,
|
||||
WindowClass::MusicTrackSelection, WindowClass::None,
|
||||
{},
|
||||
_nested_music_track_selection_widgets
|
||||
);
|
||||
@@ -841,7 +841,7 @@ struct MusicWindow : public Window {
|
||||
SetEffectVolume(vol);
|
||||
}
|
||||
this->SetWidgetDirty(widget);
|
||||
SetWindowClassesDirty(WC_GAME_OPTIONS);
|
||||
SetWindowClassesDirty(WindowClass::GameOptions);
|
||||
}
|
||||
|
||||
if (click_count > 0) this->mouse_capture_widget = widget;
|
||||
@@ -933,7 +933,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_music_window_widgets
|
||||
/** Window definition for the music window. */
|
||||
static WindowDesc _music_window_desc(
|
||||
WindowPosition::Automatic, "music", 0, 0,
|
||||
WC_MUSIC_WINDOW, WC_NONE,
|
||||
WindowClass::Music, WindowClass::None,
|
||||
{},
|
||||
_nested_music_window_widgets
|
||||
);
|
||||
|
||||
@@ -107,7 +107,7 @@ bool HasClients()
|
||||
NetworkClientInfo::~NetworkClientInfo()
|
||||
{
|
||||
/* Delete the chat window, if you were chatting with this client. */
|
||||
InvalidateWindowData(WC_SEND_NETWORK_MSG, NetworkChatDestinationType::Client, this->client_id);
|
||||
InvalidateWindowData(WindowClass::NetworkChat, NetworkChatDestinationType::Client, this->client_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,7 +583,7 @@ NetworkAddress ParseConnectionString(std::string_view connection_string, uint16_
|
||||
ServerNetworkGameSocketHandler *cs = ServerNetworkGameSocketHandler::Create(s);
|
||||
cs->client_address = address; // Save the IP of the client
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1048,7 +1048,7 @@ void NetworkDisconnect(bool close_admins)
|
||||
}
|
||||
}
|
||||
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
NetworkClose(close_admins);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void NetworkDrawChatMessage()
|
||||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
if (!_chatmessage_dirty) return;
|
||||
|
||||
const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
const Window *w = FindWindowByClass(WindowClass::NetworkChat);
|
||||
bool show_all = (w != nullptr);
|
||||
|
||||
/* First undraw if needed */
|
||||
@@ -324,14 +324,14 @@ struct NetworkChatWindow : public Window {
|
||||
this->FinishInitNested(type);
|
||||
|
||||
this->SetFocusedWidget(WID_NC_TEXTBOX);
|
||||
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
|
||||
InvalidateWindowData(WindowClass::News, 0, this->height);
|
||||
|
||||
PositionNetworkChatWindow(this);
|
||||
}
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
|
||||
InvalidateWindowData(WindowClass::News, 0, 0);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ struct NetworkChatWindow : public Window {
|
||||
|
||||
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
|
||||
{
|
||||
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
|
||||
Point pt = { 0, _screen.height - sm_height - FindWindowById(WindowClass::Statusbar, 0)->height };
|
||||
return pt;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_chat_window_widgets
|
||||
/** The description of the chat window. */
|
||||
static WindowDesc _chat_window_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_SEND_NETWORK_MSG, WC_NONE,
|
||||
WindowClass::NetworkChat, WindowClass::None,
|
||||
{},
|
||||
_nested_chat_window_widgets
|
||||
);
|
||||
@@ -439,6 +439,6 @@ static WindowDesc _chat_window_desc(
|
||||
*/
|
||||
void ShowNetworkChatQueryWindow(NetworkChatDestinationType type, int dest)
|
||||
{
|
||||
CloseWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
CloseWindowByClass(WindowClass::NetworkChat);
|
||||
new NetworkChatWindow(_chat_window_desc, type, dest);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
|
||||
this->CloseConnection(res);
|
||||
_networking = false;
|
||||
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
|
||||
ClientNetworkEmergencySave();
|
||||
}
|
||||
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
if (_game_mode != GM_MENU) _switch_mode = SM_MENU;
|
||||
_networking = false;
|
||||
@@ -292,7 +292,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
|
||||
my_client->status = STATUS_JOIN;
|
||||
Debug(net, 9, "Client::join_status = Authorizing");
|
||||
_network_join_status = NetworkJoinStatus::Authorizing;
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
auto p = std::make_unique<Packet>(my_client, PacketGameType::ClientJoin);
|
||||
p->Send_string(GetNetworkRevisionString());
|
||||
@@ -588,7 +588,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerClientInfo(Packet
|
||||
ci->client_name = std::move(name);
|
||||
ci->public_key = std::move(public_key);
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -608,7 +608,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerClientInfo(Packet
|
||||
ci->client_name = std::move(name);
|
||||
ci->public_key = std::move(public_key);
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -788,7 +788,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerWaitForMap(Packet
|
||||
Debug(net, 9, "Client::join_status = Waiting");
|
||||
_network_join_status = NetworkJoinStatus::Waiting;
|
||||
_network_join_waiting = p.Recv_uint8();
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -812,7 +812,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerMapBegin(Packet &
|
||||
|
||||
Debug(net, 9, "Client::join_status = Downloading");
|
||||
_network_join_status = NetworkJoinStatus::Downloading;
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerMapSize(Packet &p
|
||||
if (this->savegame == nullptr) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
|
||||
|
||||
_network_join_bytes_total = p.Recv_uint32();
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
Debug(net, 9, "Client::ReceiveServerMapSize(): bytes_total={}", _network_join_bytes_total);
|
||||
|
||||
@@ -839,7 +839,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerMapData(Packet &p
|
||||
this->savegame->AddPacket(p);
|
||||
|
||||
_network_join_bytes = static_cast<uint32_t>(this->savegame->buffer.size());
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -853,7 +853,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerMapDone(Packet &)
|
||||
|
||||
Debug(net, 9, "Client::join_status = Processing");
|
||||
_network_join_status = NetworkJoinStatus::Processing;
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
SetWindowDirty(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
|
||||
this->savegame->Reset();
|
||||
|
||||
@@ -1061,7 +1061,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerErrorQuit(Packet
|
||||
delete ci;
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerQuit(Packet &p)
|
||||
Debug(net, 1, "Unknown client ({}) is leaving the game", client_id);
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
/* If we come here it means we could not locate the client.. strange :s */
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
@@ -1101,7 +1101,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerClientJoined(Pack
|
||||
NetworkTextMessage(NetworkAction::ClientJoin, CC_DEFAULT, false, ci->client_name);
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::ReceiveServerConfigurationUpda
|
||||
_network_server_max_companies = p.Recv_uint8();
|
||||
_network_server_name = p.Recv_string(NETWORK_NAME_LENGTH);
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
Debug(net, 9, "Client::ReceiveServerConfigurationUpdate(): max_companies={}", _network_server_max_companies);
|
||||
|
||||
@@ -1352,7 +1352,7 @@ void NetworkUpdateClientName(const std::string &client_name)
|
||||
NetworkTextMessage(NetworkAction::ClientNameChange, CC_DEFAULT, false, ci->client_name, temporary_name);
|
||||
ci->client_name = std::move(temporary_name);
|
||||
NetworkUpdateClientInfo(CLIENT_ID_SERVER);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ bool ClientNetworkContentSocketHandler::ReceiveServerContent(Packet &p)
|
||||
return fwrite(buffer.data(), 1, buffer.size(), *this->cur_file);
|
||||
};
|
||||
if (to_read != 0 && p.TransferOut(write_to_disk) != to_read) {
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::ContentDownload);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::ContentDownload);
|
||||
ShowErrorMessage(
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD),
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE),
|
||||
@@ -502,7 +502,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
|
||||
std::string filename = GetFullFilename(*this->cur_info, true);
|
||||
if (filename.empty() || !(this->cur_file = FileHandle::Open(filename, "wb")).has_value()) {
|
||||
/* Unless that fails of course... */
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::ContentDownload);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::ContentDownload);
|
||||
ShowErrorMessage(
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD),
|
||||
GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE),
|
||||
|
||||
@@ -95,7 +95,7 @@ struct ContentTextfileWindow : public TextfileWindow {
|
||||
*/
|
||||
static void ShowContentTextfileWindow(Window *parent, TextfileType file_type, const ContentInfo *ci)
|
||||
{
|
||||
parent->CloseChildWindowById(WC_TEXTFILE, file_type);
|
||||
parent->CloseChildWindowById(WindowClass::Textfile, file_type);
|
||||
new ContentTextfileWindow(parent, file_type, ci);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_content_down
|
||||
/** Window description for the download window */
|
||||
static WindowDesc _network_content_download_status_window_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WindowClass::NetworkStatus, WindowClass::None,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_content_download_status_window_widgets
|
||||
);
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
*/
|
||||
NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(_network_content_download_status_window_desc)
|
||||
{
|
||||
this->parent = FindWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::ContentList);
|
||||
this->parent = FindWindowById(WindowClass::Network, NetworkWindowNumber::ContentList);
|
||||
}
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
@@ -264,17 +264,17 @@ public:
|
||||
|
||||
case ContentType::BaseGraphics:
|
||||
BaseGraphics::FindSets();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions);
|
||||
break;
|
||||
|
||||
case ContentType::BaseSounds:
|
||||
BaseSounds::FindSets();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions);
|
||||
break;
|
||||
|
||||
case ContentType::BaseMusic:
|
||||
BaseMusic::FindSets();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions);
|
||||
break;
|
||||
|
||||
case ContentType::NewGRF:
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
case ContentType::Scenario:
|
||||
case ContentType::Heightmap:
|
||||
ScanScenarios();
|
||||
InvalidateWindowData(WC_SAVELOAD, 0, 0);
|
||||
InvalidateWindowData(WindowClass::SaveLoad, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
}
|
||||
|
||||
/* Always invalidate the download window; tell it we are going to be gone */
|
||||
InvalidateWindowData(WC_NETWORK_WINDOW, NetworkWindowNumber::ContentList, 2);
|
||||
InvalidateWindowData(WindowClass::Network, NetworkWindowNumber::ContentList, 2);
|
||||
|
||||
this->BaseNetworkContentDownloadStatusWindow::Close();
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
} else {
|
||||
/* If downloading succeeded, close the online content window. This will close
|
||||
* the current window as well. */
|
||||
CloseWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::ContentList);
|
||||
CloseWindowById(WindowClass::Network, NetworkWindowNumber::ContentList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -870,7 +870,7 @@ public:
|
||||
break;
|
||||
|
||||
case WID_NCL_DOWNLOAD:
|
||||
if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::ContentDownload) == nullptr) new NetworkContentDownloadStatusWindow();
|
||||
if (BringWindowToFrontById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::ContentDownload) == nullptr) new NetworkContentDownloadStatusWindow();
|
||||
break;
|
||||
|
||||
case WID_NCL_SEARCH_EXTERNAL:
|
||||
@@ -1005,7 +1005,7 @@ public:
|
||||
}
|
||||
|
||||
/* If data == 2 then the status window caused this OnInvalidate */
|
||||
this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::ContentDownload) != nullptr && data != 2));
|
||||
this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::ContentDownload) != nullptr && data != 2));
|
||||
this->SetWidgetDisabledState(WID_NCL_UNSELECT, this->filesize_sum == 0);
|
||||
this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all);
|
||||
this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade || !this->filter_data.string_filter.IsEmpty());
|
||||
@@ -1120,7 +1120,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_content_list
|
||||
/** Window description of the content list */
|
||||
static WindowDesc _network_content_list_desc(
|
||||
WindowPosition::Center, "list_content", 630, 460,
|
||||
WC_NETWORK_WINDOW, WC_NONE,
|
||||
WindowClass::Network, WindowClass::None,
|
||||
{},
|
||||
_nested_network_content_list_widgets
|
||||
);
|
||||
@@ -1149,7 +1149,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT
|
||||
_network_content_client.RequestContentList(cv, true);
|
||||
}
|
||||
|
||||
CloseWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::ContentList);
|
||||
CloseWindowById(WindowClass::Network, NetworkWindowNumber::ContentList);
|
||||
new NetworkContentListWindow(_network_content_list_desc, cv != nullptr, types);
|
||||
#else
|
||||
ShowErrorMessage(
|
||||
|
||||
@@ -199,7 +199,7 @@ bool ClientNetworkCoordinatorSocketHandler::ReceiveGameCoordinatorRegisterAck(Pa
|
||||
* attempt to re-use when registering again. */
|
||||
_network_server_invite_code = _settings_client.network.server_invite_code;
|
||||
|
||||
SetWindowDirty(WC_CLIENT_LIST, 0);
|
||||
SetWindowDirty(WindowClass::NetworkClientList, 0);
|
||||
|
||||
if (_network_dedicated) {
|
||||
std::string connection_type;
|
||||
@@ -454,7 +454,7 @@ NetworkRecvStatus ClientNetworkCoordinatorSocketHandler::CloseConnection(bool er
|
||||
|
||||
this->CloseAllConnections();
|
||||
|
||||
SetWindowDirty(WC_CLIENT_LIST, 0);
|
||||
SetWindowDirty(WindowClass::NetworkClientList, 0);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ void ClientNetworkCoordinatorSocketHandler::Register()
|
||||
_network_server_connection_type = CONNECTION_TYPE_UNKNOWN;
|
||||
this->next_update = {};
|
||||
|
||||
SetWindowDirty(WC_CLIENT_LIST, 0);
|
||||
SetWindowDirty(WindowClass::NetworkClientList, 0);
|
||||
|
||||
this->Connect();
|
||||
|
||||
@@ -672,7 +672,7 @@ void ClientNetworkCoordinatorSocketHandler::CloseStunHandler(std::string_view to
|
||||
*/
|
||||
void ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(std::string_view token)
|
||||
{
|
||||
CloseWindowByClass(WC_NETWORK_ASK_RELAY, NRWCD_HANDLED);
|
||||
CloseWindowByClass(WindowClass::NetworkAskRelay, NRWCD_HANDLED);
|
||||
|
||||
auto turn_it = this->turn_handlers.find(token);
|
||||
if (turn_it == this->turn_handlers.end()) return;
|
||||
|
||||
@@ -99,5 +99,5 @@ void NetworkAfterNewGRFScan()
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_NETWORK_WINDOW);
|
||||
InvalidateWindowClassesData(WindowClass::Network);
|
||||
}
|
||||
|
||||
+15
-15
@@ -65,7 +65,7 @@ static CompanyID _admin_company_id = CompanyID::Invalid(); ///< For what company
|
||||
*/
|
||||
void UpdateNetworkGameWindow()
|
||||
{
|
||||
InvalidateWindowData(WC_NETWORK_WINDOW, NetworkWindowNumber::Game, 0);
|
||||
InvalidateWindowData(WindowClass::Network, NetworkWindowNumber::Game, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -953,7 +953,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_game_widgets
|
||||
/** Description of the NetworkGameWindow. */
|
||||
static WindowDesc _network_game_window_desc(
|
||||
WindowPosition::Center, "list_servers", 1000, 730,
|
||||
WC_NETWORK_WINDOW, WC_NONE,
|
||||
WindowClass::Network, WindowClass::None,
|
||||
{},
|
||||
_nested_network_game_widgets
|
||||
);
|
||||
@@ -962,7 +962,7 @@ static WindowDesc _network_game_window_desc(
|
||||
void ShowNetworkGameWindow()
|
||||
{
|
||||
static bool first = true;
|
||||
CloseWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::StartServer);
|
||||
CloseWindowById(WindowClass::Network, NetworkWindowNumber::StartServer);
|
||||
|
||||
/* Only show once */
|
||||
if (first) {
|
||||
@@ -1230,7 +1230,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_start_server
|
||||
/** Description of the NetworkStartServerWindow. */
|
||||
static WindowDesc _network_start_server_window_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_WINDOW, WC_NONE,
|
||||
WindowClass::Network, WindowClass::None,
|
||||
{},
|
||||
_nested_network_start_server_window_widgets
|
||||
);
|
||||
@@ -1240,7 +1240,7 @@ static void ShowNetworkStartServerWindow()
|
||||
{
|
||||
if (!NetworkValidateOurClientName()) return;
|
||||
|
||||
CloseWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::Game);
|
||||
CloseWindowById(WindowClass::Network, NetworkWindowNumber::Game);
|
||||
|
||||
new NetworkStartServerWindow(_network_start_server_window_desc);
|
||||
}
|
||||
@@ -1307,7 +1307,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_client_list_widgets
|
||||
/** Description of the NetworkClientListWindow. */
|
||||
static WindowDesc _client_list_desc(
|
||||
WindowPosition::Automatic, "list_clients", 220, 300,
|
||||
WC_CLIENT_LIST, WC_NONE,
|
||||
WindowClass::NetworkClientList, WindowClass::None,
|
||||
{},
|
||||
_nested_client_list_widgets
|
||||
);
|
||||
@@ -2092,7 +2092,7 @@ struct NetworkJoinStatusWindow : Window {
|
||||
*/
|
||||
NetworkJoinStatusWindow(WindowDesc &desc) : Window(desc)
|
||||
{
|
||||
this->parent = FindWindowById(WC_NETWORK_WINDOW, NetworkWindowNumber::Game);
|
||||
this->parent = FindWindowById(WindowClass::Network, NetworkWindowNumber::Game);
|
||||
this->InitNested(NetworkStatusWindowNumber::Join);
|
||||
}
|
||||
|
||||
@@ -2209,7 +2209,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_join_status_
|
||||
/** Description of the NetworkJoinStatusWindow. */
|
||||
static WindowDesc _network_join_status_window_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WindowClass::NetworkStatus, WindowClass::None,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_join_status_window_widgets
|
||||
);
|
||||
@@ -2217,7 +2217,7 @@ static WindowDesc _network_join_status_window_desc(
|
||||
/** Open the window showing the status of joining the server. */
|
||||
void ShowJoinStatusWindow()
|
||||
{
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join);
|
||||
CloseWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join);
|
||||
new NetworkJoinStatusWindow(_network_join_status_window_desc);
|
||||
}
|
||||
|
||||
@@ -2227,7 +2227,7 @@ void ShowJoinStatusWindow()
|
||||
*/
|
||||
void ShowNetworkNeedPassword(std::shared_ptr<NetworkAuthenticationPasswordRequest> request)
|
||||
{
|
||||
NetworkJoinStatusWindow *w = dynamic_cast<NetworkJoinStatusWindow *>(FindWindowById(WC_NETWORK_STATUS_WINDOW, NetworkStatusWindowNumber::Join));
|
||||
NetworkJoinStatusWindow *w = dynamic_cast<NetworkJoinStatusWindow *>(FindWindowById(WindowClass::NetworkStatus, NetworkStatusWindowNumber::Join));
|
||||
if (w == nullptr) return;
|
||||
w->request = std::move(request);
|
||||
|
||||
@@ -2331,7 +2331,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_ask_relay_wi
|
||||
/** Description of the NetworkAskRelayWindow. */
|
||||
static WindowDesc _network_ask_relay_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_ASK_RELAY, WC_NONE,
|
||||
WindowClass::NetworkAskRelay, WindowClass::None,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_ask_relay_widgets
|
||||
);
|
||||
@@ -2344,7 +2344,7 @@ static WindowDesc _network_ask_relay_desc(
|
||||
*/
|
||||
void ShowNetworkAskRelay(std::string_view server_connection_string, std::string &&relay_connection_string, std::string &&token)
|
||||
{
|
||||
CloseWindowByClass(WC_NETWORK_ASK_RELAY, NRWCD_HANDLED);
|
||||
CloseWindowByClass(WindowClass::NetworkAskRelay, NRWCD_HANDLED);
|
||||
|
||||
Window *parent = GetMainWindow();
|
||||
new NetworkAskRelayWindow(_network_ask_relay_desc, parent, server_connection_string, std::move(relay_connection_string), std::move(token));
|
||||
@@ -2436,7 +2436,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_network_ask_survey_w
|
||||
/** Description of the NetworkAskSurveyWindow. */
|
||||
static WindowDesc _network_ask_survey_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_NETWORK_ASK_SURVEY, WC_NONE,
|
||||
WindowClass::NetworkAskSurvey, WindowClass::None,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_ask_survey_widgets
|
||||
);
|
||||
@@ -2449,7 +2449,7 @@ void ShowNetworkAskSurvey()
|
||||
/* If we can't send a survey, don't ask the question. */
|
||||
if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) return;
|
||||
|
||||
CloseWindowByClass(WC_NETWORK_ASK_SURVEY);
|
||||
CloseWindowByClass(WindowClass::NetworkAskSurvey);
|
||||
|
||||
Window *parent = GetMainWindow();
|
||||
new NetworkAskSurveyWindow(_network_ask_survey_desc, parent);
|
||||
@@ -2480,6 +2480,6 @@ struct SurveyResultTextfileWindow : public TextfileWindow {
|
||||
*/
|
||||
void ShowSurveyResultTextfileWindow(Window *parent)
|
||||
{
|
||||
parent->CloseChildWindowById(WC_TEXTFILE, TFT_SURVEY_RESULT);
|
||||
parent->CloseChildWindowById(WindowClass::Textfile, TFT_SURVEY_RESULT);
|
||||
new SurveyResultTextfileWindow(parent, TFT_SURVEY_RESULT);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler()
|
||||
this->savegame = nullptr;
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
}
|
||||
|
||||
std::unique_ptr<Packet> ServerNetworkGameSocketHandler::ReceivePacket()
|
||||
@@ -1071,7 +1071,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::ReceiveClientMapOk(Packet &)
|
||||
std::string client_name = this->GetClientName();
|
||||
|
||||
NetworkTextMessage(NetworkAction::ClientJoin, CC_DEFAULT, false, client_name, "", this->client_id);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
Debug(net, 3, "[{}] Client #{} ({}) joined as {}", ServerNetworkGameSocketHandler::GetName(), this->client_id, this->GetClientIP(), client_name);
|
||||
|
||||
@@ -1489,7 +1489,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::ReceiveClientSetName(Packet &p
|
||||
NetworkTextMessage(NetworkAction::ClientNameChange, CC_DEFAULT, false, ci->client_name, client_name);
|
||||
ci->client_name = std::move(client_name);
|
||||
NetworkUpdateClientInfo(ci->client_id);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
}
|
||||
}
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
@@ -2067,7 +2067,7 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
|
||||
NetworkServerSendChat(NetworkAction::CompanyJoin, NetworkChatDestinationType::Broadcast, 0, company_name, client_id);
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -193,7 +193,7 @@ void GRFConfig::SetValue(const GRFParameterInfo &info, uint32_t value)
|
||||
SB(this->param[info.param_nr], info.first_bit, info.num_bit, value);
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,11 +566,11 @@ void DoScanNewGRFFiles(NewGRFScanCallback *callback)
|
||||
NetworkAfterNewGRFScan();
|
||||
|
||||
/* Yes... these are the NewGRF windows */
|
||||
InvalidateWindowClassesData(WC_SAVELOAD, 0, true);
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState, GOID_NEWGRF_RESCANNED, true);
|
||||
InvalidateWindowClassesData(WindowClass::SaveLoad, 0, true);
|
||||
InvalidateWindowData(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState, GOID_NEWGRF_RESCANNED, true);
|
||||
if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned();
|
||||
|
||||
CloseWindowByClass(WC_MODAL_PROGRESS);
|
||||
CloseWindowByClass(WindowClass::ModalProgress);
|
||||
SetModalProgress(false);
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_inspect_widge
|
||||
/** Window definition for the NewGRF chain inspection window. */
|
||||
static WindowDesc _newgrf_inspect_chain_desc(
|
||||
WindowPosition::Automatic, "newgrf_inspect_chain", 400, 300,
|
||||
WC_NEWGRF_INSPECT, WC_NONE,
|
||||
WindowClass::NewGRFInspect, WindowClass::None,
|
||||
{},
|
||||
_nested_newgrf_inspect_chain_widgets
|
||||
);
|
||||
@@ -689,7 +689,7 @@ static WindowDesc _newgrf_inspect_chain_desc(
|
||||
/** Window definition for the NewGRF inspection window. */
|
||||
static WindowDesc _newgrf_inspect_desc(
|
||||
WindowPosition::Automatic, "newgrf_inspect", 400, 300,
|
||||
WC_NEWGRF_INSPECT, WC_NONE,
|
||||
WindowClass::NewGRFInspect, WindowClass::None,
|
||||
{},
|
||||
_nested_newgrf_inspect_widgets
|
||||
);
|
||||
@@ -726,7 +726,7 @@ void InvalidateNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||
if (feature == GrfSpecFeature::Invalid) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
InvalidateWindowData(WC_NEWGRF_INSPECT, wno);
|
||||
InvalidateWindowData(WindowClass::NewGRFInspect, wno);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -742,12 +742,12 @@ void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||
if (feature == GrfSpecFeature::Invalid) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
CloseWindowById(WC_NEWGRF_INSPECT, wno);
|
||||
CloseWindowById(WindowClass::NewGRFInspect, wno);
|
||||
|
||||
/* Reinitialise the land information window to remove the "debug" sprite if needed.
|
||||
* Note: Since we might be called from a command here, it is important to not execute
|
||||
* the invalidation immediately. The landinfo window tests commands itself. */
|
||||
InvalidateWindowData(WC_LAND_INFO, 0, 1);
|
||||
InvalidateWindowData(WindowClass::LandInfo, 0, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1188,7 +1188,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_sprite_aligner_widge
|
||||
/** Window definition for the sprite aligner window. */
|
||||
static WindowDesc _sprite_aligner_desc(
|
||||
WindowPosition::Automatic, "sprite_aligner", 400, 300,
|
||||
WC_SPRITE_ALIGNER, WC_NONE,
|
||||
WindowClass::SpriteAligner, WindowClass::None,
|
||||
{},
|
||||
_nested_sprite_aligner_widgets
|
||||
);
|
||||
|
||||
+41
-41
@@ -335,7 +335,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
if (this->editable && !this->action14present && !this->grf_config.param.empty()) {
|
||||
this->grf_config.param.pop_back();
|
||||
this->InvalidateData();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -343,7 +343,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
if (this->editable && !this->action14present && this->grf_config.param.size() < this->grf_config.num_valid_params) {
|
||||
this->grf_config.param.emplace_back(0);
|
||||
this->InvalidateData();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -353,8 +353,8 @@ struct NewGRFParametersWindow : public Window {
|
||||
if (num >= this->vscroll->GetCount()) break;
|
||||
|
||||
if (this->clicked_row != num) {
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_row = num;
|
||||
this->clicked_dropdown = false;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
if (par_info.type != GRFParameterType::Bool && IsInsideMM(x, 0, SETTING_BUTTON_WIDTH) && par_info.complete_labels) {
|
||||
if (this->clicked_dropdown) {
|
||||
/* unclick the dropdown */
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_dropdown = false;
|
||||
this->closing_dropdown = false;
|
||||
} else {
|
||||
@@ -430,7 +430,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
if (!this->editable) break;
|
||||
this->grf_config.SetParameterDefaults();
|
||||
this->InvalidateData();
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
this->vscroll->SetCount(this->action14present ? this->grf_config.num_valid_params : this->grf_config.param.size());
|
||||
if (this->clicked_row != INT32_MAX && this->clicked_row >= this->vscroll->GetCount()) {
|
||||
this->clicked_row = INT32_MAX;
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,14 +534,14 @@ static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_parameter_wid
|
||||
/** Window definition for the change grf parameters window */
|
||||
static WindowDesc _newgrf_parameters_desc(
|
||||
WindowPosition::Center, "settings_newgrf_config", 500, 208,
|
||||
WC_GRF_PARAMETERS, WC_NONE,
|
||||
WindowClass::NewGRFParameters, WindowClass::None,
|
||||
{},
|
||||
_nested_newgrf_parameter_widgets
|
||||
);
|
||||
|
||||
void OpenGRFParameterWindow(bool is_baseset, GRFConfig &c, bool editable)
|
||||
{
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
new NewGRFParametersWindow(_newgrf_parameters_desc, is_baseset, c, editable);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ struct NewGRFTextfileWindow : public TextfileWindow {
|
||||
|
||||
void ShowNewGRFTextfileWindow(Window *parent, TextfileType file_type, const GRFConfig *c)
|
||||
{
|
||||
parent->CloseChildWindowById(WC_TEXTFILE, file_type);
|
||||
parent->CloseChildWindowById(WindowClass::Textfile, file_type);
|
||||
new NewGRFTextfileWindow(parent, file_type, c);
|
||||
}
|
||||
|
||||
@@ -662,8 +662,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
CloseWindowByClass(WC_SAVE_PRESET);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
CloseWindowByClass(WindowClass::SavePreset);
|
||||
|
||||
if (this->editable && this->modified && !this->execute && !_exit_game) {
|
||||
CopyGRFConfigList(this->orig_list, this->actives, true);
|
||||
@@ -718,8 +718,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
d->SetParameterDefaults();
|
||||
}
|
||||
if (this->active_sel == c->get()) {
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
this->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
this->CloseChildWindows(WindowClass::Textfile);
|
||||
this->active_sel = nullptr;
|
||||
}
|
||||
*c = std::move(d);
|
||||
@@ -943,7 +943,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
list.push_back(MakeDropDownListStringItem(std::string{this->grf_presets[i]}, i));
|
||||
}
|
||||
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->CloseChildWindows(WindowClass::QueryString); // Remove the parameter query window
|
||||
ShowDropDownList(this, std::move(list), this->preset, WID_NS_PRESET_LIST, 0, DropDownOption::Filterable);
|
||||
break;
|
||||
}
|
||||
@@ -966,7 +966,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
this->grf_presets = GetGRFPresetList();
|
||||
this->preset = -1;
|
||||
this->InvalidateData();
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->CloseChildWindows(WindowClass::QueryString); // Remove the parameter query window
|
||||
break;
|
||||
|
||||
case WID_NS_MOVE_UP: { // Move GRF up
|
||||
@@ -1008,8 +1008,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
this->active_sel = nullptr;
|
||||
}
|
||||
if (this->active_sel != old_sel) {
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
this->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
this->CloseChildWindows(WindowClass::Textfile);
|
||||
}
|
||||
this->avail_sel = nullptr;
|
||||
this->avail_pos = -1;
|
||||
@@ -1025,8 +1025,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
case WID_NS_REMOVE: { // Remove GRF
|
||||
if (this->active_sel == nullptr || !this->editable) break;
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
this->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
this->CloseChildWindows(WindowClass::Textfile);
|
||||
|
||||
/* Choose the next GRF file to be the selected file. */
|
||||
int pos = this->GetCurrentActivePosition();
|
||||
@@ -1061,9 +1061,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
auto it = this->vscroll2->GetScrolledItemFromWidget(this->avails, pt.y, this, WID_NS_AVAIL_LIST, WidgetDimensions::scaled.framerect.top);
|
||||
this->active_sel = nullptr;
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
if (it != std::end(this->avails)) {
|
||||
if (this->avail_sel != *it) this->CloseChildWindows(WC_TEXTFILE);
|
||||
if (this->avail_sel != *it) this->CloseChildWindows(WindowClass::Textfile);
|
||||
this->avail_sel = *it;
|
||||
this->avail_pos = static_cast<int>(std::distance(std::begin(this->avails), it));
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
NewGRFConfirmationCallback
|
||||
);
|
||||
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->CloseChildWindows(WindowClass::QueryString); // Remove the parameter query window
|
||||
break;
|
||||
|
||||
case WID_NS_VIEW_PARAMETERS:
|
||||
@@ -1117,7 +1117,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(GetEncodedString(STR_NETWORK_ERROR_NOTAVAILABLE), {}, WL_ERROR);
|
||||
} else {
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->CloseChildWindows(WindowClass::QueryString); // Remove the parameter query window
|
||||
|
||||
ShowMissingContentWindow(this->actives);
|
||||
}
|
||||
@@ -1132,11 +1132,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
void OnNewGRFsScanned() override
|
||||
{
|
||||
if (this->active_sel == nullptr) this->CloseChildWindows(WC_TEXTFILE);
|
||||
if (this->active_sel == nullptr) this->CloseChildWindows(WindowClass::Textfile);
|
||||
this->avail_sel = nullptr;
|
||||
this->avail_pos = -1;
|
||||
this->avails.ForceRebuild();
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->CloseChildWindows(WindowClass::QueryString); // Remove the parameter query window
|
||||
}
|
||||
|
||||
void OnDropdownSelect(WidgetID widget, int index, int) override
|
||||
@@ -1153,8 +1153,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
this->avails.ForceRebuild();
|
||||
|
||||
ResetObjectToPlace();
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
this->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
this->CloseChildWindows(WindowClass::Textfile);
|
||||
this->active_sel = nullptr;
|
||||
this->InvalidateData(GOID_NEWGRF_CHANGES_MADE);
|
||||
}
|
||||
@@ -1299,8 +1299,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
|
||||
if (this->avail_pos >= 0) {
|
||||
this->active_sel = nullptr;
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
if (this->avail_sel != this->avails[this->avail_pos]) this->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
if (this->avail_sel != this->avails[this->avail_pos]) this->CloseChildWindows(WindowClass::Textfile);
|
||||
this->avail_sel = this->avails[this->avail_pos];
|
||||
this->vscroll2->ScrollTowards(this->avail_pos);
|
||||
this->InvalidateData(0);
|
||||
@@ -1463,7 +1463,7 @@ private:
|
||||
{
|
||||
if (this->avail_sel == nullptr || !this->editable || this->avail_sel->flags.Test(GRFConfigFlag::Invalid)) return false;
|
||||
|
||||
this->CloseChildWindows(WC_TEXTFILE);
|
||||
this->CloseChildWindows(WindowClass::Textfile);
|
||||
|
||||
/* Get number of non-static NewGRFs. */
|
||||
size_t count = std::ranges::count_if(this->actives, [](const auto &gc) { return !gc->flags.Test(GRFConfigFlag::Static); });
|
||||
@@ -1907,7 +1907,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_widgets = {
|
||||
/** Window definition of the manage newgrfs window. */
|
||||
static WindowDesc _newgrf_desc(
|
||||
WindowPosition::Center, "settings_newgrf", 300, 263,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WindowClass::GameOptions, WindowClass::None,
|
||||
{},
|
||||
_nested_newgrf_widgets
|
||||
);
|
||||
@@ -1920,8 +1920,8 @@ static WindowDesc _newgrf_desc(
|
||||
static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
||||
{
|
||||
if (confirmed) {
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
w->CloseChildWindows(WC_TEXTFILE);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
w->CloseChildWindows(WindowClass::Textfile);
|
||||
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w);
|
||||
assert(nw != nullptr);
|
||||
|
||||
@@ -1951,7 +1951,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
||||
w->InvalidateData();
|
||||
|
||||
ReInitAllWindows(false);
|
||||
CloseWindowByClass(WC_BUILD_OBJECT);
|
||||
CloseWindowByClass(WindowClass::BuildObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1967,7 +1967,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
||||
*/
|
||||
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfigList &config)
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
new NewGRFWindow(_newgrf_desc, editable, show_params, exec_changes, config);
|
||||
}
|
||||
|
||||
@@ -1998,7 +1998,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_save_preset_widgets
|
||||
/** Window description of the preset save window. */
|
||||
static WindowDesc _save_preset_desc(
|
||||
WindowPosition::Center, "save_preset", 140, 110,
|
||||
WC_SAVE_PRESET, WC_GAME_OPTIONS,
|
||||
WindowClass::SavePreset, WindowClass::GameOptions,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_save_preset_widgets
|
||||
);
|
||||
@@ -2097,7 +2097,7 @@ struct SavePresetWindow : public Window {
|
||||
}
|
||||
|
||||
case WID_SVP_SAVE: {
|
||||
Window *w = FindWindowById(WC_GAME_OPTIONS, GameOptionsWindowNumber::NewGRFState);
|
||||
Window *w = FindWindowById(WindowClass::GameOptions, GameOptionsWindowNumber::NewGRFState);
|
||||
if (w != nullptr) {
|
||||
auto text = this->presetname_editbox.text.GetText();
|
||||
if (!text.empty()) w->OnQueryTextFinished(std::string{text});
|
||||
@@ -2120,7 +2120,7 @@ struct SavePresetWindow : public Window {
|
||||
*/
|
||||
static void ShowSavePresetWindow(std::string_view initial_text)
|
||||
{
|
||||
CloseWindowByClass(WC_SAVE_PRESET);
|
||||
CloseWindowByClass(WindowClass::SavePreset);
|
||||
new SavePresetWindow(initial_text);
|
||||
}
|
||||
|
||||
@@ -2139,7 +2139,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_scan_progress_widget
|
||||
/** Description of the widgets and other settings of the window. */
|
||||
static WindowDesc _scan_progress_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_MODAL_PROGRESS, WC_NONE,
|
||||
WindowClass::ModalProgress, WindowClass::None,
|
||||
{},
|
||||
_nested_scan_progress_widgets
|
||||
);
|
||||
@@ -2219,7 +2219,7 @@ struct ScanProgressWindow : public Window {
|
||||
*/
|
||||
void UpdateNewGRFScanStatus(uint num, std::string &&name)
|
||||
{
|
||||
ScanProgressWindow *w = dynamic_cast<ScanProgressWindow *>(FindWindowByClass(WC_MODAL_PROGRESS));
|
||||
ScanProgressWindow *w = dynamic_cast<ScanProgressWindow *>(FindWindowByClass(WindowClass::ModalProgress));
|
||||
if (w == nullptr) w = new ScanProgressWindow();
|
||||
w->UpdateNewGRFScanStatus(num, std::move(name));
|
||||
}
|
||||
|
||||
@@ -674,7 +674,7 @@ void IndustryProductionCallback(Industry *ind, int reason)
|
||||
SB(object.callback_param2, 24, 8, again);
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, ind->index);
|
||||
SetWindowDirty(WindowClass::IndustryView, ind->index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+22
-22
@@ -129,7 +129,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_normal_news_widgets
|
||||
/** Window definition for the normal news window. */
|
||||
static WindowDesc _normal_news_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
WindowClass::News, WindowClass::None,
|
||||
{},
|
||||
_nested_normal_news_widgets
|
||||
);
|
||||
@@ -178,7 +178,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_vehicle_news_widgets
|
||||
/** Window definition for the vehicle news window. */
|
||||
static WindowDesc _vehicle_news_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
WindowClass::News, WindowClass::None,
|
||||
{},
|
||||
_nested_vehicle_news_widgets
|
||||
);
|
||||
@@ -224,7 +224,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_company_news_widgets
|
||||
/** Window definition for the company news window. */
|
||||
static WindowDesc _company_news_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
WindowClass::News, WindowClass::None,
|
||||
{},
|
||||
_nested_company_news_widgets
|
||||
);
|
||||
@@ -259,7 +259,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_thin_news_widgets =
|
||||
/** Window definition for the thin news window. */
|
||||
static WindowDesc _thin_news_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
WindowClass::News, WindowClass::None,
|
||||
{},
|
||||
_nested_thin_news_widgets
|
||||
);
|
||||
@@ -298,7 +298,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_small_news_widgets =
|
||||
/** Window definition for the small news window. */
|
||||
static WindowDesc _small_news_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
WindowClass::News, WindowClass::None,
|
||||
{},
|
||||
_nested_small_news_widgets
|
||||
);
|
||||
@@ -367,9 +367,9 @@ struct NewsWindow : Window {
|
||||
NewsWindow(WindowDesc &desc, const NewsItem *ni) : Window(desc), ni(ni)
|
||||
{
|
||||
NewsWindow::duration = 16650;
|
||||
const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
const Window *w = FindWindowByClass(WindowClass::NetworkChat);
|
||||
this->chat_height = (w != nullptr) ? w->height : 0;
|
||||
this->status_height = FindWindowById(WC_STATUS_BAR, 0)->height;
|
||||
this->status_height = FindWindowById(WindowClass::Statusbar, 0)->height;
|
||||
|
||||
this->flags.Set(WindowFlag::DisableVpScroll);
|
||||
|
||||
@@ -718,7 +718,7 @@ static void ShowTicker(NewsIterator ni)
|
||||
if (_settings_client.sound.news_ticker) SndPlayFx(SND_16_NEWS_TICKER);
|
||||
|
||||
_statusbar_news = ni;
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_TICKER);
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_SHOW_TICKER);
|
||||
}
|
||||
|
||||
/** Initialize the news-items data structures */
|
||||
@@ -756,7 +756,7 @@ static bool ReadyForNextNewsItem()
|
||||
if (_forced_news == std::end(_news) && _current_news == std::end(_news)) return true;
|
||||
|
||||
/* neither newsticker nor newspaper are running */
|
||||
return (NewsWindow::duration <= 0 || FindWindowById(WC_NEWS_WINDOW, 0) == nullptr);
|
||||
return (NewsWindow::duration <= 0 || FindWindowById(WindowClass::News, 0) == nullptr);
|
||||
}
|
||||
|
||||
/** Move to the next ticker item */
|
||||
@@ -765,7 +765,7 @@ static void MoveToNextTickerItem()
|
||||
/* There is no status bar, so no reason to show news;
|
||||
* especially important with the end game screen when
|
||||
* there is no status bar but possible news. */
|
||||
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
|
||||
if (FindWindowById(WindowClass::Statusbar, 0) == nullptr) return;
|
||||
|
||||
/* No news to move to. */
|
||||
if (std::empty(_news)) return;
|
||||
@@ -781,7 +781,7 @@ static void MoveToNextTickerItem()
|
||||
switch (_news_type_data[to_underlying(type)].GetDisplay()) {
|
||||
default: NOT_REACHED();
|
||||
case NewsDisplay::Off: // Show nothing only a small reminder in the status bar.
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_REMINDER);
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_SHOW_REMINDER);
|
||||
return;
|
||||
|
||||
case NewsDisplay::Summary: // Show ticker.
|
||||
@@ -800,9 +800,9 @@ static void MoveToNextNewsItem()
|
||||
/* There is no status bar, so no reason to show news;
|
||||
* especially important with the end game screen when
|
||||
* there is no status bar but possible news. */
|
||||
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
|
||||
if (FindWindowById(WindowClass::Statusbar, 0) == nullptr) return;
|
||||
|
||||
CloseWindowById(WC_NEWS_WINDOW, 0); // close the newspapers window if shown
|
||||
CloseWindowById(WindowClass::News, 0); // close the newspapers window if shown
|
||||
_forced_news = std::end(_news);
|
||||
|
||||
/* No news to move to. */
|
||||
@@ -865,7 +865,7 @@ static std::list<NewsItem>::iterator DeleteNewsItem(std::list<NewsItem>::iterato
|
||||
|
||||
if (update_statusbar_news) {
|
||||
/* About to remove the currently displayed item (ticker, or just a reminder) */
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
||||
MoveToNextTickerItem();
|
||||
}
|
||||
|
||||
@@ -928,7 +928,7 @@ void AddNewsItem(EncodedString &&headline, NewsType type, NewsStyle style, NewsF
|
||||
DeleteNewsItem(std::prev(std::end(_news)));
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_MESSAGE_HISTORY, 0);
|
||||
InvalidateWindowData(WindowClass::MessageHistory, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1010,7 +1010,7 @@ void DeleteNews(Tpredicate predicate)
|
||||
++it;
|
||||
}
|
||||
}
|
||||
if (dirty) InvalidateWindowData(WC_MESSAGE_HISTORY, 0);
|
||||
if (dirty) InvalidateWindowData(WindowClass::MessageHistory, 0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -1133,13 +1133,13 @@ static void ShowNewsMessage(NewsIterator ni)
|
||||
assert(!std::empty(_news));
|
||||
|
||||
/* Delete the news window */
|
||||
CloseWindowById(WC_NEWS_WINDOW, 0);
|
||||
CloseWindowById(WindowClass::News, 0);
|
||||
|
||||
/* setup forced news item */
|
||||
_forced_news = ni;
|
||||
|
||||
if (_forced_news != std::end(_news)) {
|
||||
CloseWindowById(WC_NEWS_WINDOW, 0);
|
||||
CloseWindowById(WindowClass::News, 0);
|
||||
ShowNewspaper(&*ni);
|
||||
}
|
||||
}
|
||||
@@ -1150,7 +1150,7 @@ static void ShowNewsMessage(NewsIterator ni)
|
||||
*/
|
||||
bool HideActiveNewsMessage()
|
||||
{
|
||||
NewsWindow *w = dynamic_cast<NewsWindow *>(FindWindowById(WC_NEWS_WINDOW, 0));
|
||||
NewsWindow *w = dynamic_cast<NewsWindow *>(FindWindowById(WindowClass::News, 0));
|
||||
if (w == nullptr) return false;
|
||||
w->Close();
|
||||
return true;
|
||||
@@ -1170,7 +1170,7 @@ void ShowLastNewsMessage()
|
||||
* Treat this as if _forced_news reached the oldest news; so, wrap around and start anew with the latest. */
|
||||
ni = std::begin(_news);
|
||||
} else {
|
||||
const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
|
||||
const Window *w = FindWindowById(WindowClass::News, 0);
|
||||
ni = (w == nullptr || (std::next(_current_news) == std::end(_news))) ? _current_news : std::next(_current_news);
|
||||
}
|
||||
} else if (std::next(_forced_news) == std::end(_news)) {
|
||||
@@ -1317,7 +1317,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_message_history = {
|
||||
/** Window definition for the news message history window. */
|
||||
static WindowDesc _message_history_desc(
|
||||
WindowPosition::Automatic, "list_news", 400, 140,
|
||||
WC_MESSAGE_HISTORY, WC_NONE,
|
||||
WindowClass::MessageHistory, WindowClass::None,
|
||||
{},
|
||||
_nested_message_history
|
||||
);
|
||||
@@ -1325,6 +1325,6 @@ static WindowDesc _message_history_desc(
|
||||
/** Display window with news messages history */
|
||||
void ShowMessageHistory()
|
||||
{
|
||||
CloseWindowById(WC_MESSAGE_HISTORY, 0);
|
||||
CloseWindowById(WindowClass::MessageHistory, 0);
|
||||
new MessageHistoryWindow(_message_history_desc);
|
||||
}
|
||||
|
||||
+4
-4
@@ -350,7 +350,7 @@ CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
hq_score = UpdateCompanyRatingAndValue(c, false);
|
||||
c->location_of_HQ = tile;
|
||||
SetWindowDirty(WC_COMPANY, c->index);
|
||||
SetWindowDirty(WindowClass::Company, c->index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlags flags)
|
||||
Company *c = Company::Get(GetTileOwner(tile));
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
c->location_of_HQ = INVALID_TILE; // reset HQ position
|
||||
SetWindowDirty(WC_COMPANY, c->index);
|
||||
SetWindowDirty(WindowClass::Company, c->index);
|
||||
CargoPacket::InvalidateAllFrom({c->index, SourceType::Headquarters});
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlags flags)
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
Town *town = o->town;
|
||||
town->statues.Reset(GetTileOwner(tile));
|
||||
SetWindowDirty(WC_TOWN_AUTHORITY, town->index);
|
||||
SetWindowDirty(WindowClass::TownAuthority, town->index);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -959,7 +959,7 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
||||
do_clear = true;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
|
||||
SetWindowDirty(WindowClass::TownAuthority, t->index);
|
||||
} else {
|
||||
do_clear = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -411,7 +411,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_object_widgets
|
||||
/** Window definition for the build object window. */
|
||||
static WindowDesc _build_object_desc(
|
||||
WindowPosition::Automatic, "build_object", 0, 0,
|
||||
WC_BUILD_OBJECT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildObject, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_object_widgets,
|
||||
&BuildObjectWindow::hotkeys
|
||||
|
||||
+4
-4
@@ -1178,13 +1178,13 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
if (SaveOrLoad(_file_to_saveload.name, SaveLoadOperation::Save, DetailedFileType::GameFile, Subdirectory::None) != SaveLoadResult::Ok) {
|
||||
ShowErrorMessage(GetSaveLoadErrorType(), GetSaveLoadErrorMessage(), WL_ERROR);
|
||||
} else {
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
CloseWindowById(WindowClass::SaveLoad, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SM_SAVE_HEIGHTMAP: // Save heightmap.
|
||||
MakeHeightmapScreenshot(_file_to_saveload.name);
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
CloseWindowById(WindowClass::SaveLoad, 0);
|
||||
break;
|
||||
|
||||
case SM_GENRANDLAND: // Generate random land within scenario editor
|
||||
@@ -1290,13 +1290,13 @@ static IntervalTimer<TimerGameRealtime> _autosave_interval({std::chrono::millise
|
||||
_pause_mode.Reset(PauseMode::CommandDuringPause);
|
||||
|
||||
_do_autosave = true;
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
SetWindowDirty(WindowClass::Statusbar, 0);
|
||||
|
||||
static FiosNumberedSaveName _autosave_ctr("autosave");
|
||||
DoAutoOrNetsave(_autosave_ctr);
|
||||
|
||||
_do_autosave = false;
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
SetWindowDirty(WindowClass::Statusbar, 0);
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,7 +70,7 @@ void OrderBackup::DoRestore(Vehicle *v)
|
||||
} else if (!this->orders.empty() && OrderList::CanAllocateItem()) {
|
||||
v->orders = OrderList::Create(std::move(this->orders), v);
|
||||
/* Make sure buoys/oil rigs are updated in the station list. */
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StationList, 0);
|
||||
}
|
||||
|
||||
/* Remove backed up name if it's no longer unique. */
|
||||
|
||||
+10
-10
@@ -212,17 +212,17 @@ uint16_t Order::MapOldOrder() const
|
||||
*/
|
||||
void InvalidateVehicleOrder(const Vehicle *v, int data)
|
||||
{
|
||||
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
|
||||
InvalidateWindowData(WindowClass::VehicleView, v->index);
|
||||
|
||||
if (data != 0) {
|
||||
/* Calls SetDirty() too */
|
||||
InvalidateWindowData(WC_VEHICLE_ORDERS, v->index, data);
|
||||
InvalidateWindowData(WC_VEHICLE_TIMETABLE, v->index, data);
|
||||
InvalidateWindowData(WindowClass::VehicleOrders, v->index, data);
|
||||
InvalidateWindowData(WindowClass::VehicleTimetable, v->index, data);
|
||||
return;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_VEHICLE_ORDERS, v->index);
|
||||
SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
|
||||
SetWindowDirty(WindowClass::VehicleOrders, v->index);
|
||||
SetWindowDirty(WindowClass::VehicleTimetable, v->index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,7 +297,7 @@ void OrderList::FreeChain(bool keep_orderlist)
|
||||
if (order.IsType(OT_GOTO_STATION) || order.IsType(OT_GOTO_WAYPOINT)) {
|
||||
BaseStation *bs = BaseStation::GetIfValid(order.GetDestination().ToStationID());
|
||||
if (bs != nullptr && bs->owner == OWNER_NONE) {
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StationList, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,7 @@ void OrderList::InsertOrderAt(Order &&order, VehicleOrderID index)
|
||||
* the list of stations. So, we need to invalidate that window if needed. */
|
||||
if (new_order->IsType(OT_GOTO_STATION) || new_order->IsType(OT_GOTO_WAYPOINT)) {
|
||||
BaseStation *bs = BaseStation::Get(new_order->GetDestination().ToStationID());
|
||||
if (bs->owner == OWNER_NONE) InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
if (bs->owner == OWNER_NONE) InvalidateWindowClassesData(WindowClass::StationList, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,8 +1059,8 @@ CommandCost CmdSkipToOrder(DoCommandFlags flags, VehicleID veh_id, VehicleOrderI
|
||||
InvalidateVehicleOrder(v, VIWD_MODIFY_ORDERS);
|
||||
|
||||
/* We have an aircraft/ship, they have a mini-schedule, so update them all */
|
||||
if (v->type == VehicleType::Aircraft) SetWindowClassesDirty(WC_AIRCRAFT_LIST);
|
||||
if (v->type == VehicleType::Ship) SetWindowClassesDirty(WC_SHIPS_LIST);
|
||||
if (v->type == VehicleType::Aircraft) SetWindowClassesDirty(WindowClass::AircraftList);
|
||||
if (v->type == VehicleType::Ship) SetWindowClassesDirty(WindowClass::ShipList);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -1773,7 +1773,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool
|
||||
if ((v->type == VehicleType::Aircraft && v->current_order.IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : v->current_order.GetType()) == type &&
|
||||
(!hangar || v->type == VehicleType::Aircraft) && v->current_order.GetDestination() == destination) {
|
||||
v->current_order.MakeDummy();
|
||||
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
|
||||
InvalidateWindowData(WindowClass::VehicleView, v->index);
|
||||
}
|
||||
|
||||
if (v->orders == nullptr) continue;
|
||||
|
||||
+6
-6
@@ -1645,7 +1645,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_orders_train_widgets
|
||||
/** Window definition for the train orders window. */
|
||||
static WindowDesc _orders_train_desc(
|
||||
WindowPosition::Automatic, "view_vehicle_orders_train", 384, 100,
|
||||
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
|
||||
WindowClass::VehicleOrders, WindowClass::VehicleView,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_orders_train_widgets,
|
||||
&OrdersWindow::hotkeys
|
||||
@@ -1719,7 +1719,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_orders_widgets = {
|
||||
/** Window definition for the orders window for road vehicles, ships and aircraft. */
|
||||
static WindowDesc _orders_desc(
|
||||
WindowPosition::Automatic, "view_vehicle_orders", 384, 100,
|
||||
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
|
||||
WindowClass::VehicleOrders, WindowClass::VehicleView,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_orders_widgets,
|
||||
&OrdersWindow::hotkeys
|
||||
@@ -1747,7 +1747,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_other_orders_widgets
|
||||
/** Window definition for the orders window for other companies. */
|
||||
static WindowDesc _other_orders_desc(
|
||||
WindowPosition::Automatic, "view_vehicle_orders_competitor", 384, 86,
|
||||
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
|
||||
WindowClass::VehicleOrders, WindowClass::VehicleView,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_other_orders_widgets,
|
||||
&OrdersWindow::hotkeys
|
||||
@@ -1755,9 +1755,9 @@ static WindowDesc _other_orders_desc(
|
||||
|
||||
void ShowOrdersWindow(const Vehicle *v)
|
||||
{
|
||||
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||
CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
|
||||
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return;
|
||||
CloseWindowById(WindowClass::VehicleDetails, v->index, false);
|
||||
CloseWindowById(WindowClass::VehicleTimetable, v->index, false);
|
||||
if (BringWindowToFrontById(WindowClass::VehicleOrders, v->index) != nullptr) return;
|
||||
|
||||
/* Using a different WindowDescs for _local_company causes problems.
|
||||
* Due to this we have to close order windows in ChangeWindowOwner/CloseCompanyWindows,
|
||||
|
||||
+4
-4
@@ -341,7 +341,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_osk_widgets = {
|
||||
/** Window definition for the on screen keyboard window. */
|
||||
static WindowDesc _osk_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_OSK, WC_NONE,
|
||||
WindowClass::OnScreenKeyboard, WindowClass::None,
|
||||
{},
|
||||
_nested_osk_widgets
|
||||
);
|
||||
@@ -391,7 +391,7 @@ void GetKeyboardLayout()
|
||||
*/
|
||||
void ShowOnScreenKeyboard(Window *parent, WidgetID button)
|
||||
{
|
||||
CloseWindowById(WC_OSK, 0);
|
||||
CloseWindowById(WindowClass::OnScreenKeyboard, 0);
|
||||
|
||||
GetKeyboardLayout();
|
||||
new OskWindow(_osk_desc, parent, button);
|
||||
@@ -406,7 +406,7 @@ void ShowOnScreenKeyboard(Window *parent, WidgetID button)
|
||||
*/
|
||||
void UpdateOSKOriginalText(const Window *parent, WidgetID button)
|
||||
{
|
||||
OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0));
|
||||
OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WindowClass::OnScreenKeyboard, 0));
|
||||
if (osk == nullptr || osk->parent != parent || osk->text_btn != button) return;
|
||||
|
||||
osk->orig_str = osk->qs->text.GetText();
|
||||
@@ -422,6 +422,6 @@ void UpdateOSKOriginalText(const Window *parent, WidgetID button)
|
||||
*/
|
||||
bool IsOSKOpenedFor(const Window *w, WidgetID button)
|
||||
{
|
||||
OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0));
|
||||
OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WindowClass::OnScreenKeyboard, 0));
|
||||
return osk != nullptr && osk->parent == w && osk->text_btn == button;
|
||||
}
|
||||
|
||||
+12
-12
@@ -464,7 +464,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int)
|
||||
this->InvalidateData({PickerInvalidation::Type, PickerInvalidation::Position, PickerInvalidation::Validate});
|
||||
}
|
||||
SndClickBeep();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -522,13 +522,13 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int)
|
||||
this->InvalidateData(PickerInvalidation::Position);
|
||||
}
|
||||
SndClickBeep();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_PW_COLEC_LIST: {
|
||||
ShowDropDownList(this, this->BuildCollectionDropDownList(), -1, widget, 0, DropDownOption::Filterable);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int)
|
||||
|
||||
case WID_PW_COLEC_RENAME:
|
||||
if (this->callbacks.saved.contains(this->callbacks.sel_collection)) {
|
||||
CloseChildWindows(WC_CONFIRM_POPUP_QUERY);
|
||||
CloseChildWindows(WindowClass::ConfirmPopupQuery);
|
||||
this->callbacks.edit_collection = this->callbacks.sel_collection;
|
||||
this->callbacks.rename_collection = true;
|
||||
ShowQueryString(this->callbacks.sel_collection, STR_PICKER_COLLECTION_RENAME_QUERY, MAX_LENGTH_GROUP_NAME_CHARS, this, CS_ALPHANUMERAL, QueryStringFlag::LengthIsInChars);
|
||||
@@ -548,7 +548,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int)
|
||||
|
||||
case WID_PW_COLEC_DELETE:
|
||||
if (this->callbacks.saved.contains(this->callbacks.sel_collection)) {
|
||||
CloseChildWindows(WC_QUERY_STRING);
|
||||
CloseChildWindows(WindowClass::QueryString);
|
||||
this->callbacks.edit_collection = this->callbacks.sel_collection;
|
||||
|
||||
this->inactive.contains(this->callbacks.sel_collection) ?
|
||||
@@ -628,7 +628,7 @@ void PickerWindow::OnDropdownSelect(WidgetID widget, int index, int click_result
|
||||
if (reopen) {
|
||||
ReplaceDropDownList(this, BuildBadgeClassConfigurationList(this->badge_classes, 1, {}, Colours::DarkGreen), -1);
|
||||
} else {
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
}
|
||||
|
||||
/* We need to refresh if a filter is removed. */
|
||||
@@ -1009,10 +1009,10 @@ std::unique_ptr<NWidgetBase> MakePickerTypeWidgets()
|
||||
|
||||
void InvalidateAllPickerWindows()
|
||||
{
|
||||
InvalidateWindowClassesData(WC_BUS_STATION, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WC_TRUCK_STATION, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WC_SELECT_STATION, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WC_BUILD_WAYPOINT, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WC_BUILD_OBJECT, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WC_BUILD_HOUSE, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::BuildBusStation, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::BuildTruckStation, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::JoinStation, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::BuildWaypoint, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::BuildObject, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
InvalidateWindowClassesData(WindowClass::BuildHouse, PickerWindow::PICKER_INVALIDATION_ALL);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1641,8 +1641,8 @@ CommandCost CmdConvertRail(DoCommandFlags flags, TileIndex tile, TileIndex area_
|
||||
YapfNotifyTrackLayoutChange(tile, GetRailDepotTrack(tile));
|
||||
|
||||
/* Update build vehicle window related to this depot */
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
|
||||
InvalidateWindowData(WC_BUILD_VEHICLE, tile);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, tile);
|
||||
InvalidateWindowData(WindowClass::BuildVehicle, tile);
|
||||
}
|
||||
found_convertible_track = true;
|
||||
cost.AddCost(RailConvertCost(type, totype));
|
||||
@@ -3016,7 +3016,7 @@ static VehicleEnterTileStates VehicleEnterTile_Rail(Vehicle *v, TileIndex tile,
|
||||
}
|
||||
v->tile = tile;
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, v->tile);
|
||||
return VehicleEnterTileState::EnteredWormhole;
|
||||
}
|
||||
|
||||
|
||||
+36
-36
@@ -275,7 +275,7 @@ static void GenericPlaceSignals(TileIndex tile)
|
||||
}
|
||||
}
|
||||
|
||||
if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr) {
|
||||
if (FindWindowById(WindowClass::BuildSignal, 0) != nullptr) {
|
||||
/* signal GUI is used */
|
||||
Command<Commands::BuildSignal>::Post(_convert_signal_button ? STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
||||
tile, track, _cur_signal_type, _cur_signal_variant, _convert_signal_button, false, _ctrl_pressed, cycle_start, cycle_end, 0, 0);
|
||||
@@ -325,7 +325,7 @@ void CcBuildRailTunnel(Commands, const CommandCost &result, TileIndex tile)
|
||||
*/
|
||||
static void ToggleRailButton_Remove(Window *w)
|
||||
{
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
w->ToggleWidgetLoweredState(WID_RAT_REMOVE);
|
||||
w->SetWidgetDirty(WID_RAT_REMOVE);
|
||||
_remove_button_clicked = w->IsWidgetLowered(WID_RAT_REMOVE);
|
||||
@@ -431,7 +431,7 @@ static void HandleAutoSignalPlacement()
|
||||
Command<Commands::RemoveSignalLong>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL,
|
||||
TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, _ctrl_pressed);
|
||||
} else {
|
||||
bool sig_gui = FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr;
|
||||
bool sig_gui = FindWindowById(WindowClass::BuildSignal, 0) != nullptr;
|
||||
SignalType sigtype = sig_gui ? _cur_signal_type : _settings_client.gui.default_signal_type;
|
||||
SignalVariant sigvar = sig_gui ? _cur_signal_variant : (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||
Command<Commands::BuildSignalLong>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL,
|
||||
@@ -459,8 +459,8 @@ struct BuildRailToolbarWindow : Window {
|
||||
{
|
||||
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true);
|
||||
if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) SetViewportCatchmentWaypoint(nullptr, true);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WindowClass::ScenarioGenerateLandscape, 0, false);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -484,11 +484,11 @@ struct BuildRailToolbarWindow : Window {
|
||||
bool can_build = CanBuildVehicleInfrastructure(VehicleType::Train);
|
||||
for (const WidgetID widget : can_build_widgets) this->SetWidgetDisabledState(widget, !can_build);
|
||||
if (!can_build) {
|
||||
CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::BuildSignal, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildWaypoint, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
|
||||
{
|
||||
/* no dragging if you have pressed the convert button */
|
||||
if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr && _convert_signal_button && this->IsWidgetLowered(WID_RAT_BUILD_SIGNALS)) return;
|
||||
if (FindWindowById(WindowClass::BuildSignal, 0) != nullptr && _convert_signal_button && this->IsWidgetLowered(WID_RAT_BUILD_SIGNALS)) return;
|
||||
|
||||
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
|
||||
}
|
||||
@@ -817,12 +817,12 @@ struct BuildRailToolbarWindow : Window {
|
||||
this->DisableWidget(WID_RAT_REMOVE);
|
||||
this->SetWidgetDirty(WID_RAT_REMOVE);
|
||||
|
||||
CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||
CloseWindowById(WindowClass::BuildSignal, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildStation, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::BuildWaypoint, TRANSPORT_RAIL);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
CloseWindowByClass(WindowClass::BuildBridge);
|
||||
}
|
||||
|
||||
void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile) override
|
||||
@@ -861,7 +861,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
|
||||
/* Update cursor and all sub windows. */
|
||||
if (_thd.GetCallbackWnd() == this) SetCursor(this->GetCursorForWidget(this->last_user_action), PAL_NONE);
|
||||
for (WindowClass cls : {WC_BUILD_STATION, WC_BUILD_SIGNAL, WC_BUILD_WAYPOINT, WC_BUILD_DEPOT}) SetWindowDirty(cls, TRANSPORT_RAIL);
|
||||
for (WindowClass cls : {WindowClass::BuildStation, WindowClass::BuildSignal, WindowClass::BuildWaypoint, WindowClass::BuildDepot}) SetWindowDirty(cls, TRANSPORT_RAIL);
|
||||
|
||||
return ES_HANDLED;
|
||||
}
|
||||
@@ -945,7 +945,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_rail_widgets =
|
||||
/** Window definition for the rail toolbar. */
|
||||
static WindowDesc _build_rail_desc(
|
||||
WindowPosition::Manual, "toolbar_rail", 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::BuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_rail_widgets,
|
||||
&BuildRailToolbarWindow::hotkeys
|
||||
@@ -965,7 +965,7 @@ Window *ShowBuildRailToolbar(RailType railtype)
|
||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
if (!ValParamRailType(railtype)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
CloseWindowByClass(WindowClass::BuildToolbar);
|
||||
_cur_railtype = railtype;
|
||||
_remove_button_clicked = false;
|
||||
return new BuildRailToolbarWindow(_build_rail_desc, railtype);
|
||||
@@ -1155,7 +1155,7 @@ public:
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
this->PickerWindow::Close();
|
||||
}
|
||||
|
||||
@@ -1286,7 +1286,7 @@ public:
|
||||
this->LowerWidget(WID_BRAS_PLATFORM_DIR_X + _station_gui.axis);
|
||||
SndClickBeep();
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
|
||||
case WID_BRAS_PLATFORM_NUM_1:
|
||||
@@ -1318,7 +1318,7 @@ public:
|
||||
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
||||
SndClickBeep();
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1351,7 +1351,7 @@ public:
|
||||
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
||||
SndClickBeep();
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@ public:
|
||||
this->SetWidgetLoweredState(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop);
|
||||
SndClickBeep();
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1419,7 +1419,7 @@ public:
|
||||
static EventState BuildRailStationGlobalHotkeys(int hotkey)
|
||||
{
|
||||
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
|
||||
Window *w = ShowStationBuilder(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL));
|
||||
Window *w = ShowStationBuilder(FindWindowById(WindowClass::BuildToolbar, TRANSPORT_RAIL));
|
||||
if (w == nullptr) return ES_NOT_HANDLED;
|
||||
return w->OnHotkey(hotkey);
|
||||
}
|
||||
@@ -1485,7 +1485,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_station_builder_widg
|
||||
/** High level window description of the station-build window (default & newGRF) */
|
||||
static WindowDesc _station_builder_desc(
|
||||
WindowPosition::Automatic, "build_station_rail", 0, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildStation, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_station_builder_widgets,
|
||||
&BuildRailStationWindow::hotkeys
|
||||
@@ -1626,7 +1626,7 @@ public:
|
||||
|
||||
/* If 'remove' button of rail build toolbar is active, disable it. */
|
||||
if (_remove_button_clicked) {
|
||||
Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
|
||||
Window *w = FindWindowById(WindowClass::BuildToolbar, TRANSPORT_RAIL);
|
||||
if (w != nullptr) ToggleRailButton_Remove(w);
|
||||
}
|
||||
|
||||
@@ -1641,14 +1641,14 @@ public:
|
||||
case WID_BS_DRAG_SIGNALS_DENSITY_DECREASE:
|
||||
if (_settings_client.gui.drag_signals_density > 1) {
|
||||
_settings_client.gui.drag_signals_density--;
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameSettings);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameSettings);
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_BS_DRAG_SIGNALS_DENSITY_INCREASE:
|
||||
if (_settings_client.gui.drag_signals_density < 20) {
|
||||
_settings_client.gui.drag_signals_density++;
|
||||
SetWindowDirty(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameSettings);
|
||||
SetWindowDirty(WindowClass::GameOptions, GameOptionsWindowNumber::GameSettings);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1743,7 +1743,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_signal_builder_widge
|
||||
/** Signal selection window description */
|
||||
static WindowDesc _signal_builder_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildSignal, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_signal_builder_widgets
|
||||
);
|
||||
@@ -1826,7 +1826,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_depot_widgets
|
||||
/** Window definition for the build rail depot window. */
|
||||
static WindowDesc _build_depot_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildDepot, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_depot_widgets
|
||||
);
|
||||
@@ -1947,7 +1947,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_waypoint_widge
|
||||
/** Window definition for the build rail waypoint window. */
|
||||
static WindowDesc _build_waypoint_desc(
|
||||
WindowPosition::Automatic, "build_waypoint", 0, 0,
|
||||
WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildWaypoint, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_waypoint_widgets,
|
||||
&BuildRailWaypointWindow::hotkeys
|
||||
@@ -1979,7 +1979,7 @@ void ReinitGuiAfterToggleElrail(bool disable)
|
||||
{
|
||||
if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) {
|
||||
_last_built_railtype = _cur_railtype = RAILTYPE_RAIL;
|
||||
BuildRailToolbarWindow *w = dynamic_cast<BuildRailToolbarWindow *>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL));
|
||||
BuildRailToolbarWindow *w = dynamic_cast<BuildRailToolbarWindow *>(FindWindowById(WindowClass::BuildToolbar, TRANSPORT_RAIL));
|
||||
if (w != nullptr) w->ModifyRailType(_cur_railtype);
|
||||
}
|
||||
MarkWholeScreenDirty();
|
||||
@@ -2027,7 +2027,7 @@ void SetDefaultRailGui()
|
||||
}
|
||||
|
||||
_last_built_railtype = _cur_railtype = rt;
|
||||
BuildRailToolbarWindow *w = dynamic_cast<BuildRailToolbarWindow *>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL));
|
||||
BuildRailToolbarWindow *w = dynamic_cast<BuildRailToolbarWindow *>(FindWindowById(WindowClass::BuildToolbar, TRANSPORT_RAIL));
|
||||
if (w != nullptr) w->ModifyRailType(_cur_railtype);
|
||||
}
|
||||
|
||||
@@ -2040,7 +2040,7 @@ void ResetSignalVariant(int32_t)
|
||||
SignalVariant new_variant = (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||
|
||||
if (new_variant != _cur_signal_variant) {
|
||||
Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
|
||||
Window *w = FindWindowById(WindowClass::BuildSignal, 0);
|
||||
if (w != nullptr) {
|
||||
w->SetDirty();
|
||||
w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? WID_BS_ELECTRIC_NORM : WID_BS_SEMAPHORE_NORM) + _cur_signal_type);
|
||||
|
||||
+3
-3
@@ -2308,7 +2308,7 @@ static VehicleEnterTileStates VehicleEnterTile_Road(Vehicle *v, TileIndex tile,
|
||||
if (rv->Next() == nullptr) VehicleEnterDepot(rv->First());
|
||||
rv->tile = tile;
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, rv->tile);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, rv->tile);
|
||||
return VehicleEnterTileState::EnteredWormhole;
|
||||
}
|
||||
break;
|
||||
@@ -2579,8 +2579,8 @@ CommandCost CmdConvertRoad(DoCommandFlags flags, TileIndex tile, TileIndex area_
|
||||
|
||||
if (IsRoadDepotTile(tile)) {
|
||||
/* Update build vehicle window related to this depot */
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
|
||||
InvalidateWindowData(WC_BUILD_VEHICLE, tile);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, tile);
|
||||
InvalidateWindowData(WindowClass::BuildVehicle, tile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
+32
-32
@@ -368,7 +368,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
if (_game_mode == GM_NORMAL && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WindowClass::ScenarioGenerateLandscape, 0, false);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
@@ -396,10 +396,10 @@ struct BuildRoadToolbarWindow : Window {
|
||||
WID_ROT_BUS_STATION,
|
||||
WID_ROT_TRUCK_STATION);
|
||||
if (!can_build) {
|
||||
CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildBusStation, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildTruckStation, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildWaypoint, TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
if (_game_mode != GM_EDITOR) {
|
||||
@@ -603,7 +603,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
case WID_ROT_REMOVE:
|
||||
if (this->IsWidgetDisabled(WID_ROT_REMOVE)) return;
|
||||
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
ToggleRoadButton_Remove(this);
|
||||
SndClickBeep();
|
||||
break;
|
||||
@@ -634,7 +634,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
this->ModifyRoadType(_cur_roadtype);
|
||||
|
||||
if (_thd.GetCallbackWnd() == this) SetCursor(this->GetCursorForWidget(this->last_started_action), PAL_NONE);
|
||||
for (WindowClass cls : {WC_BUS_STATION, WC_TRUCK_STATION, WC_BUILD_WAYPOINT, WC_BUILD_DEPOT}) SetWindowDirty(cls, TRANSPORT_ROAD);
|
||||
for (WindowClass cls : {WindowClass::BuildBusStation, WindowClass::BuildTruckStation, WindowClass::BuildWaypoint, WindowClass::BuildDepot}) SetWindowDirty(cls, TRANSPORT_ROAD);
|
||||
|
||||
return ES_HANDLED;
|
||||
}
|
||||
@@ -721,12 +721,12 @@ struct BuildRoadToolbarWindow : Window {
|
||||
this->SetWidgetDirty(WID_ROT_ONE_WAY);
|
||||
}
|
||||
|
||||
CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_ROAD);
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||
CloseWindowById(WindowClass::BuildBusStation, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildTruckStation, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildDepot, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::BuildWaypoint, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
CloseWindowByClass(WindowClass::BuildBridge);
|
||||
}
|
||||
|
||||
void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
|
||||
@@ -997,7 +997,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_road_widgets =
|
||||
/** Window definition for the road toolbar. */
|
||||
static WindowDesc _build_road_desc(
|
||||
WindowPosition::Manual, "toolbar_road", 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::BuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_road_widgets,
|
||||
&BuildRoadToolbarWindow::road_hotkeys
|
||||
@@ -1043,7 +1043,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_tramway_widget
|
||||
/** Window definition for the tram toolbar. */
|
||||
static WindowDesc _build_tramway_desc(
|
||||
WindowPosition::Manual, "toolbar_tramway", 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::BuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_tramway_widgets,
|
||||
&BuildRoadToolbarWindow::tram_hotkeys
|
||||
@@ -1062,7 +1062,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype)
|
||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||
if (!ValParamRoadType(roadtype)) return nullptr;
|
||||
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
CloseWindowByClass(WindowClass::BuildToolbar);
|
||||
_cur_roadtype = roadtype;
|
||||
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? _build_road_desc : _build_tramway_desc, TRANSPORT_ROAD);
|
||||
@@ -1102,7 +1102,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_road_scen_widg
|
||||
/** Window definition for the road toolbar of the scenario editor. */
|
||||
static WindowDesc _build_road_scen_desc(
|
||||
WindowPosition::Automatic, "toolbar_road_scen", 0, 0,
|
||||
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::ScenarioBuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_road_scen_widgets,
|
||||
&BuildRoadToolbarWindow::road_hotkeys
|
||||
@@ -1140,7 +1140,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_tramway_scen_w
|
||||
/** Window definition for the tram toolbar of the scenario editor. */
|
||||
static WindowDesc _build_tramway_scen_desc(
|
||||
WindowPosition::Automatic, "toolbar_tram_scen", 0, 0,
|
||||
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
|
||||
WindowClass::ScenarioBuildToolbar, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_tramway_scen_widgets,
|
||||
&BuildRoadToolbarWindow::tram_hotkeys
|
||||
@@ -1153,7 +1153,7 @@ static WindowDesc _build_tramway_scen_desc(
|
||||
*/
|
||||
Window *ShowBuildRoadScenToolbar(RoadType roadtype)
|
||||
{
|
||||
CloseWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
||||
CloseWindowById(WindowClass::ScenarioBuildToolbar, TRANSPORT_ROAD);
|
||||
_cur_roadtype = roadtype;
|
||||
|
||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? _build_road_scen_desc : _build_tramway_scen_desc, TRANSPORT_ROAD);
|
||||
@@ -1239,7 +1239,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_road_depot_wid
|
||||
/** Window definition for the build road depot window. */
|
||||
static WindowDesc _build_road_depot_desc(
|
||||
WindowPosition::Automatic, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildDepot, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_road_depot_widgets
|
||||
);
|
||||
@@ -1385,7 +1385,7 @@ private:
|
||||
_roadstop_gui.orientation = DIAGDIR_END;
|
||||
this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation);
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1410,12 +1410,12 @@ public:
|
||||
this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation);
|
||||
this->LowerWidget(WID_BROS_LT_OFF + _settings_client.gui.station_show_coverage);
|
||||
|
||||
this->window_class = (rs == RoadStopType::Bus) ? WC_BUS_STATION : WC_TRUCK_STATION;
|
||||
this->window_class = (rs == RoadStopType::Bus) ? WindowClass::BuildBusStation : WindowClass::BuildTruckStation;
|
||||
}
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
this->PickerWindow::Close();
|
||||
}
|
||||
|
||||
@@ -1434,7 +1434,7 @@ public:
|
||||
|
||||
this->DrawWidgets();
|
||||
|
||||
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WC_BUS_STATION) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
||||
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WindowClass::BuildBusStation) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
||||
if (_settings_client.gui.station_show_coverage) {
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
} else {
|
||||
@@ -1444,7 +1444,7 @@ public:
|
||||
if (this->IsShaded()) return;
|
||||
|
||||
/* 'Accepts' and 'Supplies' texts. */
|
||||
StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY;
|
||||
StationCoverageType sct = (this->window_class == WindowClass::BuildBusStation) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY;
|
||||
Rect r = this->GetWidget<NWidgetBase>(WID_BROS_ACCEPTANCE)->GetCurrentRect();
|
||||
const int bottom = r.bottom;
|
||||
r.bottom = INT_MAX; // Allow overflow as we want to know the required height.
|
||||
@@ -1491,8 +1491,8 @@ public:
|
||||
StationType GetRoadStationTypeByWindowClass(WindowClass window_class) const
|
||||
{
|
||||
switch (window_class) {
|
||||
case WC_BUS_STATION: return StationType::Bus;
|
||||
case WC_TRUCK_STATION: return StationType::Truck;
|
||||
case WindowClass::BuildBusStation: return StationType::Bus;
|
||||
case WindowClass::BuildTruckStation: return StationType::Truck;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1547,7 +1547,7 @@ public:
|
||||
this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation);
|
||||
SndClickBeep();
|
||||
this->SetDirty();
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
break;
|
||||
|
||||
case WID_BROS_LT_OFF:
|
||||
@@ -1637,7 +1637,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_road_station_picker_
|
||||
/** Window definition for the build road station window. */
|
||||
static WindowDesc _road_station_picker_desc(
|
||||
WindowPosition::Automatic, "build_station_road", 0, 0,
|
||||
WC_BUS_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildBusStation, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_road_station_picker_widgets,
|
||||
&BuildRoadStationWindow::road_hotkeys
|
||||
@@ -1678,7 +1678,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_tram_station_picker_
|
||||
/** Window definition for the build tram station window. */
|
||||
static WindowDesc _tram_station_picker_desc(
|
||||
WindowPosition::Automatic, "build_station_tram", 0, 0,
|
||||
WC_BUS_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildBusStation, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_tram_station_picker_widgets,
|
||||
&BuildRoadStationWindow::tram_hotkeys
|
||||
@@ -1801,7 +1801,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_build_road_waypoint_
|
||||
/** Window definition for the build road waypoint window. */
|
||||
static WindowDesc _build_road_waypoint_desc(
|
||||
WindowPosition::Automatic, "build_road_waypoint", 0, 0,
|
||||
WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR,
|
||||
WindowClass::BuildWaypoint, WindowClass::BuildToolbar,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_road_waypoint_widgets,
|
||||
&BuildRoadWaypointWindow::hotkeys
|
||||
@@ -1826,7 +1826,7 @@ void InitializeRoadGui()
|
||||
*/
|
||||
void InitializeRoadGUI()
|
||||
{
|
||||
BuildRoadToolbarWindow *w = dynamic_cast<BuildRoadToolbarWindow *>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_ROAD));
|
||||
BuildRoadToolbarWindow *w = dynamic_cast<BuildRoadToolbarWindow *>(FindWindowById(WindowClass::BuildToolbar, TRANSPORT_ROAD));
|
||||
if (w != nullptr) w->ModifyRoadType(_cur_roadtype);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1049,7 +1049,7 @@ bool RoadVehLeaveDepot(RoadVehicle *v, bool first)
|
||||
v->UpdatePosition();
|
||||
v->UpdateInclination(true, true);
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, v->tile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1552,7 +1552,7 @@ again:
|
||||
if (IsBayRoadStopTile(v->tile)) rs->SetEntranceBusy(true);
|
||||
|
||||
StartRoadVehSound(v);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
/* Check tile position conditions - i.e. stop position in depot,
|
||||
@@ -1699,7 +1699,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
|
||||
* suddenly moved farther away, we continue our normal
|
||||
* schedule? */
|
||||
v->current_order.MakeDummy();
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1715,7 +1715,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
|
||||
SetBit(v->gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
|
||||
v->current_order.MakeGoToDepot(depot, OrderDepotTypeFlag::Service);
|
||||
v->SetDestTile(rfdd.tile);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
/** Calender day handler */
|
||||
@@ -1747,8 +1747,8 @@ void RoadVehicle::OnNewEconomyDay()
|
||||
|
||||
SubtractMoneyFromCompanyFract(this->owner, cost);
|
||||
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||
SetWindowClassesDirty(WC_ROADVEH_LIST);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, this->index);
|
||||
SetWindowClassesDirty(WindowClass::RoadVehicleList);
|
||||
}
|
||||
|
||||
Trackdir RoadVehicle::GetVehicleTrackdir() const
|
||||
|
||||
@@ -3499,10 +3499,10 @@ void ReloadNewGRFData()
|
||||
/* Delete news referring to no longer existing entities */
|
||||
DeleteInvalidEngineNews();
|
||||
/* Update livery selection windows */
|
||||
for (CompanyID i = CompanyID::Begin(); i < MAX_COMPANIES; ++i) InvalidateWindowData(WC_COMPANY_COLOUR, i);
|
||||
for (CompanyID i = CompanyID::Begin(); i < MAX_COMPANIES; ++i) InvalidateWindowData(WindowClass::CompanyLivery, i);
|
||||
/* Update company infrastructure counts. */
|
||||
InvalidateWindowClassesData(WC_COMPANY_INFRASTRUCTURE);
|
||||
InvalidateWindowClassesData(WC_BUILD_TOOLBAR);
|
||||
InvalidateWindowClassesData(WindowClass::CompanyInfrastructure);
|
||||
InvalidateWindowClassesData(WindowClass::BuildToolbar);
|
||||
InvalidateAllPickerWindows();
|
||||
/* redraw the whole screen */
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
@@ -40,7 +40,7 @@ ZoomLevel _saved_scrollpos_zoom;
|
||||
void SaveViewportBeforeSaveGame()
|
||||
{
|
||||
/* Don't use GetMainWindow() in case the window does not exist. */
|
||||
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
const Window *w = FindWindowById(WindowClass::MainWindow, 0);
|
||||
if (w == nullptr || w->viewport == nullptr) {
|
||||
/* Ensure saved position is clearly invalid. */
|
||||
_saved_scrollpos_x = INT_MAX;
|
||||
|
||||
@@ -2963,7 +2963,7 @@ static void SaveFileStart()
|
||||
{
|
||||
SetMouseCursorBusy(true);
|
||||
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_START);
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_SAVELOAD_START);
|
||||
_sl.saveinprogress = true;
|
||||
}
|
||||
|
||||
@@ -2972,7 +2972,7 @@ static void SaveFileDone()
|
||||
{
|
||||
SetMouseCursorBusy(false);
|
||||
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_FINISH);
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_SAVELOAD_FINISH);
|
||||
_sl.saveinprogress = false;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
||||
@@ -67,14 +67,14 @@ static constexpr std::initializer_list<NWidgetPart> _nested_screenshot = {
|
||||
/** Window definition for the screenshot window. */
|
||||
static WindowDesc _screenshot_window_desc(
|
||||
WindowPosition::Automatic, "take_a_screenshot", 200, 100,
|
||||
WC_SCREENSHOT, WC_NONE,
|
||||
WindowClass::Screenshot, WindowClass::None,
|
||||
{},
|
||||
_nested_screenshot
|
||||
);
|
||||
|
||||
void ShowScreenshotWindow()
|
||||
{
|
||||
CloseWindowById(WC_SCREENSHOT, 0);
|
||||
CloseWindowById(WindowClass::Screenshot, 0);
|
||||
new ScreenshotWindow(_screenshot_window_desc);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void ShowScreenshotWindow()
|
||||
*/
|
||||
void SetScreenshotWindowVisibility(bool hide)
|
||||
{
|
||||
ScreenshotWindow *scw = dynamic_cast<ScreenshotWindow *>(FindWindowById(WC_SCREENSHOT, 0));
|
||||
ScreenshotWindow *scw = dynamic_cast<ScreenshotWindow *>(FindWindowById(WindowClass::Screenshot, 0));
|
||||
|
||||
if (scw == nullptr) return;
|
||||
|
||||
|
||||
@@ -57,5 +57,5 @@
|
||||
|
||||
/* Also still print to debug window */
|
||||
Debug(script, level, "[{}] [{}] {}", ScriptObject::GetRootCompany(), logc, line.text);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, ScriptObject::GetRootCompany());
|
||||
InvalidateWindowClassesData(WindowClass::ScriptDebug, ScriptObject::GetRootCompany());
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ ${INCLUDES}
|
||||
/**
|
||||
* Class that handles window interaction. A Window in OpenTTD has two important
|
||||
* values. The WindowClass, and a Window number. The first indicates roughly
|
||||
* which window it is. WC_TOWN_VIEW for example, is the view of a town.
|
||||
* which window it is. WindowClass::TownView for example, is the view of a town.
|
||||
* The Window number is a bit more complex, as it depends mostly on the
|
||||
* WindowClass. For example for WC_TOWN_VIEW it is the TownID. In general a
|
||||
* WindowClass. For example for WindowClass::TownView it is the TownID. In general a
|
||||
* good rule of thumb is: either the number is always 0, or the ID of the
|
||||
* object in question.
|
||||
* In the comment at the widget enum, it is mentioned how the number is used.
|
||||
|
||||
+21
-21
@@ -186,11 +186,11 @@ struct ScriptListWindow : public Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, this->slot == OWNER_DEITY ? GameOptionsWindowNumber::GS : GameOptionsWindowNumber::AI);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_SETTINGS);
|
||||
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, -1);
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
InvalidateWindowClassesData(WC_TEXTFILE);
|
||||
InvalidateWindowData(WindowClass::GameOptions, this->slot == OWNER_DEITY ? GameOptionsWindowNumber::GS : GameOptionsWindowNumber::AI);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptSettings);
|
||||
InvalidateWindowClassesData(WindowClass::ScriptDebug, -1);
|
||||
CloseWindowByClass(WindowClass::QueryString);
|
||||
InvalidateWindowClassesData(WindowClass::Textfile);
|
||||
}
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
@@ -265,7 +265,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_script_list_widgets
|
||||
/** Window definition for the ai list window. */
|
||||
static WindowDesc _script_list_desc(
|
||||
WindowPosition::Center, "settings_script_list", 200, 234,
|
||||
WC_SCRIPT_LIST, WC_NONE,
|
||||
WindowClass::ScriptList, WindowClass::None,
|
||||
{},
|
||||
_nested_script_list_widgets
|
||||
);
|
||||
@@ -277,7 +277,7 @@ static WindowDesc _script_list_desc(
|
||||
*/
|
||||
void ShowScriptListWindow(CompanyID slot, bool show_all)
|
||||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
CloseWindowByClass(WindowClass::ScriptList);
|
||||
new ScriptListWindow(_script_list_desc, slot, show_all);
|
||||
}
|
||||
|
||||
@@ -405,8 +405,8 @@ struct ScriptSettingsWindow : public Window {
|
||||
|
||||
int num = it - this->visible_settings.begin();
|
||||
if (this->clicked_row != num) {
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_row = num;
|
||||
this->clicked_dropdown = false;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ struct ScriptSettingsWindow : public Window {
|
||||
if (!bool_item && IsInsideMM(x, 0, SETTING_BUTTON_WIDTH) && config_item.complete_labels) {
|
||||
if (this->clicked_dropdown) {
|
||||
/* unclick the dropdown */
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->clicked_dropdown = false;
|
||||
this->closing_dropdown = false;
|
||||
} else {
|
||||
@@ -531,8 +531,8 @@ struct ScriptSettingsWindow : public Window {
|
||||
this->script_config = GetConfig(this->slot);
|
||||
if (this->script_config->GetConfigList()->empty()) this->Close();
|
||||
this->RebuildVisibleSettings();
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WC_QUERY_STRING);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->CloseChildWindows(WindowClass::QueryString);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -576,7 +576,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_script_settings_widg
|
||||
/** Window definition for the Script settings window. */
|
||||
static WindowDesc _script_settings_desc(
|
||||
WindowPosition::Center, "settings_script", 500, 208,
|
||||
WC_SCRIPT_SETTINGS, WC_NONE,
|
||||
WindowClass::ScriptSettings, WindowClass::None,
|
||||
{},
|
||||
_nested_script_settings_widgets
|
||||
);
|
||||
@@ -587,8 +587,8 @@ static WindowDesc _script_settings_desc(
|
||||
*/
|
||||
void ShowScriptSettingsWindow(CompanyID slot)
|
||||
{
|
||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
||||
CloseWindowByClass(WindowClass::ScriptList);
|
||||
CloseWindowByClass(WindowClass::ScriptSettings);
|
||||
new ScriptSettingsWindow(_script_settings_desc, slot);
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
|
||||
*/
|
||||
void ShowScriptTextfileWindow(Window *parent, TextfileType file_type, CompanyID slot)
|
||||
{
|
||||
parent->CloseChildWindowById(WC_TEXTFILE, file_type);
|
||||
parent->CloseChildWindowById(WindowClass::Textfile, file_type);
|
||||
new ScriptTextfileWindow(parent, file_type, slot);
|
||||
}
|
||||
|
||||
@@ -991,7 +991,7 @@ struct ScriptDebugWindow : public Window {
|
||||
this->highlight_row = -1; // The highlight of one Script make little sense for another Script.
|
||||
|
||||
/* Close AI settings window to prevent confusion */
|
||||
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
||||
CloseWindowByClass(WindowClass::ScriptSettings);
|
||||
|
||||
this->InvalidateData(-1);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ EndContainer(),
|
||||
/** Window definition for the Script debug window. */
|
||||
static WindowDesc _script_debug_desc(
|
||||
WindowPosition::Automatic, "script_debug", 600, 450,
|
||||
WC_SCRIPT_DEBUG, WC_NONE,
|
||||
WindowClass::ScriptDebug, WindowClass::None,
|
||||
{},
|
||||
_nested_script_debug_widgets,
|
||||
&ScriptDebugWindow::hotkeys
|
||||
@@ -1271,17 +1271,17 @@ Window *ShowScriptDebugWindow(CompanyID show_company, bool new_window)
|
||||
int i = 0;
|
||||
if (new_window) {
|
||||
/* find next free window number for script debug */
|
||||
while (FindWindowById(WC_SCRIPT_DEBUG, i) != nullptr) i++;
|
||||
while (FindWindowById(WindowClass::ScriptDebug, i) != nullptr) i++;
|
||||
} else {
|
||||
/* Find existing window showing show_company. */
|
||||
for (Window *w : Window::Iterate()) {
|
||||
if (w->window_class == WC_SCRIPT_DEBUG && static_cast<ScriptDebugWindow *>(w)->filter.script_debug_company == show_company) {
|
||||
if (w->window_class == WindowClass::ScriptDebug && static_cast<ScriptDebugWindow *>(w)->filter.script_debug_company == show_company) {
|
||||
return BringWindowToFrontById(w->window_class, w->window_number);
|
||||
}
|
||||
}
|
||||
|
||||
/* Maybe there's a window showing a different company which can be switched. */
|
||||
ScriptDebugWindow *w = static_cast<ScriptDebugWindow *>(FindWindowByClass(WC_SCRIPT_DEBUG));
|
||||
ScriptDebugWindow *w = static_cast<ScriptDebugWindow *>(FindWindowByClass(WindowClass::ScriptDebug));
|
||||
if (w != nullptr) {
|
||||
BringWindowToFrontById(w->window_class, w->window_number);
|
||||
w->ChangeToScript(show_company);
|
||||
|
||||
+3
-3
@@ -1465,7 +1465,7 @@ void LoadFromConfig(bool startup)
|
||||
|
||||
/* Display scheduled errors */
|
||||
ScheduleErrorMessage(_settings_error_list);
|
||||
if (FindWindowById(WC_ERRMSG, 0) == nullptr) ShowFirstError();
|
||||
if (FindWindowById(WindowClass::ErrorMessage, 0) == nullptr) ShowFirstError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,8 +1628,8 @@ void IntSettingDesc::ChangeValue(const void *object, int32_t newval) const
|
||||
_gamelog.StopAction();
|
||||
}
|
||||
|
||||
SetWindowClassesDirty(WC_GAME_OPTIONS);
|
||||
if (this->flags.Test(SettingFlag::Sandbox)) SetWindowClassesDirty(WC_CHEATS);
|
||||
SetWindowClassesDirty(WindowClass::GameOptions);
|
||||
if (this->flags.Test(SettingFlag::Sandbox)) SetWindowClassesDirty(WindowClass::Cheat);
|
||||
|
||||
if (_save_config) SaveToConfig();
|
||||
}
|
||||
|
||||
+10
-10
@@ -127,7 +127,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
|
||||
template <class TBaseSet>
|
||||
void ShowBaseSetTextfileWindow(Window *parent, TextfileType file_type, const TBaseSet *baseset, StringID content_type)
|
||||
{
|
||||
parent->CloseChildWindowById(WC_TEXTFILE, file_type);
|
||||
parent->CloseChildWindowById(WindowClass::Textfile, file_type);
|
||||
new BaseSetTextfileWindow(parent, file_type, baseset->name, *baseset->GetTextfile(file_type), content_type);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||
CloseWindowById(WindowClass::CustomCurrenty, 0);
|
||||
if (this->reload) _switch_mode = SM_MENU;
|
||||
this->Window::Close();
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ struct GameOptionsWindow : Window {
|
||||
SetEffectVolume(vol);
|
||||
}
|
||||
this->SetWidgetDirty(widget);
|
||||
SetWindowClassesDirty(WC_MUSIC_WINDOW);
|
||||
SetWindowClassesDirty(WindowClass::Music);
|
||||
}
|
||||
|
||||
if (click_count > 0) this->mouse_capture_widget = widget;
|
||||
@@ -1272,7 +1272,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
if (this->valuedropdown_entry == pe) {
|
||||
/* unclick the dropdown */
|
||||
this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
this->closing_dropdown = false;
|
||||
this->valuedropdown_entry->SetButtons({});
|
||||
this->valuedropdown_entry = nullptr;
|
||||
@@ -1437,7 +1437,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
case WID_GO_LANG_DROPDOWN: // Change interface language
|
||||
ReadLanguagePack(&_languages[index]);
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
CloseWindowByClass(WindowClass::QueryString);
|
||||
CheckForMissingGlyphs();
|
||||
ClearAllCachedNames();
|
||||
UpdateAllVirtCoords();
|
||||
@@ -1463,7 +1463,7 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
case WID_GO_BASE_GRF_DROPDOWN:
|
||||
if (_game_mode == GM_MENU) {
|
||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||
CloseWindowByClass(WindowClass::NewGRFParameters);
|
||||
auto set = BaseGraphics::GetSet(index);
|
||||
BaseGraphics::SetSet(set);
|
||||
this->reload = true;
|
||||
@@ -1855,7 +1855,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_game_options_widgets
|
||||
/** Window definition for the game options window. */
|
||||
static WindowDesc _game_options_desc(
|
||||
WindowPosition::Center, "game_options", 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WindowClass::GameOptions, WindowClass::None,
|
||||
{},
|
||||
_nested_game_options_widgets
|
||||
);
|
||||
@@ -1863,7 +1863,7 @@ static WindowDesc _game_options_desc(
|
||||
/** Open the game options window. */
|
||||
void ShowGameOptions()
|
||||
{
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
new GameOptionsWindow(_game_options_desc);
|
||||
}
|
||||
|
||||
@@ -2199,7 +2199,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_cust_currency_widget
|
||||
/** Window definition for the custom currency window. */
|
||||
static WindowDesc _cust_currency_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_CUSTOM_CURRENCY, WC_NONE,
|
||||
WindowClass::CustomCurrenty, WindowClass::None,
|
||||
{},
|
||||
_nested_cust_currency_widgets
|
||||
);
|
||||
@@ -2207,6 +2207,6 @@ static WindowDesc _cust_currency_desc(
|
||||
/** Open custom currency window. */
|
||||
static void ShowCustCurrency()
|
||||
{
|
||||
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||
CloseWindowById(WindowClass::CustomCurrenty, 0);
|
||||
new CustomCurrencyWindow(_cust_currency_desc);
|
||||
}
|
||||
|
||||
+24
-24
@@ -163,7 +163,7 @@ static void RedrawSmallmap(int32_t)
|
||||
{
|
||||
BuildLandLegend();
|
||||
BuildOwnerLegend();
|
||||
SetWindowClassesDirty(WC_SMALLMAP);
|
||||
SetWindowClassesDirty(WindowClass::SmallMap);
|
||||
}
|
||||
|
||||
/** Redraw linkgraph links after a colour scheme change. */
|
||||
@@ -175,8 +175,8 @@ static void UpdateLinkgraphColours(int32_t)
|
||||
|
||||
static void StationSpreadChanged(int32_t)
|
||||
{
|
||||
InvalidateWindowData(WC_SELECT_STATION, 0);
|
||||
InvalidateWindowData(WC_BUILD_STATION, 0);
|
||||
InvalidateWindowData(WindowClass::JoinStation, 0);
|
||||
InvalidateWindowData(WindowClass::BuildStation, 0);
|
||||
}
|
||||
|
||||
static void UpdateConsists(int32_t)
|
||||
@@ -185,7 +185,7 @@ static void UpdateConsists(int32_t)
|
||||
/* Update the consist of all trains so the maximum speed is set correctly. */
|
||||
if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(CCF_TRACK);
|
||||
}
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,7 @@ static void UpdateAllServiceInterval(int32_t new_value)
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleDetails);
|
||||
}
|
||||
|
||||
static bool CanUpdateServiceInterval(VehicleType, int32_t &new_value)
|
||||
@@ -261,7 +261,7 @@ static void UpdateServiceInterval(VehicleType type, int32_t new_value)
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,9 +322,9 @@ static void TrainAccelerationModelChanged(int32_t)
|
||||
}
|
||||
|
||||
/* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
|
||||
SetWindowClassesDirty(WC_ENGINE_PREVIEW);
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowClassesDirty(WindowClass::EnginePreview);
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle, 0);
|
||||
SetWindowClassesDirty(WindowClass::VehicleDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,9 +351,9 @@ static void RoadVehAccelerationModelChanged(int32_t)
|
||||
}
|
||||
|
||||
/* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
|
||||
SetWindowClassesDirty(WC_ENGINE_PREVIEW);
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowClassesDirty(WindowClass::EnginePreview);
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle, 0);
|
||||
SetWindowClassesDirty(WindowClass::VehicleDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +378,7 @@ static void AircraftRangeChanged(int32_t)
|
||||
/* Reset destination is too far state */
|
||||
if (v->flags.Test(VehicleAirFlag::DestinationTooFar)) {
|
||||
v->flags.Reset(VehicleAirFlag::DestinationTooFar);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
DeleteVehicleNews(v->index, AdviceType::AircraftDestinationTooFar);
|
||||
}
|
||||
}
|
||||
@@ -387,9 +387,9 @@ static void AircraftRangeChanged(int32_t)
|
||||
static void TownFoundingChanged(int32_t)
|
||||
{
|
||||
if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
|
||||
CloseWindowById(WC_FOUND_TOWN, 0);
|
||||
CloseWindowById(WindowClass::FoundTown, 0);
|
||||
} else {
|
||||
InvalidateWindowData(WC_FOUND_TOWN, 0);
|
||||
InvalidateWindowData(WindowClass::FoundTown, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ static void ZoomMinMaxChanged(int32_t)
|
||||
{
|
||||
ConstrainAllViewportsZoom();
|
||||
GfxClearSpriteCache();
|
||||
InvalidateWindowClassesData(WC_SPRITE_ALIGNER);
|
||||
InvalidateWindowClassesData(WindowClass::SpriteAligner);
|
||||
if (AdjustGUIZoom(false)) {
|
||||
ReInitAllWindows(true);
|
||||
}
|
||||
@@ -417,14 +417,14 @@ static void SpriteZoomMinChanged(int32_t)
|
||||
*/
|
||||
static void InvalidateNewGRFChangeWindows(int32_t)
|
||||
{
|
||||
InvalidateWindowClassesData(WC_SAVELOAD);
|
||||
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||
InvalidateWindowClassesData(WindowClass::SaveLoad);
|
||||
CloseWindowByClass(WindowClass::GameOptions);
|
||||
ReInitAllWindows(false);
|
||||
}
|
||||
|
||||
static void InvalidateCompanyLiveryWindow(int32_t)
|
||||
{
|
||||
InvalidateWindowClassesData(WC_COMPANY_COLOUR, -1);
|
||||
InvalidateWindowClassesData(WindowClass::CompanyLivery, -1);
|
||||
ResetVehicleColourMap();
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ static void DifficultyNoiseChange(int32_t)
|
||||
if (_game_mode == GM_NORMAL) {
|
||||
UpdateAirportsNoise();
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
|
||||
InvalidateWindowClassesData(WindowClass::TownView, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,7 +446,7 @@ static void MaxNoAIsChange(int32_t)
|
||||
ShowErrorMessage(GetEncodedString(STR_WARNING_NO_SUITABLE_AI), {}, WL_CRITICAL);
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS, 0);
|
||||
InvalidateWindowClassesData(WindowClass::GameOptions, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,7 +583,7 @@ static void StationCatchmentChanged(int32_t)
|
||||
|
||||
static void MaxVehiclesChanged(int32_t)
|
||||
{
|
||||
InvalidateWindowClassesData(WC_BUILD_TOOLBAR);
|
||||
InvalidateWindowClassesData(WindowClass::BuildToolbar);
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ static void UpdateClientConfigValues()
|
||||
{
|
||||
NetworkServerUpdateGameInfo();
|
||||
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
InvalidateWindowData(WindowClass::NetworkClientList, 0);
|
||||
|
||||
if (_network_server) {
|
||||
NetworkServerSendConfigUpdate();
|
||||
@@ -625,7 +625,7 @@ static void ChangeTimekeepingUnits()
|
||||
_settings_newgame.economy.minutes_per_calendar_year = CalendarTime::DEF_MINUTES_PER_YEAR;
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS, 0);
|
||||
InvalidateWindowClassesData(WindowClass::GameOptions, 0);
|
||||
|
||||
/* It is possible to change these units in Scenario Editor. We must set the economy date appropriately. */
|
||||
if (_game_mode == GM_EDITOR) {
|
||||
|
||||
+10
-10
@@ -216,14 +216,14 @@ static void CheckIfShipNeedsService(Vehicle *v)
|
||||
if (depot == nullptr) {
|
||||
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||
v->current_order.MakeDummy();
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
v->current_order.MakeGoToDepot(depot->index, OrderDepotTypeFlag::Service);
|
||||
v->SetDestTile(depot->xy);
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +280,9 @@ void Ship::OnNewEconomyDay()
|
||||
|
||||
SubtractMoneyFromCompanyFract(this->owner, cost);
|
||||
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||
SetWindowDirty(WindowClass::VehicleDetails, this->index);
|
||||
/* we need this for the profit */
|
||||
SetWindowClassesDirty(WC_SHIPS_LIST);
|
||||
SetWindowClassesDirty(WindowClass::ShipList);
|
||||
}
|
||||
|
||||
Trackdir Ship::GetVehicleTrackdir() const
|
||||
@@ -396,13 +396,13 @@ static bool CheckShipStayInDepot(Ship *v)
|
||||
v->vehstatus.Reset(VehState::Hidden);
|
||||
v->cur_speed = 0;
|
||||
v->UpdateViewport(true, true);
|
||||
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
|
||||
SetWindowDirty(WindowClass::VehicleDepot, v->tile);
|
||||
|
||||
VehicleServiceInDepot(v);
|
||||
v->LeaveUnbunchingDepot();
|
||||
v->PlayLeaveStationSound();
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
SetWindowClassesDirty(WC_SHIPS_LIST);
|
||||
InvalidateWindowData(WindowClass::VehicleDepot, v->tile);
|
||||
SetWindowClassesDirty(WindowClass::ShipList);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -421,7 +421,7 @@ static uint ShipAccelerate(Vehicle *v)
|
||||
/* updates statusbar only if speed have changed to save CPU time */
|
||||
if (speed != v->cur_speed) {
|
||||
v->cur_speed = speed;
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
const uint advance_speed = v->GetAdvanceSpeed(speed);
|
||||
@@ -597,7 +597,7 @@ static bool ShipMoveUpDownOnLock(Ship *v)
|
||||
|
||||
if (v->cur_speed != 0) {
|
||||
v->cur_speed = 0;
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
}
|
||||
|
||||
if ((v->tick_counter & 7) == 0) {
|
||||
@@ -721,7 +721,7 @@ static void ShipController(Ship *v)
|
||||
* always skip ahead. */
|
||||
if (v->current_order.IsType(OT_LEAVESTATION)) {
|
||||
v->current_order.Free();
|
||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||
SetWindowWidgetDirty(WindowClass::VehicleView, v->index, WID_VV_START_STOP);
|
||||
/* Test if continuing forward would lead to a dead-end, moving into the dock. */
|
||||
const DiagDirection exitdir = VehicleExitDir(v->direction, v->state);
|
||||
const TileIndex tile = TileAddByDiagDir(v->tile, exitdir);
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ std::tuple<CommandCost, SignID> CmdPlaceSign(DoCommandFlags flags, TileIndex til
|
||||
Sign *si = Sign::Create(_game_mode == GM_EDITOR ? OWNER_DEITY : _current_company, x, y, GetSlopePixelZ(x, y), text);
|
||||
|
||||
si->UpdateVirtCoord();
|
||||
InvalidateWindowData(WC_SIGN_LIST, 0, 0);
|
||||
InvalidateWindowData(WindowClass::SignList, 0, 0);
|
||||
return { CommandCost(), si->index };
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ CommandCost CmdRenameSign(DoCommandFlags flags, SignID sign_id, const std::strin
|
||||
if (_game_mode != GM_EDITOR) si->owner = _current_company;
|
||||
|
||||
si->UpdateVirtCoord();
|
||||
InvalidateWindowData(WC_SIGN_LIST, 0, 1);
|
||||
InvalidateWindowData(WindowClass::SignList, 0, 1);
|
||||
}
|
||||
} else { // Delete sign
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
@@ -90,7 +90,7 @@ CommandCost CmdRenameSign(DoCommandFlags flags, SignID sign_id, const std::strin
|
||||
if (si->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeSign(si->index));
|
||||
delete si;
|
||||
|
||||
InvalidateWindowData(WC_SIGN_LIST, 0, 0);
|
||||
InvalidateWindowData(WindowClass::SignList, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -363,7 +363,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_sign_list_widgets =
|
||||
/** Window definition for the sign list window. */
|
||||
static WindowDesc _sign_list_desc(
|
||||
WindowPosition::Automatic, "list_signs", 358, 138,
|
||||
WC_SIGN_LIST, WC_NONE,
|
||||
WindowClass::SignList, WindowClass::None,
|
||||
{},
|
||||
_nested_sign_list_widgets,
|
||||
&SignListWindow::hotkeys
|
||||
@@ -616,7 +616,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_query_sign_edit_widg
|
||||
/** Window definition for the sign editor window. */
|
||||
static WindowDesc _query_sign_edit_desc(
|
||||
WindowPosition::Center, {}, 0, 0,
|
||||
WC_QUERY_STRING, WC_NONE,
|
||||
WindowClass::QueryString, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_query_sign_edit_widgets
|
||||
);
|
||||
@@ -645,7 +645,7 @@ void HandleClickOnSign(const Sign *si)
|
||||
void ShowRenameSignWindow(const Sign *si)
|
||||
{
|
||||
/* Delete all other edit windows */
|
||||
CloseWindowByClass(WC_QUERY_STRING);
|
||||
CloseWindowByClass(WindowClass::QueryString);
|
||||
|
||||
new SignWindow(_query_sign_edit_desc, si);
|
||||
}
|
||||
@@ -656,7 +656,7 @@ void ShowRenameSignWindow(const Sign *si)
|
||||
*/
|
||||
void DeleteRenameSignWindow(SignID sign)
|
||||
{
|
||||
SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, QueryStringWindowNumber::Sign));
|
||||
SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WindowClass::QueryString, QueryStringWindowNumber::Sign));
|
||||
|
||||
if (w != nullptr && w->cur_sign == sign) w->Close();
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ protected:
|
||||
/** Notify the industry chain window to stop sending newly selected industries. */
|
||||
static void BreakIndustryChainLink()
|
||||
{
|
||||
InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
|
||||
InvalidateWindowClassesData(WindowClass::IndustryCargoes, NUM_INDUSTRYTYPES);
|
||||
}
|
||||
|
||||
static inline Point SmallmapRemapCoords(int x, int y)
|
||||
@@ -2061,7 +2061,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_smallmap_widgets = {
|
||||
/** Window definition for the smallmap window. */
|
||||
static WindowDesc _smallmap_desc(
|
||||
WindowPosition::Automatic, "smallmap", 484, 314,
|
||||
WC_SMALLMAP, WC_NONE,
|
||||
WindowClass::SmallMap, WindowClass::None,
|
||||
{},
|
||||
_nested_smallmap_widgets
|
||||
);
|
||||
@@ -2092,7 +2092,7 @@ bool ScrollMainWindowTo(int x, int y, int z, bool instant)
|
||||
|
||||
if (res) return res;
|
||||
|
||||
SmallMapWindow *w = dynamic_cast<SmallMapWindow*>(FindWindowById(WC_SMALLMAP, 0));
|
||||
SmallMapWindow *w = dynamic_cast<SmallMapWindow*>(FindWindowById(WindowClass::SmallMap, 0));
|
||||
if (w != nullptr) w->SmallMapCenterOnCurrentPos();
|
||||
|
||||
return res;
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ void ChangeSoundSet(int index)
|
||||
sound->priority = 0;
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, GameOptionsWindowNumber::GameOptions, 0, true);
|
||||
InvalidateWindowData(WindowClass::GameOptions, GameOptionsWindowNumber::GameOptions, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-9
@@ -53,10 +53,10 @@ BaseStation::~BaseStation()
|
||||
{
|
||||
if (CleaningPool()) return;
|
||||
|
||||
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Train, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Road, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Ship, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Aircraft, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WindowClass::TrainList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Train, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WindowClass::RoadVehicleList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Road, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WindowClass::ShipList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Ship, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WindowClass::AircraftList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Aircraft, this->owner, this->index).ToWindowNumber());
|
||||
|
||||
this->sign.MarkDirty();
|
||||
}
|
||||
@@ -138,12 +138,12 @@ Station::~Station()
|
||||
|
||||
if (this->owner == OWNER_NONE) {
|
||||
/* Invalidate all in case of oil rigs. */
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StationList, 0);
|
||||
} else {
|
||||
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
||||
InvalidateWindowData(WindowClass::StationList, this->owner, 0);
|
||||
}
|
||||
|
||||
CloseWindowById(WC_STATION_VIEW, index);
|
||||
CloseWindowById(WindowClass::StationView, index);
|
||||
|
||||
/* Now delete all orders that go to the station */
|
||||
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
|
||||
@@ -170,7 +170,7 @@ Station::~Station()
|
||||
*/
|
||||
void BaseStation::PostDestructor([[maybe_unused]] size_t index)
|
||||
{
|
||||
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
||||
InvalidateWindowData(WindowClass::JoinStation, 0, 0);
|
||||
}
|
||||
|
||||
bool BaseStation::SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation)
|
||||
@@ -239,7 +239,7 @@ void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
|
||||
this->facilities.Set(new_facility_bit);
|
||||
this->owner = _current_company;
|
||||
this->build_date = TimerGameCalendar::date;
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+27
-27
@@ -460,7 +460,7 @@ void Station::UpdateVirtCoord()
|
||||
|
||||
_viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeStation(this->index));
|
||||
|
||||
SetWindowDirty(WC_STATION_VIEW, this->index);
|
||||
SetWindowDirty(WindowClass::StationView, this->index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -671,7 +671,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg)
|
||||
}
|
||||
|
||||
/* redraw the station view since acceptance changed */
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ACCEPT_RATING_LIST);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, st->index, WID_SV_ACCEPT_RATING_LIST);
|
||||
}
|
||||
|
||||
static void UpdateStationSignCoord(BaseStation *st)
|
||||
@@ -743,7 +743,7 @@ static void DeleteStationIfEmpty(BaseStation *st)
|
||||
{
|
||||
if (!st->IsInUse()) {
|
||||
st->delete_ctr = 0;
|
||||
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
||||
InvalidateWindowData(WindowClass::StationList, st->owner, 0);
|
||||
}
|
||||
/* station remains but it probably lost some parts - station sign should stay in the station boundaries */
|
||||
UpdateStationSignCoord(st);
|
||||
@@ -762,30 +762,30 @@ void Station::AfterStationTileSetChange(bool adding, StationType type)
|
||||
if (adding) {
|
||||
this->RecomputeCatchment();
|
||||
MarkCatchmentTilesDirty();
|
||||
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
||||
InvalidateWindowData(WindowClass::StationList, this->owner, 0);
|
||||
} else {
|
||||
MarkCatchmentTilesDirty();
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case StationType::Rail:
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_TRAINS);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, this->index, WID_SV_TRAINS);
|
||||
break;
|
||||
case StationType::Airport:
|
||||
break;
|
||||
case StationType::Truck:
|
||||
case StationType::Bus:
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_ROADVEHS);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, this->index, WID_SV_ROADVEHS);
|
||||
break;
|
||||
case StationType::Dock:
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_SHIPS);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, this->index, WID_SV_SHIPS);
|
||||
break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
if (adding) {
|
||||
UpdateStationAcceptance(this, false);
|
||||
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
||||
InvalidateWindowData(WindowClass::JoinStation, 0, 0);
|
||||
} else {
|
||||
DeleteStationIfEmpty(this);
|
||||
this->RecomputeCatchment();
|
||||
@@ -1844,8 +1844,8 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
||||
/* if we deleted the whole station, delete the train facility. */
|
||||
if (st->train_station.tile == INVALID_TILE) {
|
||||
st->facilities.Reset(StationFacility::Train);
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, st->index, WID_SV_TRAINS);
|
||||
MarkCatchmentTilesDirty();
|
||||
st->UpdateVirtCoord();
|
||||
DeleteStationIfEmpty(st);
|
||||
@@ -1879,7 +1879,7 @@ CommandCost CmdRemoveFromRailStation(DoCommandFlags flags, TileIndex start, Tile
|
||||
/* Do all station specific functions here. */
|
||||
for (Station *st : affected_stations) {
|
||||
|
||||
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
|
||||
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WindowClass::StationView, st->index, WID_SV_TRAINS);
|
||||
st->MarkTilesDirty(false);
|
||||
MarkCatchmentTilesDirty();
|
||||
st->RecomputeCatchment();
|
||||
@@ -2293,7 +2293,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlags flags, int repl
|
||||
/* removed the only stop? */
|
||||
if (*primary_stop == nullptr) {
|
||||
st->facilities.Reset(is_truck ? StationFacility::TruckStop : StationFacility::BusStop);
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
}
|
||||
} else {
|
||||
/* tell the predecessor in the list to skip this stop */
|
||||
@@ -2414,7 +2414,7 @@ CommandCost RemoveRoadWaypointStop(TileIndex tile, DoCommandFlags flags, int rep
|
||||
/* if we deleted the whole waypoint, delete the road facility. */
|
||||
if (wp->road_waypoint_area.tile == INVALID_TILE) {
|
||||
wp->facilities.Reset({StationFacility::BusStop, StationFacility::TruckStop});
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, wp->index, WID_SV_ROADVEHS);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, wp->index, WID_SV_ROADVEHS);
|
||||
wp->UpdateVirtCoord();
|
||||
DeleteStationIfEmpty(wp);
|
||||
}
|
||||
@@ -2751,10 +2751,10 @@ CommandCost CmdBuildAirport(DoCommandFlags flags, TileIndex tile, uint8_t airpor
|
||||
Company::Get(st->owner)->infrastructure.airport++;
|
||||
|
||||
st->AfterStationTileSetChange(true, StationType::Airport);
|
||||
InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
|
||||
InvalidateWindowData(WindowClass::StationView, st->index, -1);
|
||||
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
SetWindowDirty(WC_TOWN_VIEW, nearest->index);
|
||||
SetWindowDirty(WindowClass::TownView, nearest->index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2791,7 +2791,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlags flags)
|
||||
for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
|
||||
TileIndex tile_cur = st->airport.GetHangarTile(i);
|
||||
OrderBackup::Reset(tile_cur, false);
|
||||
CloseWindowById(WC_VEHICLE_DEPOT, tile_cur);
|
||||
CloseWindowById(WindowClass::VehicleDepot, tile_cur);
|
||||
}
|
||||
|
||||
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center.
|
||||
@@ -2802,7 +2802,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlags flags)
|
||||
nearest->noise_reached -= GetAirportNoiseLevelForDistance(st->airport.GetSpec(), dist);
|
||||
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
SetWindowDirty(WC_TOWN_VIEW, nearest->index);
|
||||
SetWindowDirty(WindowClass::TownView, nearest->index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2828,9 +2828,9 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlags flags)
|
||||
|
||||
st->airport.Clear();
|
||||
st->facilities.Reset(StationFacility::Airport);
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
|
||||
InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
|
||||
InvalidateWindowData(WindowClass::StationView, st->index, -1);
|
||||
|
||||
Company::Get(st->owner)->infrastructure.airport--;
|
||||
|
||||
@@ -2860,7 +2860,7 @@ CommandCost CmdOpenCloseAirport(DoCommandFlags flags, StationID station_id)
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
st->airport.blocks.Flip(AirportBlock::AirportClosed);
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_CLOSE_AIRPORT);
|
||||
SetWindowWidgetDirty(WindowClass::StationView, st->index, WID_SV_CLOSE_AIRPORT);
|
||||
}
|
||||
return CommandCost();
|
||||
}
|
||||
@@ -3087,7 +3087,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlags flags)
|
||||
st->ship_station.Clear();
|
||||
st->docking_station.Clear();
|
||||
st->facilities.Reset(StationFacility::Dock);
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
SetWindowClassesDirty(WindowClass::VehicleOrders);
|
||||
}
|
||||
|
||||
Company::Get(st->owner)->infrastructure.station -= 2;
|
||||
@@ -4142,9 +4142,9 @@ static void UpdateStationRating(Station *st)
|
||||
|
||||
StationID index = st->index;
|
||||
if (waiting_changed) {
|
||||
SetWindowDirty(WC_STATION_VIEW, index); // update whole window
|
||||
SetWindowDirty(WindowClass::StationView, index); // update whole window
|
||||
} else {
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, index, WID_SV_ACCEPT_RATING_LIST); // update only ratings list
|
||||
SetWindowWidgetDirty(WindowClass::StationView, index, WID_SV_ACCEPT_RATING_LIST); // update only ratings list
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4447,7 +4447,7 @@ static uint UpdateStationWaiting(Station *st, CargoType cargo, uint amount, Sour
|
||||
if (lg != nullptr) (*lg)[ge.node].UpdateSupply(amount);
|
||||
|
||||
if (!ge.HasRating()) {
|
||||
InvalidateWindowData(WC_STATION_LIST, st->owner);
|
||||
InvalidateWindowData(WindowClass::StationList, st->owner);
|
||||
ge.status.Set(GoodsEntry::State::Rating);
|
||||
}
|
||||
|
||||
@@ -4458,7 +4458,7 @@ static uint UpdateStationWaiting(Station *st, CargoType cargo, uint amount, Sour
|
||||
TriggerRoadStopAnimation(st, st->xy, StationAnimationTrigger::NewCargo, cargo);
|
||||
|
||||
|
||||
SetWindowDirty(WC_STATION_VIEW, st->index);
|
||||
SetWindowDirty(WindowClass::StationView, st->index);
|
||||
st->MarkTilesDirty(true);
|
||||
return amount;
|
||||
}
|
||||
@@ -4503,7 +4503,7 @@ CommandCost CmdRenameStation(DoCommandFlags flags, StationID station_id, const s
|
||||
}
|
||||
|
||||
st->UpdateVirtCoord();
|
||||
InvalidateWindowData(WC_STATION_LIST, st->owner, 1);
|
||||
InvalidateWindowData(WindowClass::StationList, st->owner, 1);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -4853,7 +4853,7 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
|
||||
|
||||
/* for buoys, owner of tile is owner of water, st->owner == OWNER_NONE */
|
||||
SetTileOwner(tile, new_owner);
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StationList, 0);
|
||||
} else {
|
||||
if (IsDriveThroughStopTile(tile)) {
|
||||
/* Remove the drive-through road stop */
|
||||
|
||||
+13
-13
@@ -721,7 +721,7 @@ public:
|
||||
}
|
||||
|
||||
/* Always close the list if ctrl is not pressed. */
|
||||
if (!_ctrl_pressed) this->CloseChildWindows(WC_DROPDOWN_MENU);
|
||||
if (!_ctrl_pressed) this->CloseChildWindows(WindowClass::DropdownMenu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_company_stations_wid
|
||||
/** Window definition for the company stations window. */
|
||||
static WindowDesc _company_stations_desc(
|
||||
WindowPosition::Automatic, "list_stations", 358, 162,
|
||||
WC_STATION_LIST, WC_NONE,
|
||||
WindowClass::StationList, WindowClass::None,
|
||||
{},
|
||||
_nested_company_stations_widgets
|
||||
);
|
||||
@@ -1362,10 +1362,10 @@ struct StationViewWindow : public Window {
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Train, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Road, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Ship, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Aircraft, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WindowClass::TrainList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Train, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WindowClass::RoadVehicleList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Road, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WindowClass::ShipList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Ship, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
CloseWindowById(WindowClass::AircraftList, VehicleListIdentifier(VL_STATION_LIST, VehicleType::Aircraft, this->owner, this->window_number).ToWindowNumber(), false);
|
||||
|
||||
SetViewportCatchmentStation(Station::Get(this->window_number), false);
|
||||
this->Window::Close();
|
||||
@@ -1969,7 +1969,7 @@ struct StationViewWindow : public Window {
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
{
|
||||
Window *w = FindWindowByClass(WC_QUERY_STRING);
|
||||
Window *w = FindWindowByClass(WindowClass::QueryString);
|
||||
|
||||
switch (widget) {
|
||||
case WID_SV_WAITING:
|
||||
@@ -1980,8 +1980,8 @@ struct StationViewWindow : public Window {
|
||||
SetViewportCatchmentStation(Station::Get(this->window_number), !this->IsWidgetLowered(WID_SV_CATCHMENT));
|
||||
|
||||
if (w != nullptr && this->IsWidgetLowered(WID_SV_CATCHMENT)) {
|
||||
if (w->parent->window_class == WC_STATION_VIEW && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportStationRect(Station::Get(w->parent->window_number), true);
|
||||
if (w->parent->window_class == WC_WAYPOINT_VIEW && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportWaypointRect(Waypoint::Get(w->parent->window_number), true);
|
||||
if (w->parent->window_class == WindowClass::StationView && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportStationRect(Station::Get(w->parent->window_number), true);
|
||||
if (w->parent->window_class == WindowClass::WaypointView && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportWaypointRect(Waypoint::Get(w->parent->window_number), true);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2179,7 +2179,7 @@ struct StationViewWindow : public Window {
|
||||
/** Window definition for the station view window. */
|
||||
static WindowDesc _station_view_desc(
|
||||
WindowPosition::Automatic, "view_station", 249, 117,
|
||||
WC_STATION_VIEW, WC_NONE,
|
||||
WindowClass::StationView, WindowClass::None,
|
||||
{},
|
||||
_nested_station_view_widgets
|
||||
);
|
||||
@@ -2387,7 +2387,7 @@ struct SelectStationWindow : Window {
|
||||
this->select_station_proc(false, *it);
|
||||
|
||||
/* Close Window; this might cause double frees! */
|
||||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
CloseWindowById(WindowClass::JoinStation, 0);
|
||||
}
|
||||
|
||||
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
|
||||
@@ -2433,7 +2433,7 @@ struct SelectStationWindow : Window {
|
||||
/** Window definition for the station selection window for (distant) joining. */
|
||||
static WindowDesc _select_station_desc(
|
||||
WindowPosition::Automatic, "build_station_join", 200, 180,
|
||||
WC_SELECT_STATION, WC_NONE,
|
||||
WindowClass::JoinStation, WindowClass::None,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_select_station_widgets
|
||||
);
|
||||
@@ -2451,7 +2451,7 @@ static bool StationJoinerNeeded(const StationPickerCmdProc &proc)
|
||||
|
||||
/* If a window is already opened and we didn't ctrl-click,
|
||||
* return true (i.e. just flash the old window) */
|
||||
Window *selection_window = FindWindowById(WC_SELECT_STATION, 0);
|
||||
Window *selection_window = FindWindowById(WindowClass::JoinStation, 0);
|
||||
if (selection_window != nullptr) {
|
||||
/* Abort current distant-join and start new one */
|
||||
selection_window->Close();
|
||||
|
||||
@@ -140,7 +140,7 @@ struct StatusBarWindow : Window {
|
||||
} else if (this->ticker_scroll < TICKER_STOP && GetStatusbarNews() != nullptr && !GetStatusbarNews()->headline.empty()) {
|
||||
/* Draw the scrolling news text */
|
||||
if (!DrawScrollingStatusText(*GetStatusbarNews(), ScaleGUITrad(this->ticker_scroll), tr.left, tr.right, tr.top, tr.bottom)) {
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED);
|
||||
InvalidateWindowData(WindowClass::Statusbar, 0, SBI_NEWS_DELETED);
|
||||
if (Company::IsValidID(_local_company)) {
|
||||
/* This is the default text */
|
||||
DrawString(tr, GetString(STR_STATUSBAR_COMPANY_NAME, _local_company), TextColour::FromString, SA_HOR_CENTER);
|
||||
@@ -221,7 +221,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_main_status_widgets
|
||||
/** Window definition for the main status bar. */
|
||||
static WindowDesc _main_status_desc(
|
||||
WindowPosition::Manual, {}, 0, 0,
|
||||
WC_STATUS_BAR, WC_NONE,
|
||||
WindowClass::Statusbar, WindowClass::None,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_main_status_widgets
|
||||
);
|
||||
@@ -232,7 +232,7 @@ static WindowDesc _main_status_desc(
|
||||
*/
|
||||
bool IsNewsTickerShown()
|
||||
{
|
||||
const StatusBarWindow *w = dynamic_cast<StatusBarWindow*>(FindWindowById(WC_STATUS_BAR, 0));
|
||||
const StatusBarWindow *w = dynamic_cast<StatusBarWindow*>(FindWindowById(WindowClass::Statusbar, 0));
|
||||
return w != nullptr && w->ticker_scroll < StatusBarWindow::TICKER_STOP;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -271,8 +271,8 @@ std::tuple<CommandCost, StoryPageID> CmdCreateStoryPage(DoCommandFlags flags, Co
|
||||
|
||||
StoryPage *s = StoryPage::Create(_story_page_next_sort_value, TimerGameCalendar::date, company, text);
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, -1);
|
||||
if (StoryPage::GetNumItems() == 1) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, -1);
|
||||
if (StoryPage::GetNumItems() == 1) InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
|
||||
_story_page_next_sort_value++;
|
||||
return { CommandCost(), s->index };
|
||||
@@ -316,7 +316,7 @@ std::tuple<CommandCost, StoryPageElementID> CmdCreateStoryPageElement(DoCommandF
|
||||
StoryPageElement *pe = StoryPageElement::Create(_story_page_element_next_sort_value, type, page_id);
|
||||
UpdateElement(*pe, tile, reference, text);
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, page_id);
|
||||
|
||||
_story_page_element_next_sort_value++;
|
||||
return { CommandCost(), pe->index };
|
||||
@@ -347,7 +347,7 @@ CommandCost CmdUpdateStoryPageElement(DoCommandFlags flags, TileIndex tile, Stor
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
UpdateElement(*pe, tile, reference, text);
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, pe->page);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, pe->page);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -369,7 +369,7 @@ CommandCost CmdSetStoryPageTitle(DoCommandFlags flags, StoryPageID page_id, cons
|
||||
StoryPage *p = StoryPage::Get(page_id);
|
||||
p->title = text;
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, page_id);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -391,7 +391,7 @@ CommandCost CmdSetStoryPageDate(DoCommandFlags flags, StoryPageID page_id, Timer
|
||||
StoryPage *p = StoryPage::Get(page_id);
|
||||
p->date = date;
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, page_id);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -438,8 +438,8 @@ CommandCost CmdRemoveStoryPage(DoCommandFlags flags, StoryPageID page_id)
|
||||
|
||||
delete p;
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, -1);
|
||||
if (StoryPage::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, -1);
|
||||
if (StoryPage::GetNumItems() == 0) InvalidateWindowData(WindowClass::MainToolbar, 0);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
@@ -462,7 +462,7 @@ CommandCost CmdRemoveStoryPageElement(DoCommandFlags flags, StoryPageElementID p
|
||||
|
||||
delete pe;
|
||||
|
||||
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
|
||||
InvalidateWindowClassesData(WindowClass::StoryBook, page_id);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
|
||||
+2
-2
@@ -964,7 +964,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_story_book_widgets =
|
||||
/** Window definition for the story book window. */
|
||||
static WindowDesc _story_book_desc(
|
||||
WindowPosition::Automatic, "view_story", 400, 300,
|
||||
WC_STORY_BOOK, WC_NONE,
|
||||
WindowClass::StoryBook, WindowClass::None,
|
||||
{},
|
||||
_nested_story_book_widgets
|
||||
);
|
||||
@@ -972,7 +972,7 @@ static WindowDesc _story_book_desc(
|
||||
/** Window definition for the game script window. */
|
||||
static WindowDesc _story_book_gs_desc(
|
||||
WindowPosition::Center, "view_story_gs", 400, 300,
|
||||
WC_STORY_BOOK, WC_NONE,
|
||||
WindowClass::StoryBook, WindowClass::None,
|
||||
{},
|
||||
_nested_story_book_widgets
|
||||
);
|
||||
|
||||
+7
-7
@@ -2139,13 +2139,13 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
|
||||
SortIndustryTypes();
|
||||
BuildIndustriesLegend();
|
||||
BuildContentTypeStringList();
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window.
|
||||
InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window.
|
||||
InvalidateWindowClassesData(WC_ROADVEH_LIST); // Road vehicle group window.
|
||||
InvalidateWindowClassesData(WC_SHIPS_LIST); // Ship group window.
|
||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST); // Aircraft group window.
|
||||
InvalidateWindowClassesData(WC_INDUSTRY_DIRECTORY); // Industry directory window.
|
||||
InvalidateWindowClassesData(WC_STATION_LIST); // Station list window.
|
||||
InvalidateWindowClassesData(WindowClass::BuildVehicle); // Build vehicle window.
|
||||
InvalidateWindowClassesData(WindowClass::TrainList); // Train group window.
|
||||
InvalidateWindowClassesData(WindowClass::RoadVehicleList); // Road vehicle group window.
|
||||
InvalidateWindowClassesData(WindowClass::ShipList); // Ship group window.
|
||||
InvalidateWindowClassesData(WindowClass::AircraftList); // Aircraft group window.
|
||||
InvalidateWindowClassesData(WindowClass::IndustryDirectory); // Industry directory window.
|
||||
InvalidateWindowClassesData(WindowClass::StationList); // Station list window.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user