summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/buy.cpp')
-rw-r--r--src/gui/buy.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 5a57dcc6..768dab4d 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.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
@@ -32,6 +31,7 @@
#include "widgets/layout.h"
#include "../npc.h"
+#include "../units.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -43,7 +43,7 @@ BuyDialog::BuyDialog(Network *network):
Window(_("Buy")), mNetwork(network),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
- setWindowName(_("Buy"));
+ setWindowName("Buy");
setResizable(true);
setMinWidth(260);
setMinHeight(230);
@@ -55,7 +55,8 @@ BuyDialog::BuyDialog(Network *network):
mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label(strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
+ mMoneyLabel = new gcn::Label(strprintf(_("Price: %s / Total: %s"),
+ "", ""));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
mBuyButton = new Button(_("Buy"), "buy", this);
@@ -236,5 +237,14 @@ void BuyDialog::updateButtonsAndLabels()
// Update quantity and money labels
mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
mMoneyLabel->setCaption
- (strprintf(_("Price: %d GP / Total: %d GP"), price, mMoney - price));
+ (strprintf(_("Price: %s / Total: %s"),
+ Units::formatCurrency(price).c_str(),
+ Units::formatCurrency(mMoney - price).c_str()));
+}
+
+void BuyDialog::logic()
+{
+ Window::logic();
+
+ if (!current_npc) setVisible(false);
}