[Orxonox-commit 3349] r8037 - code/branches/usability/src/orxonox
dafrick at orxonox.net
dafrick at orxonox.net
Sun Mar 6 23:26:12 CET 2011
Author: dafrick
Date: 2011-03-06 23:26:12 +0100 (Sun, 06 Mar 2011)
New Revision: 8037
Modified:
code/branches/usability/src/orxonox/LevelInfo.h
code/branches/usability/src/orxonox/LevelManager.h
Log:
Making LevelInfoCompare a strictly weak ordering (compared to just a weak ordering, which is not a good idea for sets), which leads to no more warnings because of levels that have the same name. Which is ok, imo, als long as the LevelManager can distinguish them, which it can as long as they don't have the sime filenames as well.
Modified: code/branches/usability/src/orxonox/LevelInfo.h
===================================================================
--- code/branches/usability/src/orxonox/LevelInfo.h 2011-03-06 18:12:11 UTC (rev 8036)
+++ code/branches/usability/src/orxonox/LevelInfo.h 2011-03-06 22:26:12 UTC (rev 8037)
@@ -108,7 +108,7 @@
@brief Get the XML-filename of the Level.
@return Returns the XML-filename (including *.oxw extension) of the Level.
*/
- inline const std::string& getXMLFilename(void) { return this->xmlfilename_; } // tolua_export
+ inline const std::string& getXMLFilename(void) const { return this->xmlfilename_; } // tolua_export
protected:
/**
@@ -211,7 +211,11 @@
struct LevelInfoCompare
{
bool operator() (const LevelInfoItem* lhs, const LevelInfoItem* rhs) const
- { return getLowercase(lhs->getName()).compare(getLowercase(rhs->getName())) < 0; }
+ {
+ if(getLowercase(lhs->getName()).compare(getLowercase(rhs->getName())) == 0)
+ return getLowercase(lhs->getXMLFilename()).compare(getLowercase(rhs->getXMLFilename())) < 0;
+ return getLowercase(lhs->getName()).compare(getLowercase(rhs->getName())) < 0;
+ }
};
} // tolua_export
Modified: code/branches/usability/src/orxonox/LevelManager.h
===================================================================
--- code/branches/usability/src/orxonox/LevelManager.h 2011-03-06 18:12:11 UTC (rev 8036)
+++ code/branches/usability/src/orxonox/LevelManager.h 2011-03-06 22:26:12 UTC (rev 8037)
@@ -111,7 +111,7 @@
// Helpers to allow fast access to the availableLevels list.
unsigned int nextIndex_; //! The next expected index to be accessed.
- std::set<LevelInfoItem*, LevelInfoCompare>::iterator nextLevel_; //! The nex expected Level to be accessed.
+ std::set<LevelInfoItem*, LevelInfoCompare>::iterator nextLevel_; //! The next expected Level to be accessed.
// config values
std::string defaultLevelName_;
More information about the Orxonox-commit
mailing list