| [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)) |
|---|
| 27 | ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass)) |
|---|
| 28 | ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction)) |
|---|
| 29 | ->addMethod("executeFunction", Executor0ret<Script, lua_State*,bool >(&Script::executeFunction)) |
|---|
| 30 | ); |
|---|
| [3245] | 31 | /** |
|---|
| [8408] | 32 | * @brief standard constructor |
|---|
| [4838] | 33 | * @todo this constructor is not jet implemented - do it |
|---|
| [3245] | 34 | */ |
|---|
| [9869] | 35 | ScriptClass::ScriptClass(const std::string& name, const ClassID& classID, ScriptMethod* scriptMethods) |
|---|
| 36 | : BaseObject(name), _classID(classID) |
|---|
| [3365] | 37 | { |
|---|
| [9916] | 38 | PRINTF(4)("Name %s\n", name.c_str()); |
|---|
| [8408] | 39 | assert(scriptMethods != NULL); |
|---|
| [9897] | 40 | this->registerObject(this, ScriptClass::_objectList); |
|---|
| [8408] | 41 | |
|---|
| 42 | this->_classID = classID; |
|---|
| 43 | |
|---|
| 44 | this->_scriptMethods = scriptMethods; |
|---|
| [3365] | 45 | } |
|---|
| [1853] | 46 | |
|---|
| 47 | |
|---|
| [3245] | 48 | /** |
|---|
| [4838] | 49 | * standard deconstructor |
|---|
| [3245] | 50 | */ |
|---|
| [8202] | 51 | ScriptClass::~ScriptClass () |
|---|
| [3543] | 52 | { |
|---|
| [8408] | 53 | delete this->_scriptMethods; |
|---|
| [3543] | 54 | } |
|---|