truelight@9450: /* $Id$ */ truelight@9450: truelight@9450: /** @file ai_settings.hpp everything to change AI settings */ truelight@9450: truelight@9450: #ifndef AI_SETTINGS_HPP truelight@9450: #define AI_SETTINGS_HPP truelight@9450: truelight@9450: #include "ai_object.hpp" truelight@9450: truelight@9450: /** truelight@9450: * Class that handles all AI settings related functions. truelight@9450: */ truelight@9450: class AISettings : public AIObject { truelight@9450: public: truelight@9450: /** truelight@9529: * The name of the class, needed by several sub-processes. truelight@9529: */ truelight@9529: static const char *GetClassName() { return "AISettings"; } truelight@9529: truelight@9529: /** truelight@9450: * Change the minimum amount of time the AI should be put in suspend mode truelight@9450: * when you execute a command. Normally in SP this is 1, and in MP it is truelight@9450: * what ever delay the server has been programmed to delay commands truelight@9450: * (normally between 1 and 5). To give a more 'real' effect to your AI, truelight@9450: * you can control that number here. truelight@9450: * @param ticks the minimum amount of ticks to wait. truelight@9450: * @pre ticks should be positive. Too big values will influence performance of the AI. truelight@9450: * @note If the number is lower then the MP setting, the MP setting wins. truelight@9450: */ truelight@9450: void SetCommandDelay(uint ticks); truelight@9450: }; truelight@9450: truelight@9450: #ifdef DEFINE_SQUIRREL_CLASS rubidium@9524: namespace SQConvert { rubidium@9524: /* Allow AISettings to be used as Squirrel parameter */ rubidium@9524: template <> AISettings *GetParam(ForceType, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISettings *)instance; } rubidium@9524: }; // namespace SQConvert rubidium@9524: truelight@9450: void SQAISettingsRegister(Squirrel *engine) { truelight@9450: DefSQClass SQAISettings("AISettings"); truelight@9450: SQAISettings.PreRegister(engine); truelight@9450: SQAISettings.AddConstructor(engine); rubidium@9526: truelight@9530: SQAISettings.DefSQMethod(engine, &AISettings::SetCommandDelay, "SetCommandDelay"); rubidium@9526: truelight@9450: SQAISettings.PostRegister(engine); truelight@9450: } rubidium@9520: #endif /* DEFINE_SQUIRREL_CLASS */ truelight@9450: truelight@9450: #endif /* AI_SETTINGS_HPP */