1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 22:37:45 +00:00

cleanup stack calc code

This commit is contained in:
NotAdam 2018-08-25 20:52:20 +10:00
parent d1568c75f9
commit a86fc2794b

View file

@ -530,11 +530,9 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
// update stack
uint32_t newStackSize = count + quantity;
uint32_t overflow = 0;
if( newStackSize > maxStack )
{
overflow = newStackSize - item->getMaxStackSize();
quantity = newStackSize - maxStack;
newStackSize = maxStack;
}
@ -544,8 +542,6 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
auto slotUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
queuePacket( slotUpdate );
quantity = overflow;
// return existing stack if we have no overflow - items fit into a preexisting stack
if( quantity == 0 )
{