summaryrefslogtreecommitdiff
path: root/src/gui/sell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r--src/gui/sell.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 591cf97b..fe391636 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +30,7 @@
#include "widgets/layout.h"
#include "../npc.h"
+#include "../units.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -39,11 +39,11 @@
#include "../utils/strprintf.h"
SellDialog::SellDialog(Network *network):
- Window("Sell"),
+ Window(_("Sell")),
mNetwork(network),
mMaxItems(0), mAmountItems(0)
{
- setWindowName(_("Sell"));
+ setWindowName("Sell");
setResizable(true);
setCloseButton(true);
setMinWidth(260);
@@ -61,8 +61,8 @@ SellDialog::SellDialog(Network *network):
mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(
- strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
+ mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"),
+ "", ""));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
@@ -103,6 +103,7 @@ SellDialog::SellDialog(Network *network):
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ center();
loadWindowState();
}
@@ -275,9 +276,16 @@ void SellDialog::updateButtonsAndLabels()
// Update the quantity and money labels
mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
- mMoneyLabel->setCaption
- (strprintf(_("Price: %d GP / Total: %d GP"),
- income, mPlayerMoney + income));
+ mMoneyLabel->setCaption(strprintf(_("Price: %s / Total: %s"),
+ Units::formatCurrency(income).c_str(),
+ Units::formatCurrency(mPlayerMoney + income).c_str()));
+}
+
+void SellDialog::logic()
+{
+ Window::logic();
+
+ if (!current_npc) setVisible(false);
}
void SellDialog::setVisible(bool visible)