summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-02 21:09:14 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-02 21:09:14 +0300
commit670264d93a362a3b987c6da62511ac49cd07b048 (patch)
tree8e7470b6f419965a4fe4464fe06dd9c117edce5a /src
parent6e577446c8b561a4ce8fd2d74f43c36210e8a571 (diff)
downloadmanaplus-670264d93a362a3b987c6da62511ac49cd07b048.tar.gz
manaplus-670264d93a362a3b987c6da62511ac49cd07b048.tar.bz2
manaplus-670264d93a362a3b987c6da62511ac49cd07b048.tar.xz
manaplus-670264d93a362a3b987c6da62511ac49cd07b048.zip
Show asserts for most errors in resource dbs.
Diffstat (limited to 'src')
-rw-r--r--src/resources/db/colordb.cpp9
-rw-r--r--src/resources/db/emotedb.cpp14
-rw-r--r--src/resources/db/homunculusdb.cpp3
-rw-r--r--src/resources/db/horsedb.cpp6
-rw-r--r--src/resources/db/itemdb.cpp15
-rw-r--r--src/resources/db/mercenarydb.cpp5
-rw-r--r--src/resources/db/monsterdb.cpp3
-rw-r--r--src/resources/db/npcdb.cpp5
-rw-r--r--src/resources/db/npcdialogdb.cpp7
-rw-r--r--src/resources/db/palettedb.cpp3
-rw-r--r--src/resources/db/petdb.cpp5
-rw-r--r--src/resources/db/skillunitdb.cpp6
-rw-r--r--src/resources/db/statuseffectdb.cpp10
13 files changed, 54 insertions, 37 deletions
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 2cbaa44ce..7f699f419 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -24,6 +24,8 @@
#include "configuration.h"
#include "logger.h"
+#include "utils/checkutils.h"
+
#include "resources/beingcommon.h"
#include "debug.h"
@@ -107,7 +109,7 @@ void ColorDB::loadHair(const std::string &fileName,
if (colors.find(id) != colors.end())
{
- logger->log("ColorDB: Redefinition of dye ID %d",
+ reportAlways("ColorDB: Redefinition of dye ID %d",
toInt(id, int));
}
@@ -189,7 +191,7 @@ std::string &ColorDB::getHairColorName(const ItemColor id)
const ColorListsIterator it = mColorLists.find("hair");
if (it == mColorLists.end())
{
- logger->log1("ColorDB: Error, hair colors list empty");
+ reportAlways("ColorDB: Error, hair colors list empty");
return mFail;
}
@@ -197,7 +199,8 @@ std::string &ColorDB::getHairColorName(const ItemColor id)
if (i == (*it).second.end())
{
- logger->log("ColorDB: Error, unknown dye ID# %d", toInt(id, int));
+ reportAlways("ColorDB: Error, unknown dye ID# %d",
+ toInt(id, int));
return mFail;
}
else
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 40d59d780..77176fea3 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -26,6 +26,8 @@
#include "configuration.h"
+#include "utils/checkutils.h"
+
#include "resources/beingcommon.h"
#include "resources/emoteinfo.h"
#include "resources/emotesprite.h"
@@ -103,7 +105,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName,
if (id == -1)
{
- logger->log("Emote Database: Emote with missing ID in %s!",
+ reportAlways("Emote Database: Emote with missing ID in %s!",
paths.getStringValue("emotesFile").c_str());
continue;
}
@@ -176,8 +178,8 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName,
const int id = XML::getProperty(emoteNode, "id", -1);
if (id == -1)
{
- logger->log1("Emote Database: Emote with missing ID in "
- "manaplus_emotes.xml!");
+ reportAlways("Emote Database: Emote with missing ID in "
+ "manaplus_emotes.xml!");
continue;
}
const int altId = XML::getProperty(emoteNode, "altid", -1);
@@ -259,7 +261,8 @@ const EmoteInfo *EmoteDB::get(const int id, const bool allowNull)
{
if (allowNull)
return nullptr;
- logger->log("EmoteDB: Warning, unknown emote ID %d requested", id);
+ reportAlways("EmoteDB: Warning, unknown emote ID %d requested",
+ id);
return &mUnknown;
}
else
@@ -280,7 +283,8 @@ const EmoteInfo *EmoteDB::get2(int id, const bool allowNull)
{
if (allowNull)
return nullptr;
- logger->log("EmoteDB: Warning, unknown emote ID %d requested", id);
+ reportAlways("EmoteDB: Warning, unknown emote ID %d requested",
+ id);
return &mUnknown;
}
else
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp
index c8c7d6d2c..294d04655 100644
--- a/src/resources/db/homunculusdb.cpp
+++ b/src/resources/db/homunculusdb.cpp
@@ -27,6 +27,7 @@
#include "resources/beingcommon.h"
#include "resources/beinginfo.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "configuration.h"
@@ -140,7 +141,7 @@ BeingInfo *HomunculusDB::get(const BeingTypeId id)
i = mHomunculusInfos.find(id);
if (i == mHomunculusInfos.end())
{
- logger->log("HomunculusDB: Warning, unknown homunculus ID "
+ reportAlways("HomunculusDB: Warning, unknown homunculus ID "
"%d requested",
toInt(id, int));
return BeingInfo::unknown;
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index c43769bca..fc1fffca2 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -27,6 +27,7 @@
#include "resources/beingcommon.h"
#include "resources/horseinfo.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "debug.h"
@@ -119,7 +120,7 @@ void HorseDB::loadXmlFile(const std::string &fileName,
if (id == -1)
{
- logger->log("Horse Database: Horse with missing ID in %s!",
+ reportAlways("Horse Database: Horse with missing ID in %s!",
paths.getStringValue("horsesFile").c_str());
continue;
}
@@ -211,7 +212,8 @@ HorseInfo *HorseDB::get(const int id, const bool allowNull)
{
if (allowNull)
return nullptr;
- logger->log("HorseDB: Warning, unknown emote ID %d requested", id);
+ reportAlways("HorseDB: Warning, unknown horse ID %d requested",
+ id);
return &mUnknown;
}
else
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 726478523..0fda7e736 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -282,7 +282,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
if (id == 0)
{
- logger->log("ItemDB: Invalid or missing item ID in %s!",
+ reportAlways("ItemDB: Invalid or missing item ID in %s!",
fileName.c_str());
continue;
}
@@ -372,8 +372,9 @@ void ItemDB::loadXmlFile(const std::string &fileName,
}
else
{
- logger->log("Inherit item %d from not existing item %d",
- id, inherit);
+ reportAlways("Inherit item %d from not existing item %d",
+ id,
+ inherit);
}
}
@@ -610,7 +611,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
{
if (attackRange == 0)
{
- logger->log("ItemDB: Missing attack range from weapon %i!",
+ reportAlways("ItemDB: Missing attack range from weapon %i!",
id);
}
}
@@ -695,8 +696,8 @@ const ItemInfo &ItemDB::get(const std::string &name)
{
if (!name.empty())
{
- logger->log("ItemDB: Warning, unknown item name \"%s\"",
- name.c_str());
+ reportAlways("ItemDB: Warning, unknown item name \"%s\"",
+ name.c_str());
}
return *mUnknown;
}
@@ -869,7 +870,7 @@ static void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node)
}
else
{
- logger->log("ItemDB: Ignoring unknown sound event '%s'",
+ reportAlways("ItemDB: Ignoring unknown sound event '%s'",
event.c_str());
}
}
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index 60fe94504..4fbc7e36c 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -27,6 +27,7 @@
#include "resources/beingcommon.h"
#include "resources/beinginfo.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "configuration.h"
@@ -62,7 +63,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName,
if (!rootNode || !xmlNameEqual(rootNode, "mercenaries"))
{
- logger->log("Monster Database: Error while loading %s!",
+ logger->log("MercenaryDB: Error while loading %s!",
paths.getStringValue("mercenariesFile").c_str());
mLoaded = true;
return;
@@ -141,7 +142,7 @@ BeingInfo *MercenaryDB::get(const BeingTypeId id)
i = mMercenaryInfos.find(id);
if (i == mMercenaryInfos.end())
{
- logger->log("MercenaryDB: Warning, unknown mercenary ID "
+ reportAlways("MercenaryDB: Warning, unknown mercenary ID "
"%d requested",
toInt(id, int));
return BeingInfo::unknown;
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index 777fa32a7..8d7455fa5 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -27,6 +27,7 @@
#include "resources/beingcommon.h"
#include "resources/beinginfo.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -147,7 +148,7 @@ BeingInfo *MonsterDB::get(const BeingTypeId id)
id, int) + OLD_TMWATHENA_OFFSET, BeingTypeId));
if (i == mMonsterInfos.end())
{
- logger->log("MonsterDB: Warning, unknown monster ID %d requested",
+ reportAlways("MonsterDB: Warning, unknown monster ID %d requested",
toInt(id, int));
return BeingInfo::unknown;
}
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index 6c63ee57f..cfde3495f 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -30,6 +30,7 @@
#include "resources/sprite/spritereference.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -88,7 +89,7 @@ void NPCDB::loadXmlFile(const std::string &fileName,
BeingInfo *currentInfo = nullptr;
if (id == BeingTypeId_zero)
{
- logger->log("NPC Database: NPC with missing ID in %s!",
+ reportAlways("NPC Database: NPC with missing ID in %s!",
paths.getStringValue("npcsFile").c_str());
continue;
}
@@ -172,7 +173,7 @@ BeingInfo *NPCDB::get(const BeingTypeId id)
if (i == mNPCInfos.end())
{
- logger->log("NPCDB: Warning, unknown NPC ID %d requested",
+ reportAlways("NPCDB: Warning, unknown NPC ID %d requested",
toInt(id, int));
return BeingInfo::unknown;
}
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 558a7e453..848721879 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -26,6 +26,7 @@
#include "resources/beingcommon.h"
#include "resources/npcdialoginfo.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "debug.h"
@@ -74,7 +75,7 @@ static void loadNpcDialogMenu(NpcDialogInfo *const dialog,
button->image = XML::getProperty(childNode, "image", "");
if (button->name.empty() && button->image.empty())
{
- logger->log("Error: npc button without name or image");
+ reportAlways("Error: npc button without name or image");
delete button;
continue;
}
@@ -89,7 +90,7 @@ static void loadNpcDialogMenu(NpcDialogInfo *const dialog,
const std::string image = XML::getProperty(childNode, "image", "");
if (image.empty())
{
- logger->log("Error: no image attribute found in image tag.");
+ reportAlways("Error: no image attribute found in image tag.");
continue;
}
NpcImageInfo *const imageInfo = new NpcImageInfo;
@@ -105,7 +106,7 @@ static void loadNpcDialogMenu(NpcDialogInfo *const dialog,
const std::string text = XML::getProperty(childNode, "text", "");
if (text.empty())
{
- logger->log("Error: no text attribute found in text tag.");
+ reportAlways("Error: no text attribute found in text tag.");
continue;
}
NpcTextInfo *const textInfo = new NpcTextInfo;
diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp
index 4a233d67b..1b7f97029 100644
--- a/src/resources/db/palettedb.cpp
+++ b/src/resources/db/palettedb.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "logger.h"
+#include "utils/checkutils.h"
#include "utils/files.h"
#include "resources/dye/dyecolor.h"
@@ -58,7 +59,7 @@ void PaletteDB::loadPalette()
}
if (*it != "GIMP Palette")
{
- logger->log("wrong GIMP palette file");
+ reportAlways("wrong GIMP palette file");
return;
}
++ it;
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 03791945b..b0ed0b544 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -30,6 +30,7 @@
#include "resources/sprite/spritereference.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -87,7 +88,7 @@ void PETDB::loadXmlFile(const std::string &fileName,
petNode, "id", -1), BeingTypeId);
if (id == BeingTypeId_negOne)
{
- logger->log("PET Database: PET with missing ID in %s!",
+ reportAlways("PET Database: PET with missing ID in %s!",
paths.getStringValue("petsFile").c_str());
continue;
}
@@ -200,7 +201,7 @@ BeingInfo *PETDB::get(const BeingTypeId id)
if (i == mPETInfos.end())
{
- logger->log("PETDB: Warning, unknown PET ID %d requested",
+ reportAlways("PETDB: Warning, unknown PET ID %d requested",
toInt(id, int));
return BeingInfo::unknown;
}
diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp
index 2444aa902..30f088331 100644
--- a/src/resources/db/skillunitdb.cpp
+++ b/src/resources/db/skillunitdb.cpp
@@ -30,6 +30,7 @@
#include "resources/sprite/spritereference.h"
+#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
@@ -86,7 +87,7 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName,
skillUnitNode, "id", -1), BeingTypeId);
if (id == BeingTypeId_negOne)
{
- logger->log("SkillUnitDb: skill unit with missing ID in %s!",
+ reportAlways("SkillUnitDb: skill unit with missing ID in %s!",
paths.getStringValue("skillUnitsFile").c_str());
continue;
}
@@ -150,7 +151,8 @@ BeingInfo *SkillUnitDb::get(const BeingTypeId id)
if (i == mSkillUnitInfos.end())
{
- logger->log("SkillUnitDb: Warning, unknown skill unit id %d requested",
+ reportAlways("SkillUnitDb: Warning, unknown skill unit id "
+ "%d requested",
toInt(id, int));
return BeingInfo::unknown;
}
diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp
index dbcf9226b..22916fb2e 100644
--- a/src/resources/db/statuseffectdb.cpp
+++ b/src/resources/db/statuseffectdb.cpp
@@ -29,6 +29,8 @@
#include "listeners/debugmessagelistener.h"
+#include "utils/checkutils.h"
+
#include "resources/beingcommon.h"
#include "debug.h"
@@ -62,12 +64,8 @@ StatusEffect *StatusEffectDB::getStatusEffect(const int index,
const std::map<int, StatusEffect *>::iterator it = effects.find(index);
if (it != effects.end())
return (*it).second;
- if (config.getBoolValue("unimplimentedLog"))
- {
- const std::string str = strprintf("Missing status effect: %d", index);
- logger->log(str);
- DebugMessageListener::distributeEvent(str);
- }
+ reportAlways("Missing status effect: %d",
+ index);
return nullptr;
}