summaryrefslogtreecommitdiff
path: root/src/resources/itemdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-01 20:04:35 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-01 20:04:35 +0300
commitb8cdabbd20690d57930dce9dda949fca21a6233a (patch)
treeddd3d0a3bb4d83206b92ede95b330430e803e26b /src/resources/itemdb.cpp
parentab1f66527863c7fcce6c3ccedda0d5560dc063c7 (diff)
downloadmv-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.gz
mv-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.bz2
mv-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.xz
mv-b8cdabbd20690d57930dce9dda949fca21a6233a.zip
Eliminate asserts from most files.
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r--src/resources/itemdb.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 394aa74be..733c12958 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -36,8 +36,6 @@
#include <libxml/tree.h>
-#include <cassert>
-
#include "debug.h"
namespace
@@ -435,7 +433,8 @@ void ItemDB::unload()
bool ItemDB::exists(int id)
{
- assert(mLoaded);
+ if (!mLoaded)
+ return false;
ItemInfos::const_iterator i = mItemInfos.find(id);
@@ -444,7 +443,8 @@ bool ItemDB::exists(int id)
const ItemInfo &ItemDB::get(int id)
{
- assert(mLoaded);
+ if (!mLoaded)
+ load();
ItemInfos::const_iterator i = mItemInfos.find(id);
@@ -459,7 +459,8 @@ const ItemInfo &ItemDB::get(int id)
const ItemInfo &ItemDB::get(const std::string &name)
{
- assert(mLoaded);
+ if (!mLoaded)
+ load();
NamedItemInfos::const_iterator i = mNamedItemInfos.find(normalize(name));
@@ -597,7 +598,7 @@ void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node)
else
{
logger->log("ItemDB: Ignoring unknown sound event '%s'",
- event.c_str());
+ event.c_str());
}
}
@@ -656,7 +657,6 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
}
case -2:
{
- logger->log("parse -2");
for_each_xml_child_node(itemNode, replaceNode)
{
if (xmlStrEqual(itemNode->name, BAD_CAST "item"))