Changeset 1132 for code/branches/network2/src/core
- Timestamp:
- Apr 22, 2008, 4:25:54 PM (17 years ago)
- Location:
- code/branches/network2/src/core
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network2/src/core/CMakeLists.txt
r1084 r1132 1 #get the created files 2 AUX_SOURCE_DIRECTORY(tolua TOLUA_BIND_FILES) 3 4 SET( CORE_SRC_FILES 1 SET(CORE_SRC_FILES 5 2 OrxonoxClass.cc 6 3 BaseObject.cc … … 29 26 Tickable.cc 30 27 Script.cc 31 ${TOLUA_BIND_FILES}32 28 ) 33 29 34 ADD_LIBRARY( 30 ADD_LIBRARY(core SHARED ${CORE_SRC_FILES}) 35 31 36 TARGET_LINK_LIBRARIES( 32 TARGET_LINK_LIBRARIES(core 37 33 util 34 tolualib 38 35 ${Lua_LIBRARIES} 39 ${Lua_LIBRARY}40 36 ${OIS_LIBRARIES} 41 37 ) -
code/branches/network2/src/core/ConfigFileManager.h
r1064 r1132 63 63 { 64 64 public: 65 virtual ~ConfigFileEntry() {}; 65 66 virtual void setValue(const std::string& value) = 0; 66 67 virtual std::string getValue() const = 0; -
code/branches/network2/src/core/Loader.cc
r1085 r1132 115 115 Script::init(Script::getLuaState()); 116 116 Script::run();*/ 117 //Script* lua = Script::getInstance();118 //lua->loadFile(level->getFile(), true);119 //lua->run();117 Script* lua = Script::getInstance(); 118 lua->loadFile(level->getFile(), true); 119 lua->run(); 120 120 121 121 try … … 124 124 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl; 125 125 126 ticpp::Document xmlfile(level->getFile());127 xmlfile.LoadFile();126 //ticpp::Document xmlfile(level->getFile()); 127 //xmlfile.LoadFile(); 128 128 //ticpp::Element myelement(*Script::getFileString()); 129 //ticpp::Document xmlfile;130 xmlfile.ToDocument();131 //xmlfile.Parse(lua->getLuaOutput(), true);129 ticpp::Document xmlfile; 130 //xmlfile.ToDocument(); 131 xmlfile.Parse(lua->getLuaOutput(), true); 132 132 133 133 ticpp::Element rootElement; -
code/branches/network2/src/core/Script.cc
r1076 r1132 39 39 } 40 40 41 #include "tolua ++.h"41 #include "tolua/tolua++.h" 42 42 #include "tolua/tolua_bind.h" 43 43 … … 102 102 } 103 103 104 #if LUA_VERSION_NUM != 501 105 const char * Script::lua_Chunkreader(lua_State *L, void *data, size_t *size) 106 { 107 LoadS* ls = ((LoadS*)data); 108 if (ls->size == 0) return NULL; 109 *size = ls->size; 110 ls->size = 0; 111 return ls->s; 112 } 113 #endif 104 114 void Script::run() 105 115 { … … 110 120 error = luaL_loadstring(luaState_, init.c_str()); 111 121 #else 112 error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, (void*)init.c_str(), "init"); 122 LoadS ls; 123 ls.s = init.c_str(); 124 ls.size = init.size(); 125 error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, &ls, init.c_str()); 113 126 #endif 114 127 if (error == 0) -
code/branches/network2/src/core/Script.h
r1056 r1132 50 50 class _CoreExport Script // tolua_export 51 51 { // tolua_export 52 struct LoadS { 53 const char *s; 54 size_t size; 55 }; 56 52 57 public: 53 58 inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export … … 61 66 62 67 #if LUA_VERSION_NUM != 501 63 inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};68 static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size); 64 69 #endif 65 70
Note: See TracChangeset
for help on using the changeset viewer.