Merge pull request #592 from earth-metal/master

Start Server Menu: reload "maps.lst" after "game" dir is changed
This commit is contained in:
Yamagi 2020-08-23 20:33:19 +02:00 committed by GitHub
commit 2bb6fdf4a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -2836,8 +2836,8 @@ M_Menu_JoinServer_f(void)
*/ */
static menuframework_s s_startserver_menu; static menuframework_s s_startserver_menu;
static char **mapnames = NULL; char **mapnames = NULL;
static int nummaps = 0; static int nummaps;
static menuaction_s s_startserver_start_action; static menuaction_s s_startserver_start_action;
static menuaction_s s_startserver_dmoptions_action; static menuaction_s s_startserver_dmoptions_action;
@ -2997,11 +2997,14 @@ StartServer_MenuInit(void)
char *s; char *s;
float scale = SCR_GetMenuScale(); float scale = SCR_GetMenuScale();
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */ /* initialize list of maps once, reuse it afterwards (=> it isn't freed unless the game dir is changed) */
if (mapnames == NULL) if (mapnames == NULL)
{ {
int i, length; int i, length;
nummaps = 0;
s_startmap_list.curvalue = 0;
/* load the list of map names */ /* load the list of map names */
if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1) if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1)
{ {

View file

@ -1672,6 +1672,10 @@ FS_BuildGameSpecificSearchPath(char *dir)
// list of music tracks needs to be loaded again (=> tracks // list of music tracks needs to be loaded again (=> tracks
// are possibly from the new mod dir) // are possibly from the new mod dir)
OGG_InitTrackList(); OGG_InitTrackList();
// ...and the current list of maps in the "start network server" menu is
// cleared so that it will be re-initialized when the menu is accessed
mapnames = NULL;
#endif #endif
} }

View file

@ -754,6 +754,7 @@ extern char cfgdir[MAX_OSPATH];
/* Hack for working 'game' cmd */ /* Hack for working 'game' cmd */
extern char userGivenGame[MAX_QPATH]; extern char userGivenGame[MAX_QPATH];
extern char **mapnames;
extern FILE *log_stats_file; extern FILE *log_stats_file;