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