From 7e8ddab97749d930eb1d3682be61a331955a48d9 Mon Sep 17 00:00:00 2001 From: thilo Date: Tue, 6 Oct 2009 14:17:12 +0000 Subject: Fix bot loading in case player supplied invalid bot names git-svn-id: svn://svn.icculus.org/quake3/trunk@1645 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/q3_ui/ui_splevel.c | 7 ++++++- code/q3_ui/ui_startserver.c | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/q3_ui/ui_splevel.c b/code/q3_ui/ui_splevel.c index 27f7924..016d996 100644 --- a/code/q3_ui/ui_splevel.c +++ b/code/q3_ui/ui_splevel.c @@ -198,7 +198,12 @@ static void UI_SPLevelMenu_SetBots( void ) { *p++ = 0; } - botInfo = UI_GetBotInfoByName( bot ); + botInfo = UI_GetBotInfoByName( bot ); + if(!botInfo) + { + botInfo = UI_GetBotInfoByNumber( levelMenuInfo.numBots ); + } + if( botInfo ) { levelMenuInfo.botPics[levelMenuInfo.numBots] = PlayerIconHandle( Info_ValueForKey( botInfo, "model" ) ); Q_strncpyz( levelMenuInfo.botNames[levelMenuInfo.numBots], Info_ValueForKey( botInfo, "name" ), 10 ); diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index ddb2533..2c56a10 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -1092,7 +1092,11 @@ static void ServerOptions_InitBotNames( void ) { *p++ = 0; } - botInfo = UI_GetBotInfoByName( bot ); + botInfo = UI_GetBotInfoByName( bot ); + if( !botInfo ) + { + botInfo = UI_GetBotInfoByNumber( count ); + } bot = Info_ValueForKey( botInfo, "name" ); Q_strncpyz( s_serveroptions.playerNameBuffers[count], bot, sizeof(s_serveroptions.playerNameBuffers[count]) ); -- cgit v1.2.3