summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/insertcarddialog.cpp19
-rw-r--r--src/gui/windows/insertcarddialog.h4
-rw-r--r--src/net/eathena/inventoryhandler.cpp8
3 files changed, 25 insertions, 6 deletions
diff --git a/src/gui/windows/insertcarddialog.cpp b/src/gui/windows/insertcarddialog.cpp
index d34dcc7c6..607a41c6a 100644
--- a/src/gui/windows/insertcarddialog.cpp
+++ b/src/gui/windows/insertcarddialog.cpp
@@ -32,17 +32,30 @@
#include "net/inventoryhandler.h"
#include "utils/gettext.h"
+#include "utils/stringutils.h"
#include "debug.h"
-InsertCardDialog::InsertCardDialog(const int itemIndex) :
+InsertCardDialog::InsertCardDialog(const int itemIndex,
+ const Item *const item) :
SellDialog(false),
+ mItem(item),
mItemIndex(itemIndex)
{
// TRANSLATORS: insert card dialog name
setWindowName(_("Insert card"));
- // TRANSLATORS: insert card dialog name
- setCaption(_("Insert card"));
+ if (item)
+ {
+ // TRANSLATORS: insert card dialog name
+ setCaption(strprintf(_("Insert card %s"),
+ item->getName().c_str()));
+ }
+ else
+ {
+ // TRANSLATORS: insert card dialog name
+ setCaption(strprintf(_("Insert card %s"),
+ ""));
+ }
}
void InsertCardDialog::initButtons()
diff --git a/src/gui/windows/insertcarddialog.h b/src/gui/windows/insertcarddialog.h
index 1ebc823b3..aa10c9a02 100644
--- a/src/gui/windows/insertcarddialog.h
+++ b/src/gui/windows/insertcarddialog.h
@@ -35,7 +35,8 @@ class InsertCardDialog final : public SellDialog
*
* @see Window::Window
*/
- explicit InsertCardDialog(const int itemIndex);
+ InsertCardDialog(const int itemIndex,
+ const Item *const item);
A_DELETE_COPY(InsertCardDialog)
@@ -44,6 +45,7 @@ class InsertCardDialog final : public SellDialog
void sellAction(const ActionEvent &event) override final;
private:
+ const Item *mItem;
int mItemIndex;
};
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 48fdb67b8..61d081434 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -833,9 +833,13 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
void InventoryHandler::processPlayerUseCard(Net::MessageIn &msg)
{
+ const Inventory *const inv = PlayerInfo::getInventory();
+ const int index = inventoryHandler->getItemIndex();
+ const Item *item1 = nullptr;
+ if (inv)
+ item1 = inv->getItem(index);
SellDialog *const dialog = CREATEWIDGETR(InsertCardDialog,
- inventoryHandler->getItemIndex());
- Inventory *const inv = PlayerInfo::getInventory();
+ index, item1);
const int count = (msg.readInt16("len") - 4) / 2;
for (int f = 0; f < count; f ++)