예제 #1
0
파일: item.cpp 프로젝트: Elexonic/otxserver
Player* Item::getHoldingPlayer()
{
	for(Cylinder* p = getParent(); p; p = p->getParent())
	{
		if(p->getCreature())
			return p->getCreature()->getPlayer();
	}

	return NULL;
}
예제 #2
0
Player* Item::getHoldingPlayer()
{
	Cylinder* p = getParent();
	while(p){
		if(p->getCreature())
			// Must be a player, creatures are not cylinders
			return p->getCreature()->getPlayer();
		p = p->getParent();
	}
	return NULL;
}
예제 #3
0
Player* Item::getHoldingPlayer()
{
	Cylinder* p = getParent();

	while (p) {
		if (p->getCreature()) {
			return p->getCreature()->getPlayer();
		}

		p = p->getParent();
	}

	return NULL;
}
예제 #4
0
void Container::postRemoveNotification(Thing* thing, const Cylinder* newParent, int32_t index, cylinderlink_t)
{
	Cylinder* topParent = getTopParent();
	if (topParent->getCreature()) {
		topParent->postRemoveNotification(thing, newParent, index, LINK_TOPPARENT);
	} else if (topParent == this) {
		//let the tile class notify surrounding players
		if (topParent->getParent()) {
			topParent->getParent()->postRemoveNotification(thing, newParent, index, LINK_NEAR);
		}
	} else {
		topParent->postRemoveNotification(thing, newParent, index, LINK_PARENT);
	}
}
예제 #5
0
void Container::postRemoveNotification(Creature* actor, Thing* thing, const Cylinder* newParent,
                                       int32_t index, bool isCompleteRemoval, CylinderLink_t/* link = LINK_OWNER*/)
{
    Cylinder* topParent = getTopParent();
    if(!topParent->getCreature())
    {
        if(topParent == this)
        {
            //let the tile class notify surrounding players
            if(topParent->getParent())
                topParent->getParent()->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_NEAR);
        }
        else
            topParent->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_PARENT);
    }
    else
        topParent->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_TOPPARENT);
}