summaryrefslogtreecommitdiff
path: root/src/resources
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
parentab1f66527863c7fcce6c3ccedda0d5560dc063c7 (diff)
downloadmanaverse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.gz
manaverse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.bz2
manaverse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.xz
manaverse-b8cdabbd20690d57930dce9dda949fca21a6233a.zip
Eliminate asserts from most files.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/imageloader.cpp4
-rw-r--r--src/resources/itemdb.cpp14
-rw-r--r--src/resources/mapreader.cpp6
-rw-r--r--src/resources/resource.cpp2
4 files changed, 10 insertions, 16 deletions
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index c63d33c00..72a839573 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -29,8 +29,6 @@
#include <guichan/sdl/sdlpixel.hpp>
-#include <cassert>
-
#include "debug.h"
#ifdef free
@@ -79,12 +77,10 @@ int ProxyImage::getHeight() const
return mImage->mBounds.h;
else
return 0;
-// return mSDLImage ? mSDLImage->h : mImage->getHeight();
}
gcn::Color ProxyImage::getPixel(int x, int y)
{
- assert(mSDLImage);
return gcn::SDLgetPixel(mSDLImage, x, y);
}
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"))
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 70c45054f..685d415ff 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -37,7 +37,6 @@
#include "utils/stringutils.h"
#include "utils/xml.h"
-#include <cassert>
#include <iostream>
#include <zlib.h>
@@ -110,7 +109,8 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
}
ret = inflate(&strm, Z_NO_FLUSH);
- assert(ret != Z_STREAM_ERROR);
+ if (ret == Z_STREAM_ERROR)
+ return ret;
switch (ret)
{
@@ -140,7 +140,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
}
}
while (ret != Z_STREAM_END);
- assert(strm.avail_in == 0);
+// assert(strm.avail_in == 0);
outLength = bufferSize - strm.avail_out;
(void) inflateEnd(&strm);
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index b180712c1..552af06ec 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -27,8 +27,6 @@
#include "resources/resourcemanager.h"
-#include <cassert>
-
#include "debug.h"
Resource::~Resource()