summaryrefslogtreecommitdiff
path: root/src/resources/itemmanager.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-03 15:00:47 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-03 15:00:47 +0000
commit77efbb50066a030d1f44f8de8d06ace9f284e3a2 (patch)
tree22d737ac0058e4fa87e7767d41e02999bcbf84be /src/resources/itemmanager.cpp
parent40ca3dc75197412594c5f6a78d68b265e235024b (diff)
downloadmana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.gz
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.bz2
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.xz
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.zip
Introduced SelectionListener to fix updating problem in inventory window
(should also be used to fix similar problem in trade, buy and sell dialogs). Made the ItemInfo be passed around as a reference instead of a pointer, since it is never NULL.
Diffstat (limited to 'src/resources/itemmanager.cpp')
-rw-r--r--src/resources/itemmanager.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp
index a497b3c8..7d0b13f2 100644
--- a/src/resources/itemmanager.cpp
+++ b/src/resources/itemmanager.cpp
@@ -41,8 +41,7 @@
ItemManager::ItemManager()
{
- mUnknown = new ItemInfo();
- mUnknown->setName("Unknown item");
+ mUnknown.setName("Unknown item");
ResourceManager *resman = ResourceManager::getInstance();
int size;
@@ -163,14 +162,12 @@ ItemManager::~ItemManager()
delete i->second;
}
mItemInfos.clear();
-
- delete mUnknown;
}
-ItemInfo*
+const ItemInfo&
ItemManager::getItemInfo(int id)
{
ItemInfoIterator i = mItemInfos.find(id);
- return (i != mItemInfos.end()) ? i->second : mUnknown;
+ return (i != mItemInfos.end()) ? *(i->second) : mUnknown;
}