Bug 3325 - Auto load of bots in skirmish fails if unknown bot name
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: unspecified
Hardware: All All
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2007-08-23 05:24 EDT by beast
Modified: 2009-10-06 10:17:55 EDT
1 user (show)

See Also:


Attachments
Diff file with a proposed fix (1.19 KB, patch)
2007-08-27 14:17 EDT, beast

Description beast 2007-08-23 05:24:24 EDT
If you are starting a skirmish and select a map that has bots names that are not known to the system, no bots are selected. The number of bots that should be in the skirmish (based upon the map) is shown, but no bots are in the list. This forces the user to manually select a bot for each slot. 

This is in the function ServerOptions_InitBotNames in q3_ui/ui_startserver.c. At (or around) line 1095, there is a call to UI_GetBotInfoByName. My recommendation is that if the call fails to return a valid bot, make a call to GetBotInfoByNumber, this will remap the unknown bot names to the names that are currently known by the system (if any). I added a Com_Printf to print a message so that the console shows that the remapping occurred. 

I guess this could be considered an enhancement instead of a defect, but I wasn't sure. Anyway, the code...

q3_ui/ui_startserver.c lines 1095-1096

botInfo = UI_GetBotInfoByName( bot );
bot = Info_ValueForKey( botInfo, "name" );

Proposed change (lines 1095-1099):

botInfo = UI_GetBotInfoByName( bot );
if( !botInfo ) {
  Com_Printf("Remapping Unknown Bot. Name: %s...\n", bot );
  botInfo = UI_GetBotInfoByNumber( count );
}
Comment 1 beast 2007-08-23 05:28:07 EDT
Sorry. Forgot to include the last line in the proposed change (line that changes would be placed in front of)...

botInfo = UI_GetBotInfoByName( bot );
if( !botInfo ) {
  Com_Printf("Remapping Unknown Bot. Name: %s...\n", bot );
  botInfo = UI_GetBotInfoByNumber( count );
}
bot = Info_ValueForKey( botInfo, "name" );

Comment 2 Tim Angus 2007-08-23 07:51:04 EDT
Definitely an enhancement.
Comment 3 beast 2007-08-27 14:17:10 EDT
Created attachment 1490 [details]
Diff file with a proposed fix

The previous info fixed the problem for a regular server start and not the skirmish. This attachment fixes the problem for bot instances. Hopefully I have done the diff from the right directory this time instead of causing extra work for you guys... :-)
Comment 4 Thilo Schulz 2009-10-06 10:17:55 EDT
applied your patch in rev. 1645. If this breaks anything, Borat will make you run around in his swimsuit for the rest of this year.