OpenTTD Source
20241121-master-g67a0fccfad
|
GUI for autoreplace handling. More...
#include "stdafx.h"
#include "command_func.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "rail.h"
#include "road.h"
#include "strings_func.h"
#include "window_func.h"
#include "autoreplace_func.h"
#include "company_func.h"
#include "engine_base.h"
#include "window_gui.h"
#include "engine_gui.h"
#include "settings_func.h"
#include "core/geometry_func.hpp"
#include "rail_gui.h"
#include "road_gui.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "autoreplace_cmd.h"
#include "group_cmd.h"
#include "settings_cmd.h"
#include "widgets/autoreplace_widget.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
class | ReplaceVehicleWindow |
Window for the autoreplacing of vehicles. More... | |
Functions | |
static bool | EngineNumberSorter (const GUIEngineListItem &a, const GUIEngineListItem &b) |
void | InvalidateAutoreplaceWindow (EngineID e, GroupID id_g) |
Rebuild the left autoreplace list if an engine is removed or added. More... | |
void | AddRemoveEngineFromAutoreplaceAndBuildWindows (VehicleType type) |
When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists. More... | |
void | ShowReplaceGroupVehicleWindow (GroupID id_g, VehicleType vehicletype) |
Show the autoreplace configuration window for a particular group. More... | |
Variables | |
static const StringID | _start_replace_dropdown [] |
static constexpr NWidgetPart | _nested_replace_rail_vehicle_widgets [] |
static WindowDesc | _replace_rail_vehicle_desc (WDP_AUTO, "replace_vehicle_train", 500, 140, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, _nested_replace_rail_vehicle_widgets) |
static constexpr NWidgetPart | _nested_replace_road_vehicle_widgets [] |
static WindowDesc | _replace_road_vehicle_desc (WDP_AUTO, "replace_vehicle_road", 500, 140, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, _nested_replace_road_vehicle_widgets) |
static constexpr NWidgetPart | _nested_replace_vehicle_widgets [] |
static WindowDesc | _replace_vehicle_desc (WDP_AUTO, "replace_vehicle", 456, 118, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, _nested_replace_vehicle_widgets) |
GUI for autoreplace handling.
Definition in file autoreplace_gui.cpp.
void AddRemoveEngineFromAutoreplaceAndBuildWindows | ( | VehicleType | type | ) |
When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists.
type | The type of engine |
Definition at line 65 of file autoreplace_gui.cpp.
References InvalidateWindowClassesData(), InvalidateWindowData(), WC_BUILD_VEHICLE, and WC_REPLACE_VEHICLE.
Referenced by CalcEngineReliability(), CmdSetVehicleVisibility(), DisableEngineForCompany(), EnableEngineForCompany(), and NewVehicleAvailable().
Rebuild the left autoreplace list if an engine is removed or added.
e | Engine to check if it is removed or added |
id_g | The group the engine belongs to Note: this function only works if it is called either
|
Definition at line 51 of file autoreplace_gui.cpp.
References _local_company, ALL_GROUP, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetGroupNumEngines(), InvalidateWindowData(), and WC_REPLACE_VEHICLE.
void ShowReplaceGroupVehicleWindow | ( | GroupID | id_g, |
VehicleType | vehicletype | ||
) |
Show the autoreplace configuration window for a particular group.
id_g | The group to replace the vehicles for. |
vehicletype | The type of vehicles in the group. |
Definition at line 889 of file autoreplace_gui.cpp.
References CloseWindowById(), VEH_TRAIN, and WC_REPLACE_VEHICLE.
|
static |
Definition at line 71 of file autoreplace_gui.cpp.