[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[8711] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[8202] | 18 | #include "script_class.h" |
---|
[9916] | 19 | #include "script.h" |
---|
| 20 | #include "debug.h" |
---|
[8408] | 21 | #include <cassert> |
---|
[1853] | 22 | |
---|
[9869] | 23 | ObjectListDefinition(ScriptClass); |
---|
[9916] | 24 | |
---|
| 25 | CREATE_SCRIPTABLE_CLASS(Script, |
---|
| 26 | addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject)) |
---|
[10381] | 27 | ->addMethod("addObjectAsName", Executor3<Script, lua_State*,const std::string&, const std::string&, const std::string& >(&Script::addObjectAsName)) |
---|
[9916] | 28 | ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass)) |
---|
| 29 | ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction)) |
---|
| 30 | ->addMethod("executeFunction", Executor0ret<Script, lua_State*,bool >(&Script::executeFunction)) |
---|
| 31 | ); |
---|
[3245] | 32 | /** |
---|
[8408] | 33 | * @brief standard constructor |
---|
[4838] | 34 | * @todo this constructor is not jet implemented - do it |
---|
[3245] | 35 | */ |
---|
[9869] | 36 | ScriptClass::ScriptClass(const std::string& name, const ClassID& classID, ScriptMethod* scriptMethods) |
---|
| 37 | : BaseObject(name), _classID(classID) |
---|
[3365] | 38 | { |
---|
[9916] | 39 | PRINTF(4)("Name %s\n", name.c_str()); |
---|
[8408] | 40 | assert(scriptMethods != NULL); |
---|
[9897] | 41 | this->registerObject(this, ScriptClass::_objectList); |
---|
[8408] | 42 | |
---|
| 43 | this->_classID = classID; |
---|
| 44 | |
---|
| 45 | this->_scriptMethods = scriptMethods; |
---|
[3365] | 46 | } |
---|
[1853] | 47 | |
---|
| 48 | |
---|
[3245] | 49 | /** |
---|
[4838] | 50 | * standard deconstructor |
---|
[3245] | 51 | */ |
---|
[8202] | 52 | ScriptClass::~ScriptClass () |
---|
[3543] | 53 | { |
---|
[8408] | 54 | delete this->_scriptMethods; |
---|
[3543] | 55 | } |
---|