]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
always sort game descriptions by displayed name
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 29 Apr 2009 16:35:28 +0000 (16:35 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 29 Apr 2009 16:35:28 +0000 (16:35 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@357 61c419a2-8eb2-4b30-bcec-8cead039b335

radiant/preferences.cpp

index 5302c375fc9c79fac9714956a660848cc6d872ab..a691d812770cdd93c22fc26b8c7d2983a1b77f27 100644 (file)
@@ -461,7 +461,21 @@ void CGameDialog::Init()
   ScanForGames();
   if (mGames.empty())
   {
-    Error("Didn't find any valid game file descriptions, aborting\n");
+         Error("Didn't find any valid game file descriptions, aborting\n");
+  }
+  else
+  {
+         std::list<CGameDescription *>::iterator iGame, iPrevGame;
+         for(iGame=mGames.begin(), iPrevGame = mGames.end(); iGame!=mGames.end(); iPrevGame = iGame, ++iGame)
+         {
+                 if(iPrevGame != mGames.end())
+                         if(strcmp((*iGame)->getRequiredKeyValue("name"), (*iPrevGame)->getRequiredKeyValue("name")) < 0)
+                         {
+                                 CGameDescription *h = *iGame;
+                                 *iGame = *iPrevGame;
+                                 *iPrevGame = h;
+                         }
+         }
   }
  
   CGameDescription* currentGameDescription = 0;