mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-16 17:11:33 +00:00
1st try around sorting the lumps by name
This commit is contained in:
parent
8647281a51
commit
6c628db56a
1 changed files with 10 additions and 0 deletions
|
@ -699,6 +699,13 @@ static void initdirpath(char *dirpath, size_t *dirpathindex, int depthleft)
|
||||||
dirpathindex[depthleft]--;
|
dirpathindex[depthleft]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sortdir by name?
|
||||||
|
static int lumpnamecompare( const void *A, const void *B )
|
||||||
|
{
|
||||||
|
return strcmp( (((lumpinfo_t *)A)->fullname), (((lumpinfo_t *)B)->fullname));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders)
|
lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders)
|
||||||
{
|
{
|
||||||
DIR **dirhandle;
|
DIR **dirhandle;
|
||||||
|
@ -889,6 +896,9 @@ lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders)
|
||||||
free(dirpathindex);
|
free(dirpathindex);
|
||||||
free(dirhandle);
|
free(dirhandle);
|
||||||
|
|
||||||
|
//sort files and directories
|
||||||
|
qsort ( lumpinfo, numlumps, sizeof( lumpinfo_t ), lumpnamecompare );
|
||||||
|
|
||||||
(*nlmp) = numlumps;
|
(*nlmp) = numlumps;
|
||||||
return lumpinfo;
|
return lumpinfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue