Ejemplo n.º 1
0
int BotLoadItemWeights( int goalstate, const char* filename ) {
	bot_goalstate_t* gs = BotGoalStateFromHandle( goalstate );
	if ( !gs ) {
		return GGameType & GAME_Quake3 ? Q3BLERR_CANNOTLOADITEMWEIGHTS : WOLFBLERR_CANNOTLOADITEMWEIGHTS;
	}
	//load the weight configuration
	if ( GGameType & GAME_ET ) {
		PS_SetBaseFolder( BOTFILESBASEFOLDER );
	}
	gs->itemweightconfig = ReadWeightConfig( filename );
	if ( GGameType & GAME_ET ) {
		PS_SetBaseFolder( "" );
	}
	if ( !gs->itemweightconfig ) {
		BotImport_Print( PRT_FATAL, "couldn't load weights\n" );
		return GGameType & GAME_Quake3 ? Q3BLERR_CANNOTLOADITEMWEIGHTS : WOLFBLERR_CANNOTLOADITEMWEIGHTS;
	}
	//if there's no item configuration
	if ( !itemconfig ) {
		return GGameType & GAME_Quake3 ? Q3BLERR_CANNOTLOADITEMWEIGHTS : WOLFBLERR_CANNOTLOADITEMWEIGHTS;
	}
	//create the item weight index
	gs->itemweightindex = ItemWeightIndex( gs->itemweightconfig, itemconfig );
	//everything went ok
	return BLERR_NOERROR;
}
Ejemplo n.º 2
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int BotLoadItemWeights( int goalstate, char *filename ) {
	bot_goalstate_t *gs;

	gs = BotGoalStateFromHandle( goalstate );
	if ( !gs ) {
		return BLERR_CANNOTLOADITEMWEIGHTS;
	}
	//load the weight configuration
	gs->itemweightconfig = ReadWeightConfig( filename );
	if ( !gs->itemweightconfig ) {
		botimport.Print( PRT_FATAL, "couldn't load weights\n" );
		return BLERR_CANNOTLOADITEMWEIGHTS;
	} //end if
	  //if there's no item configuration
	if ( !itemconfig ) {
		return BLERR_CANNOTLOADITEMWEIGHTS;
	}
	//create the item weight index
	gs->itemweightindex = ItemWeightIndex( gs->itemweightconfig, itemconfig );
	//everything went ok
	return BLERR_NOERROR;
} //end of the function BotLoadItemWeights