Bug 541: Version-sort the level filenames.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sat, 30 Jan 2010 10:48:19 +0000 (10:48 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sat, 30 Jan 2010 10:48:19 +0000 (10:48 +0000)
Resolves #541. Thanks to Matt McCutchen for this patch.

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6291 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/supertux/world.cpp

index 399816c..f136098 100644 (file)
@@ -14,6 +14,8 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include <algorithm>
+
 #include "lisp/parser.hpp"
 #include "lisp/writer.hpp"
 #include "physfs/ifile_stream.hpp"
@@ -98,7 +100,6 @@ World::load(const std::string& filename)
   info->get("title", title);
   info->get("description", description);
   info->get("levelset", is_levelset);
-  info->get("levels", levels);
   info->get("hide-from-contribs", hide_from_contribs);
 
   // Level info file doesn't define any levels, so read the
@@ -117,6 +118,8 @@ World::load(const std::string& filename)
     }
   }
   PHYSFS_freeList(files);
+
+  std::sort(levels.begin(), levels.end(), StringUtil::numeric_less);
 }
 
 void