Пример #1
0
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);
}