summaryrefslogtreecommitdiff
path: root/src/gui/tradewindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-22 19:33:33 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-22 19:34:10 +0300
commit8fb121ec3791bfe3e4d4b1003fcc3397d0b0ea19 (patch)
tree08d6f69f2d65be1874d233c24d6f3355fb01f283 /src/gui/tradewindow.cpp
parent668306a14e6ecfc6ce9b283b10f9f59cdab788a0 (diff)
downloadmanaplus-8fb121ec3791bfe3e4d4b1003fcc3397d0b0ea19.tar.gz
manaplus-8fb121ec3791bfe3e4d4b1003fcc3397d0b0ea19.tar.bz2
manaplus-8fb121ec3791bfe3e4d4b1003fcc3397d0b0ea19.tar.xz
manaplus-8fb121ec3791bfe3e4d4b1003fcc3397d0b0ea19.zip
Add option to secure trades. Enabled by default.
If client detect problems, it cancel trade.
Diffstat (limited to 'src/gui/tradewindow.cpp')
-rw-r--r--src/gui/tradewindow.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 58ac9c592..25c478c21 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -22,6 +22,7 @@
#include "gui/tradewindow.h"
+#include "configuration.h"
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
@@ -144,7 +145,16 @@ void TradeWindow::setMoney(int amount)
{
if (amount < 0 || amount < mGotMaxMoney)
{
- mMoneyLabel->setForegroundColor(Theme::getThemeColor(Theme::WARNING));
+ if (config.getBoolValue("securetrades"))
+ {
+ close();
+ return;
+ }
+ else
+ {
+ mMoneyLabel->setForegroundColor(Theme::getThemeColor(
+ Theme::WARNING));
+ }
}
else
{
@@ -217,6 +227,7 @@ void TradeWindow::reset()
mAddButton->setEnabled(true);
mMoneyChangeButton->setEnabled(true);
mGotMoney = 0;
+ mGotMaxMoney = 0;
setStatus(PREPARING);
}
@@ -386,6 +397,7 @@ void TradeWindow::clear()
mAutoMoney = 0;
mAutoAddAmount = 0;
mGotMoney = 0;
+ mGotMaxMoney = 0;
mMoneyLabel->setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}