Guizek69
New Member
- Joined
- Jul 14, 2020
- Messages
- 10
- Reaction score
- 3
Hello otlanders!
Let's talk about this old and ridiculous bug present in tfs 0.4.
Imagine you have 10 crystal coins in a backpack full of other items.
But then you find a crystal coin on the ground and try to pull it quickly to stack it.
See the result in the image:
Does anyone think of a solution?
I'll leave the container.cpp action code in the topic.
I look forward to it, thank you very much.
Let's talk about this old and ridiculous bug present in tfs 0.4.
Imagine you have 10 crystal coins in a backpack full of other items.
But then you find a crystal coin on the ground and try to pull it quickly to stack it.
See the result in the image:
Does anyone think of a solution?
I'll leave the container.cpp action code in the topic.
I look forward to it, thank you very much.
ReturnValue Container::__queryMaxCount(int32_t index, const Thing* thing, uint32_t count,
uint32_t& maxQueryCount, uint32_t flags) const
{
const Item* item = thing->getItem();
if(!item)
{
maxQueryCount = 0;
return RET_NOTPOSSIBLE;
}
if(((flags & FLAG_NOLIMIT) == FLAG_NOLIMIT))
{
maxQueryCount = std::max((uint32_t)1, count);
return RET_NOERROR;
}
int32_t freeSlots = std::max((int32_t)(capacity() - size()), (int32_t)0);
if(item->isStackable())
{
uint32_t n = 0;
if(index == INDEX_WHEREEVER)
{
//Iterate through every item and check how much free stackable slots there is.
uint32_t slotIndex = 0;
for(ItemList::const_iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit, ++slotIndex)
{
if((*cit) != item && (*cit)->getID() == item->getID() && (*cit)->getItemCount() < 100)
{
uint32_t remainder = (100 - (*cit)->getItemCount());
if(__queryAdd(slotIndex, item, remainder, flags) == RET_NOERROR)
n += remainder;
}
}
}
else
{
const Thing* destThing = __getThing(index);
const Item* destItem = NULL;
if(destThing)
destItem = destThing->getItem();
if(destItem && destItem->getID() == item->getID() && destItem->getItemCount() < 100)
{
uint32_t remainder = 100 - destItem->getItemCount();
if(__queryAdd(index, item, remainder, flags) == RET_NOERROR)
n = remainder;
}
}
maxQueryCount = freeSlots * 100 + n;
if(maxQueryCount < count)
return RET_CONTAINERNOTENOUGHROOM;
}
else
{
maxQueryCount = freeSlots;
if(maxQueryCount == 0)
return RET_CONTAINERNOTENOUGHROOM;
}
return RET_NOERROR;
}