# autoreplace_func.h

Go to the documentation of this file.

    00001 /* $Id: autoreplace_func.h 15434 2009-02-09 21:20:05Z rubidium $ */
    00002
    00005 #ifndef AUTOREPLACE_FUNC_H
    00006 #define AUTOREPLACE_FUNC_H
    00007
    00008 #include "autoreplace_type.h"
    00009 #include "company_base.h"
    00010
    00016 void RemoveAllEngineReplacement(EngineRenewList *erl);
    00017
    00025 EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
    00026
    00035 CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags);
    00036
    00044 CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags);
    00045
    00050 static inline void RemoveAllEngineReplacementForCompany(Company *c)
    00051 {
    00052   RemoveAllEngineReplacement(&c->engine_renew_list);
    00053 }
    00054
    00062 static inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group)
    00063 {
    00064   return EngineReplacement(c->engine_renew_list, engine, group);
    00065 }
    00066
    00073 static inline bool EngineHasReplacementForCompany(const Company *c, EngineID engine, GroupID group)
    00074 {
    00075   return EngineReplacementForCompany(c, engine, group) != INVALID_ENGINE;
    00076 }
    00077
    00086 static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags)
    00087 {
    00088   return AddEngineReplacement(&c->engine_renew_list, old_engine, new_engine, group, flags);
    00089 }
    00090
    00098 static inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, DoCommandFlag flags)
    00099 {
    00100   return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags);
    00101 }
    00102
    00103 bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company);
    00104
    00105 #endif /* AUTOREPLACE_FUNC_H */