- Timestamp:
- Aug 18, 2009, 12:06:41 PM (15 years ago)
- Location:
- code/branches/resource2/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource2/src/core/GraphicsManager.cc
r5658 r5660 103 103 // Load resources 104 104 resources_.reset(new XMLFile("resources.oxr", "dataRoot")); 105 resources_->setLuaSupport(false); 105 106 Loader::open(resources_.get()); 106 107 … … 110 111 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Core::getExternalDataPathString(), "FileSystem", "externalDataRoot", false); 111 112 extResources_.reset(new XMLFile("resources.oxr", "externalDataRoot")); 113 extResources_->setLuaSupport(false); 112 114 Loader::open(extResources_.get()); 113 115 } -
code/branches/resource2/src/core/Loader.cc
r5654 r5660 122 122 Loader::currentMask_s = file->getMask() * mask; 123 123 124 // Use the LuaState to replace the XML tags (calls our function) 125 scoped_ptr<LuaState> luaState(new LuaState()); 126 luaState->setIncludeParser(&Loader::replaceLuaTags); 127 luaState->includeFile(file->getFilename(), file->getResourceGroup(), false); 128 //luaState->doString(luaInput); 124 std::string xmlInput; 125 if (file->getLuaSupport()) 126 { 127 // Use the LuaState to replace the XML tags (calls our function) 128 scoped_ptr<LuaState> luaState(new LuaState()); 129 luaState->setIncludeParser(&Loader::replaceLuaTags); 130 luaState->includeFile(file->getFilename(), file->getResourceGroup(), false); 131 xmlInput = luaState->getOutput().str(); 132 } 133 else 134 { 135 shared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename(), file->getResourceGroup()); 136 if (info == NULL) 137 { 138 COUT(1) << "Error: Could not find XML file '" << file->getFilename() << "'." << std::endl; 139 return false; 140 } 141 xmlInput = Resource::open(file->getFilename(), file->getResourceGroup())->getAsString(); 142 } 129 143 130 144 try … … 134 148 135 149 ticpp::Document xmlfile(file->getFilename()); 136 xmlfile.Parse( luaState->getOutput().str(), true);150 xmlfile.Parse(xmlInput, true); 137 151 138 152 ticpp::Element rootElement; -
code/branches/resource2/src/core/LuaState.cc
r5655 r5660 79 79 80 80 // Parse init script 81 // Note: We have to use a hard coded path because the script is required for the resource loading 82 this->doString("dofile(\"" + Core::getDataPathString() + "lua/LuaStateInit.lua\")"); 81 this->doFile("LuaStateInit.lua"); 83 82 } 84 83 -
code/branches/resource2/src/core/XMLFile.h
r5653 r5660 50 50 { } 51 51 52 void setLuaSupport(bool val) { bLuaSupport_ = val; } 53 52 54 const std::string& getFilename() const { return this->filename_; } 53 55 const std::string& getResourceGroup() const { return this->group_; } 54 56 const ClassTreeMask& getMask() const { return this->mask_; } 57 bool getLuaSupport() const { return this->bLuaSupport_; } 55 58 56 59 private: … … 58 61 std::string group_; 59 62 ClassTreeMask mask_; 63 bool bLuaSupport_; 60 64 }; 61 65 } -
code/branches/resource2/src/orxonox/LevelManager.cc
r5659 r5660 142 142 it = availableLevels_.erase(it); 143 143 else 144 { 145 size_t pos = it->find(".oxw"); 146 *it = it->substr(0, pos); 144 147 ++it; 148 } 145 149 } 146 150 }
Note: See TracChangeset
for help on using the changeset viewer.