From 6ed2a850c76d4095274554c418a86eb66779e70f Mon Sep 17 00:00:00 2001 From: ShelbyZ Date: Sun, 22 Oct 2017 18:53:58 -0700 Subject: [PATCH] Quantity treated as uint32_t at packet level - move tryAddItem/AddItem to uint32_t from uint16_t --- src/servers/Server_Zone/Actor/Player.h | 4 ++-- src/servers/Server_Zone/Actor/PlayerInventory.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/servers/Server_Zone/Actor/Player.h b/src/servers/Server_Zone/Actor/Player.h index 95fd1b89..7b08e911 100644 --- a/src/servers/Server_Zone/Actor/Player.h +++ b/src/servers/Server_Zone/Actor/Player.h @@ -197,9 +197,9 @@ public: // Inventory / Item / Currency ////////////////////////////////////////////////////////////////////////////////////////////////////// /*! add an item to the first free slot in one of the 4 main containers */ - bool tryAddItem( uint16_t catalogId, uint16_t quantity ); + bool tryAddItem( uint16_t catalogId, uint32_t quantity ); /*! add an item to a given container */ - bool addItem( uint16_t containerId, uint16_t catalogId, uint16_t quantity ); + bool addItem( uint16_t containerId, uint16_t catalogId, uint32_t quantity ); /*! equip an item to a specified slot */ void equipItem( Inventory::EquipSlot equipSlotId, ItemPtr pItem, bool sendModel ); /*! remove an item from an equipment slot */ diff --git a/src/servers/Server_Zone/Actor/PlayerInventory.cpp b/src/servers/Server_Zone/Actor/PlayerInventory.cpp index b5380d82..acc6632c 100644 --- a/src/servers/Server_Zone/Actor/PlayerInventory.cpp +++ b/src/servers/Server_Zone/Actor/PlayerInventory.cpp @@ -189,10 +189,10 @@ void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount ) queuePacket( invUpPacket ); } -bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint16_t quantity ) +bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint32_t quantity ) { - for( uint8_t i = 0; i < 4; i++ ) + for( uint16_t i = 0; i < 4; i++ ) { if( m_pInventory->addItem( i, -1, catalogId, quantity ) != -1 ) { @@ -202,7 +202,7 @@ bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint16_t quantity ) return false; } -bool Core::Entity::Player::addItem( uint16_t containerId, uint16_t catalogId, uint16_t quantity ) +bool Core::Entity::Player::addItem( uint16_t containerId, uint16_t catalogId, uint32_t quantity ) { if( m_pInventory->addItem( containerId, -1, catalogId, quantity ) != -1 ) return true;