Ejemplo n.º 1
0
void BubbleManager::Remove(SystemEntity *ent, bool notify) {
	SystemBubble *b = ent->Bubble();
	if(b == NULL) {
		//not in any bubble.
		_log(DESTINY__BUBBLE_TRACE, "Entity %u is not located in any bubble. Nothing to remove.", ent->GetID());
		return;
	}
	b->Remove(ent, notify);
}
Ejemplo n.º 2
0
void BubbleManager::UpdateBubble(SystemEntity *ent, bool notify) {
	SystemBubble *b = ent->Bubble();
	if(b != NULL) {
		if(b->InBubble(ent->GetPosition())) {
			_log(DESTINY__BUBBLE_TRACE, "Entity %u is still located in bubble %p", ent->GetID(), b);
			//still in bubble...
			return;
		}
		_log(DESTINY__BUBBLE_TRACE, "Entity %u is no longer located in bubble %p", ent->GetID(), b);
		b->Remove(ent, notify);
	}
	Add(ent, notify);
}
Ejemplo n.º 3
0
//NOTE: this should probably eventually be optimized to use a
//spacial partitioning scheme to speed up this search.
SystemBubble * BubbleManager::_FindBubble(const GPoint &pos) const {
	std::vector<SystemBubble *>::const_iterator cur, end;
	cur = m_bubbles.begin();
	end = m_bubbles.end();
	for(; cur != end; ++cur) {
		SystemBubble *b = *cur;
		if(b->InBubble(pos)) {
			return(b);
		}
	}
	//not in any existing bubble.
	return NULL;
}
Ejemplo n.º 4
0
//NOTE: this should probably eventually be optimized to use a
//spacial partitioning scheme to speed up this search.
SystemBubble * BubbleManager::FindBubble(SystemEntity *ent) const {
	GPoint pos = ent->GetPosition();
    std::vector<SystemBubble *>::const_iterator cur, end;
    cur = m_bubbles.begin();
    end = m_bubbles.end();
    for(; cur != end; ++cur) {
        SystemBubble *b = *cur;
        if(b->InBubble(pos)) {
            return(b);
        }
    }
    //not in any existing bubble.
    return NULL;
}
Ejemplo n.º 5
0
void BubbleManager::UpdateBubble(SystemEntity *ent, bool notify, bool isWarping, bool isPostWarp) {
    SystemBubble *b = ent->Bubble();
    if(b != NULL)
    {
        if(b->InBubble(ent->GetPosition()))
        {
            _log(DESTINY__BUBBLE_DEBUG, "Entity %u at (%.2f,%.2f,%.2f) is still located in bubble %u at (%.2f,%.2f,%.2f) with radius %.2f", ent->GetID(), ent->GetPosition().x, ent->GetPosition().y, ent->GetPosition().z, b->GetBubbleID(), b->m_center.x, b->m_center.y, b->m_center.z, b->m_radius);
            //_log(DESTINY__BUBBLE_TRACE, "Entity %u is still located in bubble %u", ent->GetID(), b->GetBubbleID());
            //still in bubble...
            sLog.Debug( "BubbleManager::UpdateBubble()", "SystemEntity '%s' is still located in Bubble %u", ent->GetName(), b->GetBubbleID() );
            return;
        }
        _log(DESTINY__BUBBLE_DEBUG, "Entity %u at (%.2f,%.2f,%.2f) is no longer located in bubble %u at (%.2f,%.2f,%.2f) with radius %.2f", ent->GetID(), ent->GetPosition().x, ent->GetPosition().y, ent->GetPosition().z, b->GetBubbleID(), b->m_center.x, b->m_center.y, b->m_center.z, b->m_radius);
        //_log(DESTINY__BUBBLE_TRACE, "Entity %u is no longer located in bubble %u", ent->GetID(), b->GetBubbleID());
        b->Remove(ent, notify);
        sLog.Debug( "BubbleManager::UpdateBubble()", "SystemEntity '%s' being removed from Bubble %u", ent->GetName(), b->GetBubbleID() );
    }
    else
        sLog.Debug( "BubbleManager::UpdateBubble()", "SystemEntity '%s' not currently in ANY Bubble!!!", ent->GetName() );

    if( !isWarping )
        Add(ent, notify, isPostWarp);
}
Ejemplo n.º 6
0
void BubbleManager::Remove(SystemEntity *ent, bool notify) {
    SystemBubble *b = ent->Bubble();
    if(b == NULL) {
        //not in any bubble.
        _log(DESTINY__BUBBLE_TRACE, "Entity %u is not located in any bubble. Nothing to remove.", ent->GetID());
        return;
    }
    b->Remove(ent, notify);
    sLog.Debug( "BubbleManager::Remove()", "SystemEntity '%s' being removed from Bubble %u", ent->GetName(), b->GetBubbleID() );

    std::vector<SystemBubble *>::iterator cur, end;
    cur = m_bubbles.begin();
    end = m_bubbles.end();
    for(; cur != end; ++cur) {
        SystemBubble *b = *cur;
        if(b->IsEmpty()) {
            sLog.Debug( "BubbleManager::Remove()", "Bubble %u is empty and is therefore being deleted from the system right now.", b->GetBubbleID() );
            m_bubbles.erase(cur);
            cur = m_bubbles.begin();
            end = m_bubbles.end();
        }
    }
}