Пример #1
0
bool G_BotClearNames()
{
	int i;

	for ( i = 0; i < botNames[TEAM_ALIENS].count; ++i )
	{
		if ( botNames[TEAM_ALIENS].name[i].inUse )
		{
			return false;
		}
	}

	for ( i = 0; i < botNames[TEAM_HUMANS].count; ++i )
	{
		if ( botNames[TEAM_HUMANS].name[i].inUse )
		{
			return false;
		}
	}

	for ( i = 0; i < botNames[TEAM_ALIENS].count; ++i )
	{
		BG_Free( botNames[TEAM_ALIENS].name[i].name );
	}

	for ( i = 0; i < botNames[TEAM_HUMANS].count; ++i )
	{
		BG_Free( botNames[TEAM_HUMANS].name[i].name );
	}

	botNames[TEAM_ALIENS].count = 0;
	botNames[TEAM_HUMANS].count = 0;

	return true;
}
Пример #2
0
void FreeActionNode( AIActionNode_t *action )
{
	int i;
	for ( i = 0; i < action->nparams; i++ )
	{
		AIDestroyValue( action->params[ i ] );
	}

	BG_Free( action->params );
	BG_Free( action );
}
Пример #3
0
void FreeTokenList( pc_token_list *list )
{
	pc_token_list *current = list;
	while( current )
	{
		pc_token_list *node = current;
		current = current->next;

		BG_Free( node->token.string );
		BG_Free( node );
	}
}
Пример #4
0
void FreeValueFunc( AIValueFunc_t *v )
{
	int i;
	if ( !v )
	{
		return;
	}

	for ( i = 0; i < v->nparams; i++ )
	{
		AIDestroyValue( v->params[ i ] );
	}

	BG_Free( v->params );
	BG_Free( v );
}
Пример #5
0
/**
 * Delete a specific bot
 * @param clientNum [int] bot client id
 */
void G_BotDel( int clientNum ) {
	gentity_t *ent;

	if(clientNum < 0) return;

	ent = &g_entities[clientNum];
	if( !( ent->r.svFlags & SVF_BOT ) ) {
		trap_Print( va("'^7%s^7' is not a bot\n", ent->client->pers.netname) );
		return;
	}
    G_BotDebug(ent, BOT_VERB_IMPORTANT, BOT_DEBUG_GENERAL, "Bot deleted\n");
	ent->inuse = qfalse;
	ent->r.svFlags = 0;
	//BG_Free(ent->bot->path.crumb); 
	if(ent->bot) {
		BG_Free(ent->bot);
	}
    //LEPE:
    if(ent->client->pers.teamSelection == TEAM_HUMANS && level.humanBots > 0) {
        level.humanBots--;
    } else if(ent->client->pers.teamSelection == TEAM_ALIENS && level.alienBots > 0) {
        level.alienBots--;
    }
	ClientDisconnect(clientNum);
}
Пример #6
0
/*
===============
G_FreeNode

Free up memory used by a node
===============
*/
void G_FreeNode( node_t *node )
{
	if ( node->type == NT_CONDITION )
	{
		G_FreeNode( node->u.condition.target );
	}

	BG_Free( node );
}
Пример #7
0
void FreeNodeList( AINodeList_t *node )
{
	int i;
	for ( i = 0; i < node->numNodes; i++ )
	{
		FreeNode( node->list[ i ] );
	}
	BG_Free( node );
}
Пример #8
0
// functions for freeing the memory of condition expressions
void FreeValue( AIValue_t *v )
{
	if ( !v )
	{
		return;
	}
	AIDestroyValue( *v );
	BG_Free( v );
}
void G_namelog_cleanup( void )
{
  namelog_t *namelog, *n;

  for( namelog = level.namelogs; namelog; namelog = n )
  {
    n = namelog->next;
    BG_Free( namelog );
  }
}
Пример #10
0
void FreeBehaviorTree( AIBehaviorTree_t *tree )
{
	if ( tree )
	{
		FreeNode(tree->root);

		BG_Free( tree );
	}
	else
	{
		Log::Warn( "Attempted to free NULL behavior tree" );
	}
}
Пример #11
0
static void CG_Rocket_DFResolution( int handle, const char *data )
{
	int w = atoi( Info_ValueForKey(data, "1" ) );
	int h = atoi( Info_ValueForKey(data, "2" ) );

	if ( w == -1 || h == -1 )
	{
		Rocket_DataFormatterFormattedData( handle, "Custom", false );
		return;
	}
	char *aspectRatio = BG_strdup( DisplayAspectString( w, h ) );
	Rocket_DataFormatterFormattedData( handle, va( "%dx%d ( %s )", w, h, aspectRatio ), false );
	BG_Free( aspectRatio );
}
Пример #12
0
void FreeTreeList( AITreeList_t *list )
{
	int i;
	for ( i = 0; i < list->numTrees; i++ )
	{
		AIBehaviorTree_t *tree = list->trees[ i ];
		FreeBehaviorTree( tree );
	}

	BG_Free( list->trees );
	list->trees = nullptr;
	list->maxTrees = 0;
	list->numTrees = 0;
}
Пример #13
0
void AddTreeToList( AITreeList_t *list, AIBehaviorTree_t *tree )
{
	if ( list->maxTrees == list->numTrees )
	{
		AIBehaviorTree_t **trees = ( AIBehaviorTree_t ** ) BG_Alloc( sizeof( AIBehaviorTree_t * ) * list->maxTrees );
		list->maxTrees *= 2;
		memcpy( trees, list->trees, sizeof( AIBehaviorTree_t * ) * list->numTrees );
		BG_Free( list->trees );
		list->trees = trees;
	}

	list->trees[ list->numTrees ] = tree;
	list->numTrees++;
}
Пример #14
0
void FreeOp( AIOp_t *op )
{
	if ( !op )
	{
		return;
	}

	if ( isBinaryOp( op->opType ) )
	{
		AIBinaryOp_t *b = ( AIBinaryOp_t * ) op;
		FreeExpression( b->exp1 );
		FreeExpression( b->exp2 );
	}
	else if ( isUnaryOp( op->opType ) )
	{
		AIUnaryOp_t *u = ( AIUnaryOp_t * ) op;
		FreeExpression( u->exp );
	}

	BG_Free( op );
}
Пример #15
0
void FreeDecoratorNode( AIDecoratorNode_t *decorator )
{
	BG_Free( decorator->params );
	FreeNode( decorator->child );
	BG_Free( decorator );
}
Пример #16
0
// freeing behavior tree nodes
void FreeConditionNode( AIConditionNode_t *node )
{
	FreeNode( node->child );
	FreeExpression( node->exp );
	BG_Free( node );
}
Пример #17
0
void G_FreePlayerModel(void)
{
    int i;
    for ( i = 0; i < level.playerModelCount; i++ )
        BG_Free( level.playerModel[i] );
}