mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
cleanup stack calc code
This commit is contained in:
parent
d1568c75f9
commit
a86fc2794b
1 changed files with 1 additions and 5 deletions
|
@ -530,11 +530,9 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
|
||||||
|
|
||||||
// update stack
|
// update stack
|
||||||
uint32_t newStackSize = count + quantity;
|
uint32_t newStackSize = count + quantity;
|
||||||
uint32_t overflow = 0;
|
|
||||||
|
|
||||||
if( newStackSize > maxStack )
|
if( newStackSize > maxStack )
|
||||||
{
|
{
|
||||||
overflow = newStackSize - item->getMaxStackSize();
|
quantity = newStackSize - maxStack;
|
||||||
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 );
|
auto slotUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
|
||||||
queuePacket( slotUpdate );
|
queuePacket( slotUpdate );
|
||||||
|
|
||||||
quantity = overflow;
|
|
||||||
|
|
||||||
// return existing stack if we have no overflow - items fit into a preexisting stack
|
// return existing stack if we have no overflow - items fit into a preexisting stack
|
||||||
if( quantity == 0 )
|
if( quantity == 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue