const char *UI_GetBotNameByNumber( int num ) { char *info = UI_GetBotInfoByNumber( num ); if ( info ) { return Info_ValueForKey( info, "name" ); } return "Sarge"; }
/* ================= UI_AddBotsMenu_GetSortedBotNums ================= */ static int QDECL UI_AddBotsMenu_SortCompare( const void *arg1, const void *arg2 ) { int num1, num2; const char *info1, *info2; const char *name1, *name2; num1 = *(int *)arg1; num2 = *(int *)arg2; info1 = UI_GetBotInfoByNumber( num1 ); info2 = UI_GetBotInfoByNumber( num2 ); name1 = Info_ValueForKey( info1, "name" ); name2 = Info_ValueForKey( info2, "name" ); return Q_stricmp( name1, name2 ); }
char *UI_GetBotNameByNumber( int num ) { char * info = UI_GetBotInfoByNumber( num ); if( info ) return Info_ValueForKey( info, "name" ); return ""; }
/* ================= UI_AddBotsMenu_SetBotNames ================= */ static void UI_AddBotsMenu_SetBotNames( void ) { int n; const char *info; for ( n = 0; n < 7; n++ ) { info = UI_GetBotInfoByNumber( addBotsMenuInfo.sortedBotNums[addBotsMenuInfo.baseBotNum + n] ); Q_strncpyz( addBotsMenuInfo.botnames[n], Info_ValueForKey( info, "name" ), sizeof(addBotsMenuInfo.botnames[n]) ); } }
/* ================= UI_SPLevelMenu_SetBots ================= */ static void UI_SPLevelMenu_SetBots( void ) { char *p; char *bot; char *botInfo; char bots[MAX_INFO_STRING]; levelMenuInfo.numBots = 0; if ( selectedArenaSet > currentSet ) { return; } Q_strncpyz( bots, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "bots" ), sizeof(bots) ); p = &bots[0]; while( *p && levelMenuInfo.numBots < 7 ) { //skip spaces while( *p && *p == ' ' ) { p++; } if( !p ) { break; } // mark start of bot name bot = p; // skip until space of null while( *p && *p != ' ' ) { p++; } if( *p ) { *p++ = 0; } 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 ); } else { levelMenuInfo.botPics[levelMenuInfo.numBots] = 0; Q_strncpyz( levelMenuInfo.botNames[levelMenuInfo.numBots], bot, 10 ); } Q_CleanStr( levelMenuInfo.botNames[levelMenuInfo.numBots] ); levelMenuInfo.numBots++; } }
const char *UI_GetBotNameByNumber( int num ) { const char *info = UI_GetBotInfoByNumber( num ); return info ? Info_ValueForKey( info, "name" ) : "Kyle"; }