Fix map list in Team Arena start server menu after entering SP menu

In September 2017 I moved loading arenas.txt/*.arena files from entering
start server menu to at startup to fix running out of memory in Team Arena
UI after opening the start server menu several times.

However, Team Arena completely replaces the uiInfo.mapList array when
switching between single player and start server menus. So after my
change, entering single player and then entering start server would only
display single player maps. It caused SP endofgame menu to use MP map
list for replay/next map since arenas were loaded after gameinfo.txt.

Continue loading arena info at start up to avoid reallocating arena info
but move setting up uiInfo.mapList to when entering the start server
menu.
This commit is contained in:
Zack Middleton 2018-04-12 00:38:25 -05:00
parent dfb49e78b5
commit 3377f9981a
3 changed files with 15 additions and 3 deletions

View file

@ -138,12 +138,10 @@ void UI_LoadArenas( void ) {
char filename[128];
char dirlist[1024];
char* dirptr;
int i, n;
int i;
int dirlen;
char *type;
ui_numArenas = 0;
uiInfo.mapCount = 0;
trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM );
if( *arenasFile.string ) {
@ -166,6 +164,18 @@ void UI_LoadArenas( void ) {
if (UI_OutOfMemory()) {
trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all arenas\n");
}
}
/*
===============
UI_LoadArenasIntoMapList
===============
*/
void UI_LoadArenasIntoMapList( void ) {
int n;
char *type;
uiInfo.mapCount = 0;
for( n = 0; n < ui_numArenas; n++ ) {
// determine type

View file

@ -359,6 +359,7 @@ int UI_AdjustTimeByGame(int time);
void UI_ShowPostGame(qboolean newHigh);
void UI_ClearScores( void );
void UI_LoadArenas(void);
void UI_LoadArenasIntoMapList(void);
//
// ui_menu.c

View file

@ -3268,6 +3268,7 @@ static void UI_RunMenuScript(char **args) {
trap_Cvar_Set("ui_cdkeyvalid", "CD Key does not appear to be valid.");
}
} else if (Q_stricmp(name, "loadArenas") == 0) {
UI_LoadArenasIntoMapList();
UI_MapCountByGameType(qfalse);
Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "createserver");
} else if (Q_stricmp(name, "saveControls") == 0) {