Пример #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;
	for(itr = m_objectsInRange.begin(); itr != m_objectsInRange.end(); itr++)
	{
		if(!(*itr)->IsUnit())
			continue;

		pUnit = TO< 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);
	}
}
Пример #2
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();
}