# autoreplace_func.h

Go to the documentation of this file.

    00001 /* $Id: autoreplace_func.h 11818 2008-01-12 14:10:35Z rubidium $ */
    00002
    00005 #ifndef AUTOREPLACE_FUNC_H
    00006 #define AUTOREPLACE_FUNC_H
    00007
    00008 #include "autoreplace_type.h"
    00009 #include "player_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, uint32 flags);
    00036
    00044 CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, uint32 flags);
    00045
    00050 static inline void RemoveAllEngineReplacementForPlayer(Player *p)
    00051 {
    00052   RemoveAllEngineReplacement(&p->engine_renew_list);
    00053 }
    00054
    00062 static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine, GroupID group)
    00063 {
    00064   return EngineReplacement(p->engine_renew_list, engine, group);
    00065 }
    00066
    00073 static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine, GroupID group)
    00074 {
    00075   return EngineReplacementForPlayer(p, engine, group) != INVALID_ENGINE;
    00076 }
    00077
    00086 static inline CommandCost AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags)
    00087 {
    00088   return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, group, flags);
    00089 }
    00090
    00098 static inline CommandCost RemoveEngineReplacementForPlayer(Player *p, EngineID engine, GroupID group, uint32 flags)
    00099 {
    00100   return RemoveEngineReplacement(&p->engine_renew_list, engine, group, flags);
    00101 }
    00102
    00103 #endif /* AUTOREPLACE_FUNC_H */