diff options
Diffstat (limited to 'src/autoreplace.cpp')
-rw-r--r-- | src/autoreplace.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/autoreplace.cpp b/src/autoreplace.cpp index d72a937d0..18a5c4e3b 100644 --- a/src/autoreplace.cpp +++ b/src/autoreplace.cpp @@ -33,6 +33,11 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine, G return NULL; } +/** + * Remove all engine replacement settings for the company. + * @param erl The renewlist for a given company. + * @return The new renewlist for the company. + */ void RemoveAllEngineReplacement(EngineRenewList *erl) { EngineRenew *er = (EngineRenew *)(*erl); @@ -46,6 +51,14 @@ void RemoveAllEngineReplacement(EngineRenewList *erl) *erl = NULL; // Empty list } +/** + * Retrieve the engine replacement in a given renewlist for an original engine type. + * @param erl The renewlist to search in. + * @param engine Engine type to be replaced. + * @param group The group related to this replacement. + * @return The engine type to replace with, or INVALID_ENGINE if no + * replacement is in the list. + */ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group) { const EngineRenew *er = GetEngineReplacement(erl, engine, group); @@ -56,6 +69,15 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group) return er == NULL ? INVALID_ENGINE : er->to; } +/** + * Add an engine replacement to the given renewlist. + * @param erl The renewlist to add to. + * @param old_engine The original engine type. + * @param new_engine The replacement engine type. + * @param group The group related to this replacement. + * @param flags The calling command flags. + * @return 0 on success, CMD_ERROR on failure. + */ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags) { /* Check if the old vehicle is already in the list */ @@ -79,6 +101,14 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi return CommandCost(); } +/** + * Remove an engine replacement from a given renewlist. + * @param erl The renewlist from which to remove the replacement + * @param engine The original engine type. + * @param group The group related to this replacement. + * @param flags The calling command flags. + * @return 0 on success, CMD_ERROR on failure. + */ CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags) { EngineRenew *er = (EngineRenew *)(*erl); |