diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-26 03:18:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-26 03:18:49 +0300 |
commit | e72b6ef50fbfe22d3c856e06db00d55643a4c148 (patch) | |
tree | 5d01d23e312dd28408d98c6146518e964f81c23b /src | |
parent | ee12ea1f64fe7efcbfdba7e663de1663f3367834 (diff) | |
download | plus-e72b6ef50fbfe22d3c856e06db00d55643a4c148.tar.gz plus-e72b6ef50fbfe22d3c856e06db00d55643a4c148.tar.bz2 plus-e72b6ef50fbfe22d3c856e06db00d55643a4c148.tar.xz plus-e72b6ef50fbfe22d3c856e06db00d55643a4c148.zip |
Add inventory type for mail view window. Not allow drag from/to this inventory.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/actions.cpp | 1 | ||||
-rw-r--r-- | src/enums/dragdropsource.h | 3 | ||||
-rw-r--r-- | src/enums/inventorytype.h | 1 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 16 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/maileditwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/mailviewwindow.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 1 | ||||
-rw-r--r-- | src/resources/inventory/inventory.cpp | 1 |
10 files changed, 26 insertions, 7 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index d95b240c5..b958f8f62 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -267,6 +267,7 @@ static Item *getItemByInvIndex(const int index, case InventoryType::Cart: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: default: diff --git a/src/enums/dragdropsource.h b/src/enums/dragdropsource.h index 3a0ca2fe4..98c4cef7e 100644 --- a/src/enums/dragdropsource.h +++ b/src/enums/dragdropsource.h @@ -38,7 +38,8 @@ enumStart(DragDropSource) Npc, Equipment, Cart, - Mail, + MailEdit, + MailView, Craft, ShopBuy, ShopSell diff --git a/src/enums/inventorytype.h b/src/enums/inventorytype.h index 0656e9d72..91d473f78 100644 --- a/src/enums/inventorytype.h +++ b/src/enums/inventorytype.h @@ -34,6 +34,7 @@ enumStart(InventoryType) Cart, Vending, MailEdit, + MailView, Craft, TypeEnd } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 6d4dc8432..752caff72 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1702,6 +1702,7 @@ void PopupMenu::showPopup(Window *const parent, case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: default: @@ -2815,6 +2816,7 @@ void PopupMenu::addItemMenu(const Item *const item, case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: default: diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index f71a7e35a..2e36ad677 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -662,7 +662,10 @@ void ItemContainer::mousePressed(MouseEvent &event) src = DragDropSource::Cart; break; case InventoryType::MailEdit: - src = DragDropSource::Mail; + src = DragDropSource::MailEdit; + break; + case InventoryType::MailView: + src = DragDropSource::MailView; break; case InventoryType::Craft: src = DragDropSource::Craft; @@ -672,6 +675,8 @@ void ItemContainer::mousePressed(MouseEvent &event) case InventoryType::TypeEnd: break; } + if (src == DragDropSource::MailView) + return; if (mSelectedIndex == index && mClicks != 2) { dragDrop.dragItem(item, src, index); @@ -769,7 +774,10 @@ void ItemContainer::mouseReleased(MouseEvent &event) dst = DragDropSource::Npc; break; case InventoryType::MailEdit: - dst = DragDropSource::Mail; + dst = DragDropSource::MailEdit; + break; + case InventoryType::MailView: + dst = DragDropSource::MailView; break; case InventoryType::Cart: dst = DragDropSource::Cart; @@ -866,7 +874,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) return; } else if (src == DragDropSource::Inventory && - dst == DragDropSource::Mail) + dst == DragDropSource::MailEdit) { inventory = PlayerInfo::getInventory(); if (inventory == nullptr) @@ -1017,7 +1025,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) return; } } - else if (src == DragDropSource::Mail) + else if (src == DragDropSource::MailEdit) { if (settings.enableNewMailSystem) { diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 183c775ee..7a3716291 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -128,6 +128,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: default: @@ -320,6 +321,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: break; @@ -383,6 +385,7 @@ void InventoryWindow::storeSortOrder() const case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: default: @@ -832,6 +835,7 @@ void InventoryWindow::close() case InventoryType::Npc: case InventoryType::Vending: case InventoryType::MailEdit: + case InventoryType::MailView: case InventoryType::Craft: case InventoryType::TypeEnd: break; diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index 5dfa769f6..64391e8ae 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -74,7 +74,7 @@ MailEditWindow::MailEditWindow() : mMoneyField(new IntTextField(this, 0, 0, settings.enableNewMailSystem ? INT_MAX : 10000000)), mMessageField(new TextField(this)), - mInventory(new Inventory(InventoryType::Mail, + mInventory(new Inventory(InventoryType::MailEdit, settings.enableNewMailSystem ? -1 : 1)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index e1b3a16de..6a55f6a2e 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -81,7 +81,7 @@ MailViewWindow::MailViewWindow(const MailMessage *const message, // TRANSLATORS: mail view window label mMessageLabel(new Label(this, strprintf("%s %s", _("Message:"), message->text.c_str()))), - mInventory(new Inventory(InventoryType::MailEdit, itemsCount)), + mInventory(new Inventory(InventoryType::MailView, itemsCount)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, fromBool(getOptionBool("showitemsbackground"), Opaque), diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index fde40c7ad..1f816f7c1 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -93,6 +93,7 @@ size_t InventoryHandler::getSize(const InventoryTypeT type) const case InventoryType::Vending: case InventoryType::Craft: case InventoryType::TypeEnd: + case InventoryType::MailView: default: return 0; } diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp index dbee2a541..7363bdd30 100644 --- a/src/resources/inventory/inventory.cpp +++ b/src/resources/inventory/inventory.cpp @@ -375,6 +375,7 @@ std::string Inventory::getName() const return N_("Cart"); } case InventoryType::MailEdit: + case InventoryType::MailView: { // TRANSLATORS: inventory type name return N_("Mail"); |