|
OpenTTD Source 20261129-master-g72a8bdc861
|
Functions related to autoreplacing. More...
Go to the source code of this file.
Functions | |
| const EngineRenew * | GetEngineRenew (const EngineRenewList &erl, EngineID engine) |
| Search within a single engine renew list for an engine to renew. | |
| const EngineRenew * | GetEngineRenew (CompanyID company, GroupID group, EngineID engine, bool search) |
| Retrieves the EngineRenew that specifies the replacement of the given engine type from the given renewlist. | |
| CommandCost | AddEngineReplacement (DoCommandFlags flags, CompanyID company, GroupID group, EngineID engine, EngineID new_engine, bool replace_when_old) |
| Add an engine replacement to the given renewlist. | |
| CommandCost | RemoveEngineReplacement (DoCommandFlags flags, CompanyID company, GroupID group, EngineID engine) |
| Remove an engine replacement from a given renewlist. | |
| void | RemoveAllEngineReplacementForCompany (CompanyID company) |
| Remove all engine replacements for a company. | |
| bool | EngineHasReplacement (CompanyID company, GroupID group, EngineID engine, bool search) |
| Check if a company has a replacement set up for the given engine. | |
| bool | EngineHasReplacementWhenOld (CompanyID company, GroupID group, EngineID engine, bool search) |
| Check if a company has a replacement set up for the given engine when it gets old. | |
| bool | CheckAutoreplaceValidity (EngineID from, EngineID to, CompanyID company) |
| Checks some basic properties whether autoreplace is allowed. | |
Functions related to autoreplacing.
Definition in file autoreplace_func.h.
| CommandCost AddEngineReplacement | ( | DoCommandFlags | flags, |
| CompanyID | company, | ||
| GroupID | group, | ||
| EngineID | engine, | ||
| EngineID | new_engine, | ||
| bool | replace_when_old ) |
Add an engine replacement to the given renewlist.
| flags | The calling command flags. |
| company | The company. |
| group | The group related to this replacement. |
| engine | The original engine type. |
| new_engine | The replacement engine type. |
| replace_when_old | Replace when old or always? |
Definition at line 103 of file autoreplace.cpp.
References Execute, EngineRenew::from, GetEngineRenewList(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by CmdSetAutoReplace().
Checks some basic properties whether autoreplace is allowed.
| from | Origin engine |
| to | Destination engine |
| company | Company to check for |
Definition at line 63 of file autoreplace_cmd.cpp.
References AIR_CTOL, Aircraft, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), EnginesHaveCargoInCommon(), GetAllCompatibleRailTypes(), GetRoadTypeInfo(), IsEngineBuildable(), EngineInfo::misc_flags, RoadTypeInfo::powered_roadtypes, RailVehicleInfo::railtypes, RailVehicleInfo::railveh_type, Road, RoadIsTram, RoadVehicleInfo::roadtype, AircraftVehicleInfo::subtype, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Train, Engine::type, and Wagon.
Referenced by CmdSetAutoReplace(), and ReplaceVehicleWindow::GenerateReplaceVehList().
|
inline |
Check if a company has a replacement set up for the given engine.
| company | The company. |
| group | The group related to this replacement. |
| engine | Engine type to be replaced. |
| search | Whether to search groups and company for replacement. |
Definition at line 31 of file autoreplace_func.h.
References GetEngineRenew(), and EngineRenew::to.
Referenced by AgeVehicle(), and ReplaceVehicleWindow::OnPaint().
|
inline |
Check if a company has a replacement set up for the given engine when it gets old.
| company | The company. |
| group | The group related to this replacement. |
| engine | Engine type to be replaced. |
| search | Whether to search groups and company for replacement. |
Definition at line 45 of file autoreplace_func.h.
References GetEngineRenew(), and EngineRenew::replace_when_old.
Referenced by ReplaceVehicleWindow::OnClick().
| const EngineRenew * GetEngineRenew | ( | CompanyID | company, |
| GroupID | group, | ||
| EngineID | engine, | ||
| bool | search ) |
Retrieves the EngineRenew that specifies the replacement of the given engine type from the given renewlist.
| company | The company. |
| group | The group to look for. |
| engine | The engine to look for. |
| search | Whether to search groups and company for replacement. |
Definition at line 42 of file autoreplace.cpp.
References CompanyProperties::all_engine_renew_list, DEFAULT_GROUP, GetEngineRenew(), ReplaceProtection, and CompanyProperties::ungrouped_engine_renew_list.
| const EngineRenew * GetEngineRenew | ( | const EngineRenewList & | erl, |
| EngineID | engine ) |
Search within a single engine renew list for an engine to renew.
| erl | The engine renew list. |
| engine | The engine to search for. |
Definition at line 26 of file autoreplace.cpp.
Referenced by DrawEngineList(), ReplaceVehicleWindow::DrawWidget(), EngineHasReplacement(), EngineHasReplacementWhenOld(), ReplaceVehicleWindow::GenerateLists(), ReplaceVehicleWindow::GenerateReplaceVehList(), GetEngineRenew(), GetNewEngineType(), and Vehicle::NeedsServicing().
| void RemoveAllEngineReplacementForCompany | ( | CompanyID | company | ) |
Remove all engine replacements for a company.
| company | The company. |
Definition at line 63 of file autoreplace.cpp.
References CompanyProperties::all_engine_renew_list, and CompanyProperties::ungrouped_engine_renew_list.
Referenced by ChangeOwnershipOfCompanyItems().
| CommandCost RemoveEngineReplacement | ( | DoCommandFlags | flags, |
| CompanyID | company, | ||
| GroupID | group, | ||
| EngineID | engine ) |
Remove an engine replacement from a given renewlist.
| flags | The calling command flags. |
| company | The company. |
| group | The group related to this replacement. |
| engine | The original engine type. |
Definition at line 133 of file autoreplace.cpp.
References CMD_ERROR, Execute, EngineRenew::from, GetEngineRenewList(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by CmdSetAutoReplace().