(svn r9463) [NoAI] -Codechange: update squirrel export script to generate the correct amount and type of parameters, so that can be checked.
/* $Id$ */
/** @file ai_execmode.hpp class to switch the AI to Execute mode */
#ifndef AI_EXECMODE_HPP
#define AI_EXECMODE_HPP
#include "ai_object.hpp"
/**
* Class to switch current mode to Execute mode.
* If you create an instance of this class, the mode will be switched to
* Execute. The original mode is stored and recovered from when ever the
* instance is destroyed.
* In Execute mode all commands you do are executed for real.
*/
class AIExecMode : public AIObject {
private:
AIModeProc *last_mode;
AIObject *last_instance;
protected:
/**
* The callback proc for Execute mode.
*/
static bool ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, int32 costs);
public:
/**
* The name of the class, needed by several sub-processes.
*/
static const char *GetClassName() { return "AIExecMode"; }
/**
* Creating instance of this class switches the build mode to Execute.
* @note when the instance is destroyed, he restores the mode that was
* current when the instance was created!
*/
AIExecMode();
/**
* Destroying this instance reset the building mode to the mode it was
* in when the instance was created.
*/
~AIExecMode();
};
#ifdef DEFINE_SQUIRREL_CLASS
namespace SQConvert {
/* Allow AIExecMode to be used as Squirrel parameter */
template <> AIExecMode *GetParam(ForceType<AIExecMode *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIExecMode *)instance; }
}; // namespace SQConvert
void SQAIExecModeRegister(Squirrel *engine) {
DefSQClass <AIExecMode> SQAIExecMode("AIExecMode");
SQAIExecMode.PreRegister(engine);
SQAIExecMode.AddConstructor(engine);
SQAIExecMode.DefSQStaticMethod(engine, &AIExecMode::GetClassName, "GetClassName", 1, "x");
SQAIExecMode.PostRegister(engine);
}
#endif /* DEFINE_SQUIRREL_CLASS */
#endif /* AI_EXECMODE_HPP */