Changeset 7648 for code/trunk/src
- Timestamp:
- Nov 13, 2010, 11:55:23 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 10 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/releasetodo (added) merged: 7614,7625-7629,7638-7639,7645-7647
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/GUIManager.cc
r7403 r7648 43 43 #include <CEGUIWindow.h> 44 44 #include <CEGUIWindowManager.h> 45 #include <elements/CEGUIListbox.h> 46 #include <elements/CEGUIListboxItem.h> 45 47 #include <ogreceguirenderer/OgreCEGUIRenderer.h> 46 48 … … 436 438 } 437 439 440 /** 441 @brief 442 Subscribe the input function to the input event for the input window. 443 This is a helper to be used in lua, because subscribeScriptedEvent() doesn't work in lua. 444 @param window 445 The window for which the event is subscribed. 446 @param event 447 The type of event to which we subscribe. 448 @param function 449 The function that is called when the event occurs. 450 */ 438 451 void GUIManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function) 439 452 { 440 453 window->subscribeScriptedEvent(event, function); 441 454 } 455 456 /** 457 @brief 458 Set the input tooltip text for the input ListboxItem. 459 @param item 460 The ListboxItem for which the tooltip should be set. 461 @param tooltip 462 The tooltip text that should be set. 463 */ 464 void GUIManager::setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& tooltip) 465 { 466 item->setTooltipText(tooltip); 467 } 468 469 /** 470 @brief 471 Set whether the tooltips for the input Listbox are enabled. 472 @param listbox 473 The Listbox for which to enable (or disable) tooltips. 474 @param enabled 475 Whether to enable or disabel the tooltips. 476 */ 477 void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled) 478 { 479 listbox->setItemTooltipsEnabled(enabled); 480 } 481 442 482 } -
code/trunk/src/libraries/core/GUIManager.h
r7403 r7648 106 106 // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work 107 107 static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export 108 static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export 109 static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export 108 110 109 111 static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export -
code/trunk/src/libraries/core/Loader.cc
r6422 r7648 88 88 } 89 89 90 bool Loader::load(const ClassTreeMask& mask) 90 /** 91 @brief 92 Loads all opened files, while conforming to the restrictions given by the input ClassTreeMask. 93 @param mask 94 A ClassTreeMask, which defines which types of classes are loaded and which aren't. 95 @param verbose 96 Whether the loader is verbose (prints its progress in a low output level) or not. 97 @return 98 Returns true if successful. 99 */ 100 bool Loader::load(const ClassTreeMask& mask, bool verbose) 91 101 { 92 102 bool success = true; 93 103 for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it) 94 if (!Loader::load(it->first, it->second * mask ))104 if (!Loader::load(it->first, it->second * mask, verbose)) 95 105 success = false; 96 106 … … 109 119 } 110 120 111 bool Loader::reload(const ClassTreeMask& mask) 121 /** 122 @brief 123 Reloads all opened files, while conforming to the restrictions given by the input ClassTreeMask. 124 @param mask 125 A ClassTreeMask, which defines which types of classes are reloaded and which aren't. 126 @param verbose 127 Whether the loader is verbose (prints its progress in a low output level) or not. 128 @return 129 Returns true if successful. 130 */ 131 bool Loader::reload(const ClassTreeMask& mask, bool verbose) 112 132 { 113 133 Loader::unload(mask); 114 return Loader::load(mask); 115 } 116 117 bool Loader::load(const XMLFile* file, const ClassTreeMask& mask) 134 return Loader::load(mask, verbose); 135 } 136 137 /** 138 @brief 139 Loads the input file, while conforming to the restrictions given by the input ClassTreeMask. 140 @param file 141 The file to be loaded. 142 @param mask 143 A ClassTreeMask, which defines which types of classes are loaded and which aren't. 144 @param verbose 145 Whether the loader is verbose (prints its progress in a low output level) or not. 146 @return 147 Returns true if successful. 148 */ 149 bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool verbose) 118 150 { 119 151 if (!file) … … 144 176 try 145 177 { 146 COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl; 147 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl; 178 if(verbose) 179 { 180 COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl; 181 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl; 182 } 183 else 184 { 185 COUT(4) << "Start loading " << file->getFilename() << "..." << std::endl; 186 COUT(4) << "Mask: " << Loader::currentMask_s << std::endl; 187 } 148 188 149 189 ticpp::Document xmlfile(file->getFilename()); … … 165 205 rootNamespace->XMLPort(rootElement, XMLPort::LoadObject); 166 206 167 COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl; 207 if(verbose) 208 COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl; 209 else 210 COUT(4) << "Finished loading " << file->getFilename() << '.' << std::endl; 168 211 169 212 COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString(" ") << std::endl; … … 210 253 } 211 254 212 bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask) 255 /** 256 @brief 257 Reloads the input file, while conforming to the restrictions given by the input ClassTreeMask. 258 @param file 259 The file to be reloaded. 260 @param mask 261 A ClassTreeMask, which defines which types of classes are reloaded and which aren't. 262 @param verbose 263 Whether the loader is verbose (prints its progress in a low output level) or not. 264 @return 265 Returns true if successful. 266 */ 267 bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool verbose) 213 268 { 214 269 Loader::unload(file, mask); 215 return Loader::load(file, mask );270 return Loader::load(file, mask, verbose); 216 271 } 217 272 -
code/trunk/src/libraries/core/Loader.h
r7401 r7648 57 57 static void remove(const XMLFile* file); 58 58 59 static bool load(const ClassTreeMask& mask = ClassTreeMask() );59 static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true); 60 60 static void unload(const ClassTreeMask& mask = ClassTreeMask()); 61 static bool reload(const ClassTreeMask& mask = ClassTreeMask() );61 static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true); 62 62 63 static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask() );63 static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true); 64 64 static void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask()); 65 static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask() );65 static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true); 66 66 67 67 static std::string replaceLuaTags(const std::string& text); -
code/trunk/src/orxonox/CMakeLists.txt
r7504 r7648 25 25 SET_SOURCE_FILES(ORXONOX_SRC_FILES 26 26 Level.cc 27 LevelInfo.cc 27 28 LevelManager.cc 28 29 Main.cc … … 58 59 TOLUA_FILES 59 60 ChatInputHandler.h 61 LevelInfo.h 60 62 LevelManager.h 61 63 MoodManager.h -
code/trunk/src/orxonox/Level.cc
r7163 r7648 76 76 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 77 77 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 78 }78 } 79 79 80 80 void Level::registerVariables() -
code/trunk/src/orxonox/LevelManager.cc
r7284 r7648 32 32 33 33 #include "util/ScopedSingletonManager.h" 34 #include "core/ClassTreeMask.h" 34 35 #include "core/CommandLineParser.h" 35 36 #include "core/ConfigValueIncludes.h" … … 37 38 #include "core/Loader.h" 38 39 #include "core/Resource.h" 40 #include "core/XMLFile.h" 39 41 #include "PlayerManager.h" 40 42 #include "Level.h" 43 #include "LevelInfo.h" 41 44 42 45 namespace orxonox … … 56 59 ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").getString()); 57 60 } 61 62 this->compileAvailableLevelList(); 58 63 } 59 64 … … 125 130 } 126 131 127 const std::string& LevelManager::getAvailableLevelListItem(unsigned int index) const132 unsigned int LevelManager::getNumberOfLevels() 128 133 { 129 if (index >= availableLevels_.size()) 130 return BLANKSTRING; 134 this->updateAvailableLevelList(); 135 136 return this->availableLevels_.size(); 137 } 138 139 LevelInfoItem* LevelManager::getAvailableLevelListItem(unsigned int index) const 140 { 141 if (index >= this->availableLevels_.size()) 142 return NULL; 131 143 else 132 return availableLevels_[index]; 144 { 145 std::map<std::string, LevelInfoItem*>::const_iterator it = this->infos_.find(this->availableLevels_[index]); 146 return it->second; 147 } 133 148 } 134 149 135 150 void LevelManager::compileAvailableLevelList() 136 151 { 137 this->availableLevels_.clear();138 152 Ogre::StringVectorPtr levels = Resource::findResourceNames("*.oxw"); 153 // Iterate over all *.oxw level files. 139 154 for (Ogre::StringVector::const_iterator it = levels->begin(); it != levels->end(); ++it) 140 155 { 156 //TODO: Replace with tag, 141 157 if (it->find("old/") != 0) 142 158 { 143 159 size_t pos = it->find(".oxw"); 160 161 bool infoExists = false; 162 // Load the LevelInfo object from the level file. 163 XMLFile file = XMLFile(*it); 164 ClassTreeMask mask = ClassTreeMask(); 165 mask.exclude(ClassIdentifier<BaseObject>::getIdentifier()); 166 mask.include(ClassIdentifier<LevelInfo>::getIdentifier()); 167 Loader::load(&file, mask, false); 168 for(ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item) 169 { 170 LevelInfoItem* info = item->copy(); 171 if(info->getXMLFilename() == *it) 172 { 173 this->infos_.insert(std::pair<std::string, LevelInfoItem*>(it->substr(0, pos),info)); 174 infoExists = true; 175 } 176 } 177 Loader::unload(&file, mask); 178 if(!infoExists) 179 { 180 this->infos_.insert(std::pair<std::string, LevelInfoItem*>(it->substr(0, pos), new LevelInfoItem(it->substr(0, pos), *it))); 181 } 182 144 183 this->availableLevels_.push_back(it->substr(0, pos)); 145 184 } 146 185 } 147 186 } 187 188 void LevelManager::updateAvailableLevelList(void) 189 { 190 //TODO: Implement some kind of update? 191 } 148 192 } -
code/trunk/src/orxonox/LevelManager.h
r6746 r7648 34 34 #include <cassert> 35 35 #include <list> 36 #include <map> 36 37 #include <string> 37 38 … … 59 60 void setDefaultLevel(const std::string& levelName); //tolua_export 60 61 const std::string& getDefaultLevel() const; //tolua_export 61 void compileAvailableLevelList(); //tolua_export62 const std::string&getAvailableLevelListItem(unsigned int index) const; //tolua_export62 unsigned int getNumberOfLevels(void); //tolua_export 63 LevelInfoItem* getAvailableLevelListItem(unsigned int index) const; //tolua_export 63 64 64 65 static LevelManager& getInstance() { return Singleton<LevelManager>::getInstance(); } // tolua_export … … 69 70 void activateNextLevel(); 70 71 72 void compileAvailableLevelList(void); 73 void updateAvailableLevelList(void); 74 71 75 std::list<Level*> levels_s; 72 76 std::vector<std::string> availableLevels_; 77 std::map<std::string, LevelInfoItem*> infos_; 73 78 74 79 // config values -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r7163 r7648 67 67 class CameraManager; 68 68 class Level; 69 class LevelInfo; 70 class LevelInfoItem; 69 71 class LevelManager; 70 72 class PawnManager;
Note: See TracChangeset
for help on using the changeset viewer.