00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "ScriptCmd.h" 00010 00011 #include "ScriptState.h" 00012 00013 //----------------------------------------------------------------- 00014 /** 00015 * Obtain script function. 00016 * @param script script state where to execute 00017 * @param funcRef index of function at registry 00018 */ 00019 ScriptCmd::ScriptCmd(ScriptState *script, int funcRef) 00020 { 00021 m_script = script; 00022 m_funcRef = funcRef; 00023 } 00024 //----------------------------------------------------------------- 00025 /** 00026 * Remove function from registry. 00027 */ 00028 ScriptCmd::~ScriptCmd() 00029 { 00030 m_script->unref(m_funcRef); 00031 } 00032 //----------------------------------------------------------------- 00033 /** 00034 * Return true when command has finished his work. 00035 * @param count number of calls 00036 * @return true for finish 00037 * @throws ScriptException when error occures 00038 */ 00039 bool 00040 ScriptCmd::finish(int count) 00041 { 00042 return m_script->callCommand(m_funcRef, count); 00043 } 00044