1 | /* |
---|
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. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
17 | |
---|
18 | #include "script_class.h" |
---|
19 | #include "script.h" |
---|
20 | #include "debug.h" |
---|
21 | #include <cassert> |
---|
22 | |
---|
23 | ObjectListDefinition(ScriptClass); |
---|
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 | ); |
---|
31 | /** |
---|
32 | * @brief standard constructor |
---|
33 | * @todo this constructor is not jet implemented - do it |
---|
34 | */ |
---|
35 | ScriptClass::ScriptClass(const std::string& name, const ClassID& classID, ScriptMethod* scriptMethods) |
---|
36 | : BaseObject(name), _classID(classID) |
---|
37 | { |
---|
38 | PRINTF(4)("Name %s\n", name.c_str()); |
---|
39 | assert(scriptMethods != NULL); |
---|
40 | this->registerObject(this, ScriptClass::_objectList); |
---|
41 | |
---|
42 | this->_classID = classID; |
---|
43 | |
---|
44 | this->_scriptMethods = scriptMethods; |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | /** |
---|
49 | * standard deconstructor |
---|
50 | */ |
---|
51 | ScriptClass::~ScriptClass () |
---|
52 | { |
---|
53 | delete this->_scriptMethods; |
---|
54 | } |
---|