//======================================================================== // // Parameter: - // Returns: - // Changes Globals: - //======================================================================== void BotFreeWeaponState( int handle ) { if ( handle <= 0 || handle > MAX_CLIENTS ) { botimport.Print( PRT_FATAL, "move state handle %d out of range\n", handle ); return; } //end if if ( !botweaponstates[handle] ) { botimport.Print( PRT_FATAL, "invalid move state %d\n", handle ); return; } //end if BotFreeWeaponWeights( handle ); FreeMemory( botweaponstates[handle] ); botweaponstates[handle] = NULL; } //end of the function BotFreeWeaponState
int BotLoadWeaponWeights(int weaponstate, char *filename) { bot_weaponstate_t *ws; ws = BotWeaponStateFromHandle(weaponstate); if (!ws) return BLERR_CANNOTLOADWEAPONWEIGHTS; BotFreeWeaponWeights(weaponstate); // ws->weaponweightconfig = ReadWeightConfig(filename); if (!ws->weaponweightconfig) { botimport.Print(PRT_FATAL, "couldn't load weapon config %s\n", filename); return BLERR_CANNOTLOADWEAPONWEIGHTS; } if (!weaponconfig) return BLERR_CANNOTLOADWEAPONCONFIG; ws->weaponweightindex = WeaponWeightIndex(ws->weaponweightconfig, weaponconfig); return BLERR_NOERROR; }
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== int BotLoadWeaponWeights( int weaponstate, char *filename ) { bot_weaponstate_t *ws; ws = BotWeaponStateFromHandle( weaponstate ); if ( !ws ) { return BLERR_CANNOTLOADWEAPONWEIGHTS; } BotFreeWeaponWeights( weaponstate ); // PS_SetBaseFolder( "botfiles" ); ws->weaponweightconfig = ReadWeightConfig( filename ); PS_SetBaseFolder( "" ); if ( !ws->weaponweightconfig ) { botimport.Print( PRT_FATAL, "couldn't load weapon config %s\n", filename ); return BLERR_CANNOTLOADWEAPONWEIGHTS; } //end if if ( !weaponconfig ) { return BLERR_CANNOTLOADWEAPONCONFIG; } ws->weaponweightindex = WeaponWeightIndex( ws->weaponweightconfig, weaponconfig ); return BLERR_NOERROR; } //end of the function BotLoadWeaponWeights