Esempio n. 1
0
void Player::UpdateInrangeSetsBasedOnReputation()
{
	// This function assumes that the opp faction set for player = the opp faction set for the unit.
	InRangeSet::iterator itr;
	Unit * pUnit;
	bool rep_value;
	bool enemy_current;

	AquireInrangeLock();
	for( itr = GetInRangeSetBegin(); itr != GetInRangeSetEnd(); itr++ )
	{
		if( (*itr)->GetTypeId() != TYPEID_UNIT )
			continue;

		pUnit = static_cast< Unit* >( *itr );
		if(pUnit->m_factionDBC == NULL || pUnit->m_factionDBC->RepListId < 0)
			continue;

		rep_value = IsHostileBasedOnReputation( pUnit->m_factionDBC );
		enemy_current = IsInRangeOppFactSet( pUnit );

		if( rep_value && !enemy_current ) // We are now enemies.
			m_oppFactsInRange.insert( pUnit );
		else if( !rep_value && enemy_current )
			m_oppFactsInRange.erase( pUnit );
	}
	ReleaseInrangeLock();
}
Esempio n. 2
0
void Unit::RemoveInRangeUnit(InRangeSet::iterator itr)
{
	AquireInrangeLock();
	m_inRangeUnits.erase(itr);
	ReleaseInrangeLock();
}