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; }
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 ); }
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 ); } }
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 ); }
/** * 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); }
/* =============== 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 ); }
void FreeNodeList( AINodeList_t *node ) { int i; for ( i = 0; i < node->numNodes; i++ ) { FreeNode( node->list[ i ] ); } BG_Free( node ); }
// 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 ); } }
void FreeBehaviorTree( AIBehaviorTree_t *tree ) { if ( tree ) { FreeNode(tree->root); BG_Free( tree ); } else { Log::Warn( "Attempted to free NULL behavior tree" ); } }
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 ); }
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; }
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++; }
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 ); }
void FreeDecoratorNode( AIDecoratorNode_t *decorator ) { BG_Free( decorator->params ); FreeNode( decorator->child ); BG_Free( decorator ); }
// freeing behavior tree nodes void FreeConditionNode( AIConditionNode_t *node ) { FreeNode( node->child ); FreeExpression( node->exp ); BG_Free( node ); }
void G_FreePlayerModel(void) { int i; for ( i = 0; i < level.playerModelCount; i++ ) BG_Free( level.playerModel[i] ); }