From: rambetter Date: Thu, 20 Jan 2011 07:15:47 +0000 (+0000) Subject: In function AddGamePath() in path_init.c for q3map2, X-Git-Tag: xonotic-v0.5.0~60 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1f2be9e1a6e6cb52b642918cc02782d77080e7f4;p=xonotic%2Fnetradiant.git In function AddGamePath() in path_init.c for q3map2, only adding path if it's not already added (remove duplicates). It's cleaner this way. git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk@432 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- diff --git a/tools/quake3/q3map2/path_init.c b/tools/quake3/q3map2/path_init.c index e6b4d959..83383e22 100644 --- a/tools/quake3/q3map2/path_init.c +++ b/tools/quake3/q3map2/path_init.c @@ -305,6 +305,8 @@ adds a game path to the list void AddGamePath( char *path ) { + int i; + /* dummy check */ if( path == NULL || path[ 0 ] == '\0' || numGamePaths >= MAX_GAME_PATHS ) return; @@ -314,6 +316,19 @@ void AddGamePath( char *path ) strcpy( gamePaths[ numGamePaths ], path ); CleanPath( gamePaths[ numGamePaths ] ); numGamePaths++; + + /* don't add it if it's already there */ + for (i = 0; i < numGamePaths - 1; i++) + { + if (strcmp(gamePaths[i], gamePaths[numGamePaths - 1]) == 0) + { + free(gamePaths[numGamePaths - 1]); + gamePaths[numGamePaths - 1] = NULL; + numGamePaths--; + break; + } + } + }