- Timestamp:
- Jun 14, 2006, 3:43:56 PM (18 years ago)
- Location:
- branches/script_engine/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/account.cc
r8271 r8393 39 39 }; 40 40 41 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT );41 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT, ScriptMethod("deposit", ExecutorLua1<Account, float>(&Account::deposit))); 42 42 -
branches/script_engine/src/lib/script_engine/object.cc
r8384 r8393 51 51 }; 52 52 53 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT );53 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT, ScriptMethod("printName", ExecutorLua0<Object>(&Object::printName))); -
branches/script_engine/src/lib/script_engine/script_class.cc
r8390 r8393 17 17 18 18 #include "script_class.h" 19 #include <cassert> 19 20 20 21 /** 21 * standard constructor22 * @brief standard constructor 22 23 * @todo this constructor is not jet implemented - do it 23 24 */ 24 ScriptClass::ScriptClass(const std::string& name, ClassID classID )25 : BaseObject(name)25 ScriptClass::ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods) 26 : BaseObject(name) 26 27 { 27 this->setClassID(CL_SCRIPT_CLASS, "ScriptClass"); 28 this->classID = classID; 28 assert(scriptMethods != NULL); 29 this->setClassID(CL_SCRIPT_CLASS, "ScriptClass"); 30 this->classID = classID; 31 32 this->scriptMethods = scriptMethods; 29 33 } 30 34 … … 35 39 ScriptClass::~ScriptClass () 36 40 { 37 // delete what has to be deleted here41 delete this->scriptMethods; 38 42 } -
branches/script_engine/src/lib/script_engine/script_class.h
r8390 r8393 11 11 #include "script.h" 12 12 #include "lunar.h" 13 #include "script_method.h" 14 13 15 14 16 /** … … 16 18 * this should be used at the beginning of all the Classes that should be loadable (in the cc-file) 17 19 */ 18 #define CREATE_SCRIPTABLE_CLASS(CLASS_NAME, CLASS_ID ) \19 tScriptable<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_ID )20 #define CREATE_SCRIPTABLE_CLASS(CLASS_NAME, CLASS_ID, SCRIPT_METHODS) \ 21 tScriptable<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_ID, new SCRIPT_METHODS) 20 22 21 23 … … 35 37 36 38 protected: 37 ScriptClass(const std::string& name, ClassID classID );39 ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods); 38 40 39 41 private: 40 42 ClassID classID; 43 ScriptMethod* scriptMethods; 41 44 }; 42 45 … … 48 51 { 49 52 public: 50 tScriptable(const std::string& name, ClassID classID )51 : ScriptClass(name, classID )53 tScriptable(const std::string& name, ClassID classID, ScriptMethod* scriptMethods) 54 : ScriptClass(name, classID, scriptMethods) 52 55 { } 53 56 -
branches/script_engine/src/lib/script_engine/script_method.cc
r8390 r8393 27 27 } 28 28 29 ScriptMethod &ScriptMethod::addMethod(const std::string& methodName, const Executor& executor)29 ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor& executor) 30 30 { 31 31 this->methods.push_back(ScriptMethod::Method(methodName, executor)); 32 32 33 return *this;33 return this; 34 34 } 35 35 -
branches/script_engine/src/lib/script_engine/script_method.h
r8390 r8393 19 19 ~ScriptMethod(); 20 20 21 ScriptMethod& addMethod(const std::string& methodName, const Executor& executor); 21 ScriptMethod* addMethod(const std::string& methodName, const Executor& executor); 22 23 const std::string& name(unsigned int methodNumber) const { return methods[methodNumber].name; }; 24 const Executor* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; }; 22 25 23 26 -
branches/script_engine/src/world_entities/space_ships/helicopter.cc
r8389 r8393 36 36 CREATE_FACTORY(Helicopter, CL_HELICOPTER); 37 37 #include "script_class.h" 38 //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER );38 //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, NULL); 39 39 40 40
Note: See TracChangeset
for help on using the changeset viewer.