Exemple #1
0
ReturnValue DepotChest::__queryAdd(int32_t index, const Thing* thing, uint32_t count,
	uint32_t flags, Creature* actor/* = NULL*/) const
{
	const Item* item = thing->getItem();
	if(!item)
		return RET_NOTPOSSIBLE;

	if((flags & FLAG_NOLIMIT) == FLAG_NOLIMIT)
		return Container::__queryAdd(index, thing, count, flags, actor);

	int32_t addCount = 0;
	if((item->isStackable() && item->getItemCount() != count))
		addCount = 1;

	if(item->getTopParent() != this)
	{
		if(const Container* container = item->getContainer())
			addCount = container->getItemHoldingCount() + 1;
		else
			addCount = 1;
	}

	if(getItemHoldingCount() + addCount > depotLimit)
		return RET_DEPOTISFULL;

	return Container::__queryAdd(index, thing, count, flags, actor);
}
Exemple #2
0
ReturnValue Depot::__queryAdd(int32_t index, const Thing* thing, uint32_t count,
	uint32_t flags) const
{
	const Item* item = thing->getItem();
	if(item == NULL){
		return RET_NOTPOSSIBLE;
	}

	if(!hasBitSet(FLAG_IGNORECAPACITY, flags)){
		int addCount = 0;

		if((item->isStackable() && item->getItemCount() != count)){
			addCount = 1;
		}

		if(item->getTopParent() != this){
			if(const Container* container = item->getContainer()){
				addCount = container->getItemHoldingCount() + 1;
			}
			else{
				addCount = 1;
			}
		}

		if(getItemHoldingCount() + addCount > maxDepotLimit){
			return RET_DEPOTISFULL;
		}
	}

	return Container::__queryAdd(index, thing, count, flags);
}
ReturnValue DepotChest::queryAdd(int32_t index, const Thing& thing, uint32_t count,
		uint32_t flags, Creature* actor/* = nullptr*/) const
{
	const Item* item = thing.getItem();
	if (item == nullptr) {
		return RETURNVALUE_NOTPOSSIBLE;
	}

	bool skipLimit = hasBitSet(FLAG_NOLIMIT, flags);
	if (!skipLimit) {
		int32_t addCount = 0;

		if ((item->isStackable() && item->getItemCount() != count)) {
			addCount = 1;
		}

		if (item->getTopParent() != this) {
			if (const Container* container = item->getContainer()) {
				addCount = container->getItemHoldingCount() + 1;
			} else {
				addCount = 1;
			}
		}

		if (getItemHoldingCount() + addCount > maxDepotItems) {
			return RETURNVALUE_DEPOTISFULL;
		}
	}

	return Container::queryAdd(index, thing, count, flags, actor);
}
Exemple #4
0
ReturnValue Depot::__queryAdd(int32_t index, const Thing* thing, uint32_t count,
	uint32_t flags) const
{
	const Item* item = thing->getItem();
	if(item == NULL)
		return RET_NOTPOSSIBLE;

	bool skipLimit = ((flags & FLAG_NOLIMIT) == FLAG_NOLIMIT);
	if(!skipLimit)
	{
		int32_t addCount = 0;
		if((item->isStackable() && item->getItemCount() != count))
			addCount = 1;

		if(item->getTopParent() != this)
		{
			if(const Container* container = item->getContainer())
				addCount = container->getItemHoldingCount() + 1;
			else
				addCount = 1;
		}

		if(getItemHoldingCount() + addCount > maxDepotLimit)
			return RET_DEPOTISFULL;
	}
	return Container::__queryAdd(index, thing, count, flags);
}