Changeset 8250 in orxonox.OLD for branches/script_engine/src
- Timestamp:
- Jun 8, 2006, 3:06:29 PM (18 years ago)
- Location:
- branches/script_engine/src
- Files:
-
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/defs/include_paths.am
r8093 r8250 37 37 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/track 38 38 AM_CXXFLAGS+=-I$(MAINSRCDIR)/subprojects 39 AM_CXXFLAGS+=-I$(MAINSRCDIR)/../extern_libs -
branches/script_engine/src/lib/script_engine/Makefile.am
r8246 r8250 16 16 script_manager.cc\ 17 17 script_class.cc\ 18 account.cc \18 account.cc \ 19 19 object.cc 20 20 21 21 22 22 AM_CPPFLAGS= @LUA_INCLUDES@ … … 27 27 script_manager.h\ 28 28 script_class.h 29 29 30 30 31 31 -
branches/script_engine/src/lib/script_engine/account.cc
r8248 r8250 1 2 3 1 2 3 4 4 #include <iostream> 5 5 6 6 #include "luaincl.h" 7 #include "base_object.h" 8 #include "lunar.h" 9 10 #include "script_class.h" 7 11 8 12 9 10 13 class Account : public BaseObject { 11 14 lua_Number m_balance; … … 15 18 16 19 Account(lua_State *L) { m_balance = luaL_checknumber(L, 1); } 17 Account(double balance=0) : m_balance(balance) { }20 Account(double balance=0) : m_balance(balance) { this->setClassID(CL_ACCOUNT, "Account"); } 18 21 19 22 void deposit (float value) { m_balance += value; }; … … 35 38 {0,NULL} 36 39 }; 37 38 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT) 40 41 CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT); 42 -
branches/script_engine/src/lib/script_engine/object.cc
r8248 r8250 2 2 #include <iostream> 3 3 4 #include "luaincl.h" 4 #include "base_object.h" 5 #include "lunar.h" 5 6 6 7 #include "script_class.h" 7 8 8 9 … … 49 50 {0,0} 50 51 }; 51 52 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT) 52 53 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT); -
branches/script_engine/src/lib/script_engine/script_class.h
r8202 r8250 28 28 { 29 29 30 public: 31 ScriptClass(const std::string& name, ClassID classID); 32 virtual ~ScriptClass(); 30 public: 31 virtual ~ScriptClass(); 33 32 34 bool operator==(const std::string& name) { return (this->getName() == name); } 35 bool operator==(ClassID classID) { return (this->classID == classID); } 36 37 virtual void registerClass(Script* script) = 0; 38 virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0; 33 bool operator==(const std::string& name) { return (this->getName() == name); } 34 bool operator==(ClassID classID) { return (this->classID == classID); } 39 35 40 private: 41 ClassID classID; 36 virtual void registerClass(Script* script) = 0; 37 virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0; 38 39 protected: 40 ScriptClass(const std::string& name, ClassID classID); 41 42 private: 43 ClassID classID; 42 44 }; 43 45 … … 48 50 class tScriptable : public ScriptClass 49 51 { 50 tScriptable(const std::string& name, ClassID classID) 51 : ScriptClass(name, classID) 52 { } 52 public: 53 tScriptable(const std::string& name, ClassID classID) 54 : ScriptClass(name, classID) 55 { } 53 56 54 virtual void registerClass(Script* script)55 {56 Lunar<T>::Register(script);57 }58 virtual int insertObject(Script* L, BaseObject* obj, bool gc=false)59 {60 Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc);61 }62 57 virtual void registerClass(Script* script) 58 { 59 Lunar<T>::Register(script); 60 } 61 virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) 62 { 63 Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc); 64 } 65 63 66 64 67
Note: See TracChangeset
for help on using the changeset viewer.