summaryrefslogtreecommitdiff
path: root/src/resources/db/mercenarydb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 14:30:20 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 14:30:20 +0300
commit0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (patch)
tree6259593b8436178ad8d981a96a8fd71eab9e04cc /src/resources/db/mercenarydb.cpp
parent01773c71a4698c6f01fe70d864f922bda65506cb (diff)
downloadmanaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip
Add strong typed int type BeingId.
Diffstat (limited to 'src/resources/db/mercenarydb.cpp')
-rw-r--r--src/resources/db/mercenarydb.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index a101bc891..13dfbbd45 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -85,10 +85,11 @@ void MercenaryDB::loadXmlFile(const std::string &fileName)
const int id = XML::getProperty(mercenaryNode, "id", 0);
BeingInfo *currentInfo = nullptr;
- if (mMercenaryInfos.find(id + offset) != mMercenaryInfos.end())
+ if (mMercenaryInfos.find(fromInt(id + offset, BeingId))
+ != mMercenaryInfos.end())
{
logger->log("MercenaryDB: Redefinition of mercenary ID %d", id);
- currentInfo = mMercenaryInfos[id + offset];
+ currentInfo = mMercenaryInfos[fromInt(id + offset, BeingId)];
}
if (!currentInfo)
currentInfo = new BeingInfo;
@@ -132,7 +133,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName)
}
currentInfo->setDisplay(display);
- mMercenaryInfos[id + offset] = currentInfo;
+ mMercenaryInfos[fromInt(id + offset, BeingId)] = currentInfo;
}
}
@@ -145,7 +146,7 @@ void MercenaryDB::unload()
}
-BeingInfo *MercenaryDB::get(const int id)
+BeingInfo *MercenaryDB::get(const BeingId id)
{
BeingInfoIterator i = mMercenaryInfos.find(id);
@@ -156,7 +157,7 @@ BeingInfo *MercenaryDB::get(const int id)
{
logger->log("MercenaryDB: Warning, unknown mercenary ID "
"%d requested",
- id);
+ toInt(id, int));
return BeingInfo::unknown;
}
else