//----------------------------------------------------------------------------- // Purpose: Forces a recompare //----------------------------------------------------------------------------- void CSensorTFTeam::Think( ) { if (!m_pTeam) return; // Check for a difference in the number of respawn stations int nRespawnCount = ComputeRespawnCount(); if ( nRespawnCount != m_nRespawnCount ) { m_OnRespawnCountChangedDelta.Set( nRespawnCount - m_nRespawnCount, this, this ); m_nRespawnCount = nRespawnCount; m_OnRespawnCountChanged.Set( m_nRespawnCount, this, this ); } // Check for a difference in the number of resources harvested if ( m_nResourceCount != m_pTeam->m_flTotalResourcesSoFar ) { m_OnResourceCountChangedDelta.Set( m_pTeam->m_flTotalResourcesSoFar - m_nResourceCount, this, this ); m_nResourceCount = m_pTeam->m_flTotalResourcesSoFar; m_OnResourceCountChanged.Set( m_nResourceCount, this, this ); } // Check for a difference in the number of team members if ( m_nMemberCount != m_pTeam->GetNumPlayers() ) { m_OnMemberCountChangedDelta.Set( m_pTeam->GetNumPlayers() - m_nMemberCount, this, this ); m_nMemberCount = m_pTeam->GetNumPlayers(); m_OnMemberCountChanged.Set( m_nMemberCount, this, this ); } SetNextThink( gpGlobals->curtime + 0.1f ); }
bool COrderHeal::CreateOrder( CPlayerClass *pClass ) { CTFTeam *pTeam = pClass->GetTeam(); CSortBase info; info.m_pPlayer = pClass->GetPlayer(); int sorted[MAX_PLAYERS]; int nSorted = BuildSortedActiveList( sorted, MAX_PLAYERS, SortFn_Heal, IsValidFn_Heal, &info, pTeam->GetNumPlayers() ); if ( nSorted ) { COrderHeal *pOrder = new COrderHeal; pClass->GetTeam()->AddOrder( ORDER_HEAL, pTeam->GetPlayer( sorted[0] ), pClass->GetPlayer(), 1e24, 60, pOrder ); return true; } else { return false; } }