diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-05-11 14:42:08 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-05-11 14:42:08 +0000 |
commit | 90d62a2f151c6ec277be693cb5ce0a05df8d036c (patch) | |
tree | 07e7819f7073276cede6b21d06e8c875cb91026f /src | |
parent | b05a0dc923488b038c270ffc8758714aad80b9e2 (diff) | |
download | manaplus-90d62a2f151c6ec277be693cb5ce0a05df8d036c.tar.gz manaplus-90d62a2f151c6ec277be693cb5ce0a05df8d036c.tar.bz2 manaplus-90d62a2f151c6ec277be693cb5ce0a05df8d036c.tar.xz manaplus-90d62a2f151c6ec277be693cb5ce0a05df8d036c.zip |
Reformat itemcontainer drag&drop matrix logic
Some if-s were changed into else if-s. They cannot happen if the
branches above them happen, anyway.
****
mana/plus!177
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index af1d24397..b250cb407 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -422,8 +422,9 @@ void ItemContainer::draw(Graphics *const graphics) graphics->drawImage(image, itemX + mPaddingItemX, itemY + mPaddingItemY); - if ((mProtectedImg != nullptr) && PlayerInfo::isItemProtected( - item->getId())) + + if ((mProtectedImg != nullptr) && + PlayerInfo::isItemProtected(item->getId())) { graphics->drawImage(mProtectedImg, itemX + mPaddingItemX, @@ -544,8 +545,8 @@ void ItemContainer::safeDraw(Graphics *const graphics) graphics->drawImage(image, itemX + mPaddingItemX, itemY + mPaddingItemY); - if ((mProtectedImg != nullptr) && PlayerInfo::isItemProtected( - item->getId())) + if ((mProtectedImg != nullptr) && + PlayerInfo::isItemProtected(item->getId())) { graphics->drawImage(mProtectedImg, itemX + mPaddingItemX, @@ -829,29 +830,30 @@ void ItemContainer::mouseReleased(MouseEvent &event) InventoryTypeT dstContainer = InventoryType::TypeEnd; bool checkProtection(false); Inventory *inventory = nullptr; - if (src == DragDropSource::Inventory - && dst == DragDropSource::Storage) + + if (src == DragDropSource::Inventory && + dst == DragDropSource::Storage) { srcContainer = InventoryType::Inventory; dstContainer = InventoryType::Storage; inventory = PlayerInfo::getInventory(); } - else if (src == DragDropSource::Storage - && dst == DragDropSource::Inventory) + else if (src == DragDropSource::Storage && + dst == DragDropSource::Inventory) { srcContainer = InventoryType::Storage; dstContainer = InventoryType::Inventory; inventory = PlayerInfo::getStorageInventory(); } - if (src == DragDropSource::Inventory - && dst == DragDropSource::Cart) + else if (src == DragDropSource::Inventory && + dst == DragDropSource::Cart) { srcContainer = InventoryType::Inventory; dstContainer = InventoryType::Cart; inventory = PlayerInfo::getInventory(); } - if (src == DragDropSource::Inventory - && dst == DragDropSource::Inventory) + else if (src == DragDropSource::Inventory && + dst == DragDropSource::Inventory) { if (Net::getNetworkType() == ServerType::TMWATHENA) return; @@ -864,29 +866,29 @@ void ItemContainer::mouseReleased(MouseEvent &event) inventoryWindow->combineItems(index, mSelectedIndex); return; } - else if (src == DragDropSource::Cart - && dst == DragDropSource::Inventory) + else if (src == DragDropSource::Cart && + dst == DragDropSource::Inventory) { srcContainer = InventoryType::Cart; dstContainer = InventoryType::Inventory; inventory = PlayerInfo::getCartInventory(); } - else if (src == DragDropSource::Cart - && dst == DragDropSource::Storage) + else if (src == DragDropSource::Cart && + dst == DragDropSource::Storage) { srcContainer = InventoryType::Cart; dstContainer = InventoryType::Storage; inventory = PlayerInfo::getCartInventory(); } - else if (src == DragDropSource::Storage - && dst == DragDropSource::Cart) + else if (src == DragDropSource::Storage && + dst == DragDropSource::Cart) { srcContainer = InventoryType::Storage; dstContainer = InventoryType::Cart; inventory = PlayerInfo::getStorageInventory(); } - if (src == DragDropSource::Inventory - && dst == DragDropSource::Trade) + else if (src == DragDropSource::Inventory && + dst == DragDropSource::Trade) { checkProtection = true; inventory = PlayerInfo::getInventory(); |