Changeset 1959 for code/branches/objecthierarchy
- Timestamp:
- Oct 19, 2008, 11:46:37 PM (16 years ago)
- Location:
- code/branches/objecthierarchy
- Files:
-
- 2 deleted
- 6 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy
- Property svn:mergeinfo changed
/code/branches/script_trigger (added) merged: 1296,1307,1383,1541,1550,1671,1693,1851,1904,1906
- Property svn:mergeinfo changed
-
code/branches/objecthierarchy/src/core/CMakeLists.txt
r1887 r1959 6 6 GameState.cc 7 7 Language.cc 8 Luabind.cc 8 9 ObjectListBase.cc 9 10 OrxonoxClass.cc 10 11 RootGameState.cc 11 Script.cc12 12 13 13 # command … … 62 62 tolua_orxonox 63 63 tolua/tolua.pkg 64 Script.h64 LuaBind.h 65 65 CommandExecutor.h 66 66 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib -
code/branches/objecthierarchy/src/core/Loader.cc
r1755 r1959 34 34 #include "ObjectList.h" 35 35 #include "CoreIncludes.h" 36 #include " Script.h"36 #include "LuaBind.h" 37 37 #include "Namespace.h" 38 38 #include "util/Debug.h" … … 119 119 120 120 // let Lua work this out: 121 //Script* lua; 122 /*Script::loadFile(level->getFile(), true); 123 Script::init(Script::getLuaState()); 124 Script::run();*/ 125 Script* lua = Script::getInstance(); 121 LuaBind* lua = LuaBind::getInstance(); 126 122 lua->clearLuaOutput(); 127 123 lua->loadFile(level->getFile(), true); -
code/branches/objecthierarchy/src/core/LuaBind.cc
- Property svn:eol-style set to native
r1954 r1959 32 32 #include <map> 33 33 34 #include "CoreIncludes.h" 35 36 extern "C" { 37 #include <lualib.h> 38 #include <lauxlib.h> 39 } 40 34 #include "lua/lua.hpp" 41 35 #include "tolua/tolua++.h" 42 36 #include "tolua/tolua_bind.h" 37 #include "util/String.h" 38 #include "CoreIncludes.h" 43 39 44 40 namespace orxonox … … 60 56 luaopen_debug(luaState_); 61 57 #endif 62 tolua_ core_open(luaState_);58 tolua_Core_open(luaState_); 63 59 output_ = ""; 64 60 isRunning_ = false; … … 68 64 { 69 65 output_ += str; 70 COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl; 66 // COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl; 67 COUT(5) << str; 71 68 } 72 69 … … 101 98 102 99 if (luaTags) luaSource_ = replaceLuaTags(levelString); 103 COUT( 4) << "ParsedSourceCode: " << luaSource_ << std::endl;100 COUT(5) << "ParsedSourceCode: " << luaSource_ << std::endl; 104 101 } 105 102 … … 152 149 } 153 150 154 unsigned int LuaBind::getNextQuote(const std::string& text, unsigned int start)155 {156 unsigned int quote = start - 1;157 158 while ((quote = text.find('\"', quote + 1)) != std::string::npos)159 {160 unsigned int backslash = quote;161 unsigned int numbackslashes = 0;162 for (; backslash > 0; backslash--, numbackslashes++)163 if (text[backslash - 1] != '\\')164 break;165 166 if (numbackslashes % 2 == 0)167 break;168 }169 170 return quote;171 }172 173 151 std::string LuaBind::replaceLuaTags(const std::string& text) 174 152 { 175 153 // chreate map with all Lua tags 176 std::map< unsigned int, bool> luaTags;177 { 178 unsigned int pos = 0;154 std::map<size_t, bool> luaTags; 155 { 156 size_t pos = 0; 179 157 while ((pos = text.find("<?lua", pos)) != std::string::npos) 180 158 luaTags[pos++] = true; 181 159 } 182 160 { 183 unsigned int pos = 0;161 size_t pos = 0; 184 162 while ((pos = text.find("?>", pos)) != std::string::npos) 185 163 luaTags[pos++] = false; … … 188 166 // erase all tags from the map that are between two quotes 189 167 { 190 std::map< unsigned int, bool>::iterator it = luaTags.begin();191 std::map< unsigned int, bool>::iterator it2 = it;168 std::map<size_t, bool>::iterator it = luaTags.begin(); 169 std::map<size_t, bool>::iterator it2 = it; 192 170 bool bBetweenQuotes = false; 193 unsigned int pos = 0;171 size_t pos = 0; 194 172 while ((pos = getNextQuote(text, pos)) != std::string::npos) 195 173 { … … 214 192 { 215 193 bool expectedValue = true; 216 for (std::map< unsigned int, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)217 { 218 if ( (*it).second == expectedValue)194 for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it) 195 { 196 if (it->second == expectedValue) 219 197 expectedValue = !expectedValue; 220 198 else … … 234 212 std::string output; 235 213 { 236 std::map< unsigned int, bool>::iterator it = luaTags.begin();214 std::map<size_t, bool>::iterator it = luaTags.begin(); 237 215 bool bInPrintFunction = true; 238 unsigned int start = 0;239 unsigned intend = 0;216 size_t start = 0; 217 size_tend = 0; 240 218 241 219 do … … 253 231 std::string temp = text.substr(start, end - start); 254 232 { 255 unsigned int pos = 0;233 size_t pos = 0; 256 234 while ((pos = temp.find('[', pos)) != std::string::npos) 257 235 { 258 236 unsigned int tempCounter = 1; 259 unsigned int tempPos = pos++;237 size_t tempPos = pos++; 260 238 while(temp[++tempPos] == '=') { 261 239 tempCounter++; … … 272 250 } 273 251 { 274 unsigned int pos = 0;252 size_t pos = 0; 275 253 while ((pos = temp.find(']', pos)) != std::string::npos) 276 254 { 277 255 unsigned int tempCounter = 1; 278 unsigned int tempPos = pos++;256 size_t tempPos = pos++; 279 257 while(temp[++tempPos] == '=') { 280 258 tempCounter++; -
code/branches/objecthierarchy/src/core/LuaBind.h
- Property svn:eol-style set to native
r1954 r1959 28 28 29 29 /** 30 @file LuaBind.h30 @file 31 31 @brief Representation of an interface to lua 32 32 @author Benjamin Knecht <beni_at_orxonox.net> … … 39 39 40 40 extern "C" { 41 #include <lua .h>41 #include <lua/lua.h> 42 42 } 43 43 … … 47 47 namespace orxonox // tolua_export 48 48 { // tolua_export 49 50 class _CoreExport LuaBind // tolua_export 51 { // tolua_export 49 class _CoreExport LuaBind 50 { 51 /* 52 class LuaBind { // tolua_export 53 */ 52 54 struct LoadS { 53 55 const char *s; … … 73 75 inline std::string getLuaOutput() { return output_; }; 74 76 //inline std::string* getFileString() { return &fileString_; }; 77 inline void clearLuaOutput() { output_ = ""; } 75 78 76 unsigned int getNextQuote(const std::string& text, unsigned int start);77 79 std::string replaceLuaTags(const std::string& text); // tolua_export 78 80 -
code/branches/objecthierarchy/src/core/tolua/tolua.pkg
r1755 r1959 1 $cfile "../../src/core/ Script.h"1 $cfile "../../src/core/LuaBind.h" 2 2 $cfile "../../src/core/CommandExecutor.h" -
code/branches/objecthierarchy/src/orxonox/CMakeLists.txt
r1957 r1959 54 54 objects/Tickable.cc 55 55 objects/Test.cc 56 objects/Script.cc 57 objects/Trigger.cc 58 objects/DistanceTrigger.cc 56 59 57 60 objects/infos/Info.cc … … 74 77 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib 75 78 ) 76 79 80 77 81 ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} ) 78 82 -
code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.cc
- Property svn:eol-style set to native
-
code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.h
- Property svn:eol-style set to native
-
code/branches/objecthierarchy/src/orxonox/objects/Script.cc
- Property svn:eol-style set to native
-
code/branches/objecthierarchy/src/orxonox/objects/Script.h
- Property svn:eol-style set to native
-
code/branches/objecthierarchy/src/orxonox/objects/Trigger.cc
- Property svn:eol-style set to native
r1954 r1959 223 223 XMLPortParamLoadOnly(Trigger, "stayOn", setStayOn, xmlelement, mode); 224 224 XMLPortParamLoadOnly(Trigger, "activations", setActivations, xmlelement, mode); 225 XMLPortParamLoadOnly(Trigger, "invert", setInvert, xmlelement, mode); 225 226 //XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, std::string); 226 227 -
code/branches/objecthierarchy/src/orxonox/objects/Trigger.h
- Property svn:eol-style set to native
r1954 r1959 56 56 inline bool isActive() { return bActive_; } 57 57 void addTrigger(Trigger* trig); 58 void setInvert(int invert) { bInvertMode_ = invert; } 58 59 const Trigger* getTrigger(unsigned int index) const; 59 60 void setVisibility(bool bVisible); -
code/branches/objecthierarchy/visual_studio/vc8/base.vsprops
- Property svn:mergeinfo changed
/code/branches/script_trigger/visual_studio/vc8/base.vsprops (added) merged: 1295-1953,1955
- Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.