|
OpenTTD Source 20261129-master-g72a8bdc861
|
Management of replacement lists. More...
#include "stdafx.h"#include "autoreplace_func.h"#include "autoreplace_type.h"#include "command_func.h"#include "company_base.h"#include "group.h"#include "safeguards.h"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. | |
| void | RemoveAllEngineReplacementForCompany (CompanyID company) |
| Remove all engine replacements for a company. | |
| EngineRenewList & | GetEngineRenewList (CompanyID company, GroupID group) |
| Get the Engine Renew List for a company/group. | |
| 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. | |
Management of replacement lists.
Definition in file autoreplace.cpp.
| 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().
| 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().
| EngineRenewList & GetEngineRenewList | ( | CompanyID | company, |
| GroupID | group ) |
Get the Engine Renew List for a company/group.
| company | The company. |
| group | The group. |
Definition at line 83 of file autoreplace.cpp.
References ALL_GROUP, DEFAULT_GROUP, and Group::engine_renew_list.
Referenced by AddEngineReplacement(), and RemoveEngineReplacement().
| 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().