truelight@9450: /* $Id$ */ truelight@9450: truebrain@9829: /** @file ai_execmode.hpp Switch the AI to Execute Mode. */ truelight@9450: truelight@9450: #ifndef AI_EXECMODE_HPP truelight@9450: #define AI_EXECMODE_HPP truelight@9450: truelight@9450: #include "ai_object.hpp" truelight@9450: truelight@9450: /** truebrain@9829: * Class to switch current mode to Execute Mode. truelight@9450: * If you create an instance of this class, the mode will be switched to truelight@9450: * Execute. The original mode is stored and recovered from when ever the truelight@9450: * instance is destroyed. truelight@9450: * In Execute mode all commands you do are executed for real. truelight@9450: */ truelight@9450: class AIExecMode : public AIObject { truebrain@9829: public: truebrain@9829: static const char *GetClassName() { return "AIExecMode"; } truebrain@9829: truelight@9450: private: truelight@9450: AIModeProc *last_mode; truelight@9473: AIObject *last_instance; truelight@9450: truelight@9450: protected: truelight@9475: /** truelight@9475: * The callback proc for Execute mode. truelight@9475: */ glx@9629: static bool ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs); truelight@9450: truelight@9450: public: truelight@9450: /** truelight@9450: * Creating instance of this class switches the build mode to Execute. truebrain@9839: * @note When the instance is destroyed, he restores the mode that was truelight@9450: * current when the instance was created! truelight@9450: */ truelight@9450: AIExecMode(); truelight@9450: truelight@9450: /** truelight@9450: * Destroying this instance reset the building mode to the mode it was truelight@9450: * in when the instance was created. truelight@9450: */ truelight@9450: ~AIExecMode(); truelight@9450: }; truelight@9450: truelight@9450: #endif /* AI_EXECMODE_HPP */