mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
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: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@432 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
89f0eeeb28
commit
083f7c7d6a
1 changed files with 15 additions and 0 deletions
|
@ -303,6 +303,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;
|
||||
|
@ -312,6 +314,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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue