summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-18 14:59:13 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-18 14:59:13 +0300
commit21fbfa417e0ab5fee402e9c97b5220dc713c0a53 (patch)
treed38f7e92bf5c9b4a2f939e3eccfc70ce3fcfcf32
parent64309d7a7dc6380d62fa11363073d4243cbfa665 (diff)
downloadmanaverse-21fbfa417e0ab5fee402e9c97b5220dc713c0a53.tar.gz
manaverse-21fbfa417e0ab5fee402e9c97b5220dc713c0a53.tar.bz2
manaverse-21fbfa417e0ab5fee402e9c97b5220dc713c0a53.tar.xz
manaverse-21fbfa417e0ab5fee402e9c97b5220dc713c0a53.zip
Remove auto_ptr from trade window.
-rw-r--r--src/gui/windows/tradewindow.cpp12
-rw-r--r--src/gui/windows/tradewindow.h5
2 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 708f4bc4d..1ed169181 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -54,6 +54,7 @@
#include "net/tradehandler.h"
+#include "utils/delete2.h"
#include "utils/gettext.h"
#include "debug.h"
@@ -76,8 +77,8 @@ TradeWindow::TradeWindow() :
SelectionListener(),
mMyInventory(new Inventory(Inventory::TRADE)),
mPartnerInventory(new Inventory(Inventory::TRADE)),
- mMyItemContainer(new ItemContainer(this, mMyInventory.get())),
- mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())),
+ mMyItemContainer(new ItemContainer(this, mMyInventory)),
+ mPartnerItemContainer(new ItemContainer(this, mPartnerInventory)),
// TRANSLATORS: trade window money label
mMoneyLabel(new Label(this, strprintf(_("You get %s"), ""))),
// TRANSLATORS: trade window button
@@ -158,6 +159,8 @@ TradeWindow::TradeWindow() :
TradeWindow::~TradeWindow()
{
+ delete2(mMyInventory);
+ delete2(mPartnerInventory);
}
void TradeWindow::setMoney(const int amount)
@@ -201,7 +204,7 @@ void TradeWindow::addItem(const int id,
const bool damaged,
const bool favorite) const
{
- Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
+ Inventory *inv = own ? mMyInventory : mPartnerInventory;
inv->addItem(id, type, quantity, refine, color,
identified, damaged, favorite, false, false);
}
@@ -219,7 +222,7 @@ void TradeWindow::addItem2(const int id,
const bool favorite,
const bool equipment) const
{
- Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
+ Inventory *inv = own ? mMyInventory : mPartnerInventory;
const int slot = inv->addItem(id, type, quantity, refine, color,
identified, damaged, favorite, equipment, false);
if (slot >= 0)
@@ -364,7 +367,6 @@ void TradeWindow::action(const ActionEvent &event)
if (mMyInventory->getFreeSlot() == -1)
return;
-
if (!checkItem(item))
return;
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index f5b17eddd..1abe4a91f 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -174,9 +174,8 @@ class TradeWindow final : public Window,
*/
void setStatus(const Status s);
- typedef const std::auto_ptr<Inventory> InventoryPtr;
- InventoryPtr mMyInventory;
- InventoryPtr mPartnerInventory;
+ Inventory *mMyInventory;
+ Inventory *mPartnerInventory;
ItemContainer *mMyItemContainer;
ItemContainer *mPartnerItemContainer;