//========================================================= // Killed //========================================================= void CSquadMonster :: Killed( entvars_t *pevAttacker, int iGib ) { VacateSlot(); if ( InSquad() ) { MySquadLeader()->SquadRemove( this ); } CBaseMonster :: Killed ( pevAttacker, iGib ); }
//========================================================= // Killed //========================================================= void CSquadMonster::Killed( const CTakeDamageInfo& info, GibAction gibAction ) { VacateSlot(); if ( InSquad() ) { MySquadLeader()->SquadRemove( this ); } CBaseMonster::Killed( info, gibAction ); }
void CAI_Squad::VacateStrategySlot( CBaseEntity *pEnemy, int slot) { // If I wasn't taking up a squad slot I'm done if (slot == SQUAD_SLOT_NONE) return; // As a debug measure check to see if slot was filled if (!IsSlotOccupied(pEnemy, slot)) { DevMsg( "ERROR! Vacating an empty slot!\n"); } // Free the slot VacateSlot(pEnemy, slot); }
//----------------------------------------------------------------------------- // Purpose: Try to get one of a contiguous range of slots // Input : slotIDStart - start of slot range // slotIDEnd - end of slot range // hEnemy - enemy this slot is for // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CAI_Squad::OccupyStrategySlotRange( CBaseEntity *pEnemy, int slotIDStart, int slotIDEnd, int *pSlot ) { #ifndef PER_ENEMY_SQUADSLOTS // FIXME: combat slots need to be per enemy, not per squad. // As it is, once a squad is occupied it stops making even simple attacks to other things nearby. // This code may make soldiers too aggressive if (GetLeader() && pEnemy != GetLeader()->GetEnemy()) { *pSlot = SQUAD_SLOT_NONE; return true; } #endif // If I'm already occupying this slot if ( *pSlot >= slotIDStart && *pSlot <= slotIDEnd) return true; for ( int i = slotIDStart; i <= slotIDEnd; i++ ) { // Check enemy to see if slot already occupied if (!IsSlotOccupied(pEnemy, i)) { // Clear any previous spot; if (*pSlot != SQUAD_SLOT_NONE) { // As a debug measure check to see if slot was filled if (!IsSlotOccupied(pEnemy, *pSlot)) { DevMsg( "ERROR! Vacating an empty slot!\n"); } // Free the slot VacateSlot(pEnemy, *pSlot); } // Fill the slot OccupySlot(pEnemy, i); *pSlot = i; return true; } } return false; }
//========================================================= // ScheduleChange //========================================================= void CSquadMonster :: ScheduleChange ( void ) { VacateSlot(); }