truelight@9450: /* $Id$ */ truelight@9450: truebrain@9829: /** @file ai_testmode.hpp Switch the AI to Test Mode. */ truelight@9450: truelight@9450: #ifndef AI_TESTMODE_HPP truelight@9450: #define AI_TESTMODE_HPP truelight@9450: truelight@9450: #include "ai_object.hpp" truelight@9450: truelight@9450: /** truebrain@9829: * Class to switch current mode to Test Mode. truelight@9450: * If you create an instance of this class, the mode will be switched to truelight@9450: * Testing. The original mode is stored and recovered from when ever the truelight@9450: * instance is destroyed. truelight@9450: * In Test mode all the commands you execute aren't really executed. The truelight@9450: * system only checks if it would be able to execute your requests, and what truelight@9450: * the cost would be. truelight@9450: */ truelight@9450: class AITestMode : public AIObject { truebrain@9829: public: truebrain@9829: static const char *GetClassName() { return "AITestMode"; } 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 Testing 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 Testing. 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: AITestMode(); 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: ~AITestMode(); truelight@9450: }; truelight@9450: truelight@9450: #endif /* AI_TESTMODE_HPP */