summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 16:19:21 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 16:19:21 +0300
commit7bdb50605562e47f1d6ae134881c09bd42293be5 (patch)
tree935228722e4eb48f5856abec53be1ec985a0b9d6 /src/resources
parent0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (diff)
downloadmv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.gz
mv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.bz2
mv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.xz
mv-7bdb50605562e47f1d6ae134881c09bd42293be5.zip
Add strong typed int type BeingTypeId.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h10
-rw-r--r--src/resources/db/avatardb.cpp6
-rw-r--r--src/resources/db/avatardb.h4
-rw-r--r--src/resources/db/homunculusdb.cpp8
-rw-r--r--src/resources/db/homunculusdb.h4
-rw-r--r--src/resources/db/mercenarydb.cpp8
-rw-r--r--src/resources/db/mercenarydb.h4
-rw-r--r--src/resources/db/monsterdb.cpp10
-rw-r--r--src/resources/db/monsterdb.h4
-rw-r--r--src/resources/db/npcdb.cpp14
-rw-r--r--src/resources/db/npcdb.h6
-rw-r--r--src/resources/db/petdb.cpp8
-rw-r--r--src/resources/db/petdb.h4
14 files changed, 46 insertions, 46 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 87bb4e33e..28f421a2e 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -69,7 +69,7 @@ BeingInfo::BeingInfo() :
mMaxHP(0),
mSortOffsetY(0),
mDeadSortOffsetY(31),
- mAvatarId(BeingId_zero),
+ mAvatarId(BeingTypeId_zero),
mWidth(0),
mHeight(0),
mStartFollowDist(3),
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index a30c150af..33d1472c3 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -25,7 +25,7 @@
#include "enums/being/targetcursorsize.h"
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include "resources/beingmenuitem.h"
#include "resources/cursor.h"
@@ -191,10 +191,10 @@ class BeingInfo final
void setDeadSortOffsetY(const int n)
{ mDeadSortOffsetY = n; }
- BeingId getAvatarId() const A_WARN_UNUSED
+ BeingTypeId getAvatarId() const A_WARN_UNUSED
{ return mAvatarId; }
- void setAvatarId(const BeingId id)
+ void setAvatarId(const BeingTypeId id)
{ mAvatarId = id; }
int getWidth() const A_WARN_UNUSED
@@ -343,7 +343,7 @@ class BeingInfo final
int mMaxHP;
int mSortOffsetY;
int mDeadSortOffsetY;
- BeingId mAvatarId;
+ BeingTypeId mAvatarId;
int mWidth;
int mHeight;
int mStartFollowDist;
@@ -367,7 +367,7 @@ class BeingInfo final
bool mTargetSelection;
};
-typedef std::map<BeingId, BeingInfo*> BeingInfos;
+typedef std::map<BeingTypeId, BeingInfo*> BeingInfos;
typedef BeingInfos::iterator BeingInfoIterator;
#endif // RESOURCES_BEINGINFO_H
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 5f1ac6da7..358cfea48 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -76,8 +76,8 @@ void AvatarDB::loadXmlFile(const std::string &fileName)
if (!xmlNameEqual(avatarNode, "avatar"))
continue;
- const BeingId id = fromInt(XML::getProperty(
- avatarNode, "id", 0), BeingId);
+ const BeingTypeId id = fromInt(XML::getProperty(
+ avatarNode, "id", 0), BeingTypeId);
BeingInfo *currentInfo = nullptr;
if (mAvatarInfos.find(id) != mAvatarInfos.end())
currentInfo = mAvatarInfos[id];
@@ -132,7 +132,7 @@ void AvatarDB::unload()
mLoaded = false;
}
-BeingInfo *AvatarDB::get(const BeingId id)
+BeingInfo *AvatarDB::get(const BeingTypeId id)
{
BeingInfoIterator i = mAvatarInfos.find(id);
if (i == mAvatarInfos.end())
diff --git a/src/resources/db/avatardb.h b/src/resources/db/avatardb.h
index 9e8cecd07..db2df2672 100644
--- a/src/resources/db/avatardb.h
+++ b/src/resources/db/avatardb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_AVATARDB_H
#define RESOURCES_DB_AVATARDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include <string>
@@ -37,7 +37,7 @@ namespace AvatarDB
void unload();
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
void loadXmlFile(const std::string &fileName);
} // namespace AvatarDB
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp
index 41c863a6f..697b74431 100644
--- a/src/resources/db/homunculusdb.cpp
+++ b/src/resources/db/homunculusdb.cpp
@@ -85,11 +85,11 @@ void HomunculusDB::loadXmlFile(const std::string &fileName)
const int id = XML::getProperty(homunculusNode, "id", 0);
BeingInfo *currentInfo = nullptr;
- if (mHomunculusInfos.find(fromInt(id + offset, BeingId))
+ if (mHomunculusInfos.find(fromInt(id + offset, BeingTypeId))
!= mHomunculusInfos.end())
{
logger->log("HomunculusDB: Redefinition of homunculus ID %d", id);
- currentInfo = mHomunculusInfos[fromInt(id + offset, BeingId)];
+ currentInfo = mHomunculusInfos[fromInt(id + offset, BeingTypeId)];
}
if (!currentInfo)
currentInfo = new BeingInfo;
@@ -134,7 +134,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName)
}
currentInfo->setDisplay(display);
- mHomunculusInfos[fromInt(id + offset, BeingId)] = currentInfo;
+ mHomunculusInfos[fromInt(id + offset, BeingTypeId)] = currentInfo;
}
}
@@ -147,7 +147,7 @@ void HomunculusDB::unload()
}
-BeingInfo *HomunculusDB::get(const BeingId id)
+BeingInfo *HomunculusDB::get(const BeingTypeId id)
{
BeingInfoIterator i = mHomunculusInfos.find(id);
diff --git a/src/resources/db/homunculusdb.h b/src/resources/db/homunculusdb.h
index 1d879cf9f..6ddcfc5da 100644
--- a/src/resources/db/homunculusdb.h
+++ b/src/resources/db/homunculusdb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_HOMUNCULUSDB_H
#define RESOURCES_DB_HOMUNCULUSDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include "localconsts.h"
@@ -42,7 +42,7 @@ namespace HomunculusDB
void loadXmlFile(const std::string &fileName);
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
} // namespace HomunculusDB
#endif // RESOURCES_DB_HOMUNCULUSDB_H
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index 13dfbbd45..a6950e9fb 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -85,11 +85,11 @@ void MercenaryDB::loadXmlFile(const std::string &fileName)
const int id = XML::getProperty(mercenaryNode, "id", 0);
BeingInfo *currentInfo = nullptr;
- if (mMercenaryInfos.find(fromInt(id + offset, BeingId))
+ if (mMercenaryInfos.find(fromInt(id + offset, BeingTypeId))
!= mMercenaryInfos.end())
{
logger->log("MercenaryDB: Redefinition of mercenary ID %d", id);
- currentInfo = mMercenaryInfos[fromInt(id + offset, BeingId)];
+ currentInfo = mMercenaryInfos[fromInt(id + offset, BeingTypeId)];
}
if (!currentInfo)
currentInfo = new BeingInfo;
@@ -133,7 +133,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName)
}
currentInfo->setDisplay(display);
- mMercenaryInfos[fromInt(id + offset, BeingId)] = currentInfo;
+ mMercenaryInfos[fromInt(id + offset, BeingTypeId)] = currentInfo;
}
}
@@ -146,7 +146,7 @@ void MercenaryDB::unload()
}
-BeingInfo *MercenaryDB::get(const BeingId id)
+BeingInfo *MercenaryDB::get(const BeingTypeId id)
{
BeingInfoIterator i = mMercenaryInfos.find(id);
diff --git a/src/resources/db/mercenarydb.h b/src/resources/db/mercenarydb.h
index a642b1a7c..bfc41733d 100644
--- a/src/resources/db/mercenarydb.h
+++ b/src/resources/db/mercenarydb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_MERCENARYDB_H
#define RESOURCES_DB_MERCENARYDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include "localconsts.h"
@@ -42,7 +42,7 @@ namespace MercenaryDB
void loadXmlFile(const std::string &fileName);
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
} // namespace MercenaryDB
#endif // RESOURCES_DB_MERCENARYDB_H
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index de72f487f..2e2256b58 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -88,11 +88,11 @@ void MonsterDB::loadXmlFile(const std::string &fileName)
const int id = XML::getProperty(monsterNode, "id", 0);
BeingInfo *currentInfo = nullptr;
- if (mMonsterInfos.find(fromInt(id + offset, BeingId))
+ if (mMonsterInfos.find(fromInt(id + offset, BeingTypeId))
!= mMonsterInfos.end())
{
logger->log("MonsterDB: Redefinition of monster ID %d", id);
- currentInfo = mMonsterInfos[fromInt(id + offset, BeingId)];
+ currentInfo = mMonsterInfos[fromInt(id + offset, BeingTypeId)];
}
if (!currentInfo)
currentInfo = new BeingInfo;
@@ -140,7 +140,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName)
}
currentInfo->setDisplay(display);
- mMonsterInfos[fromInt(id + offset, BeingId)] = currentInfo;
+ mMonsterInfos[fromInt(id + offset, BeingTypeId)] = currentInfo;
}
}
@@ -153,14 +153,14 @@ void MonsterDB::unload()
}
-BeingInfo *MonsterDB::get(const BeingId id)
+BeingInfo *MonsterDB::get(const BeingTypeId id)
{
BeingInfoIterator i = mMonsterInfos.find(id);
if (i == mMonsterInfos.end())
{
i = mMonsterInfos.find(fromInt(toInt(
- id, int) + OLD_TMWATHENA_OFFSET, BeingId));
+ id, int) + OLD_TMWATHENA_OFFSET, BeingTypeId));
if (i == mMonsterInfos.end())
{
logger->log("MonsterDB: Warning, unknown monster ID %d requested",
diff --git a/src/resources/db/monsterdb.h b/src/resources/db/monsterdb.h
index c8ef85a5a..09d70c80d 100644
--- a/src/resources/db/monsterdb.h
+++ b/src/resources/db/monsterdb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_MONSTERDB_H
#define RESOURCES_DB_MONSTERDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include "localconsts.h"
@@ -42,7 +42,7 @@ namespace MonsterDB
void loadXmlFile(const std::string &fileName);
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
} // namespace MonsterDB
#endif // RESOURCES_DB_MONSTERDB_H
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index 8be92f186..8b47d33b4 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -81,10 +81,10 @@ void NPCDB::loadXmlFile(const std::string &fileName)
if (!xmlNameEqual(npcNode, "npc"))
continue;
- const BeingId id = fromInt(XML::getProperty(
- npcNode, "id", 0), BeingId);
+ const BeingTypeId id = fromInt(XML::getProperty(
+ npcNode, "id", 0), BeingTypeId);
BeingInfo *currentInfo = nullptr;
- if (id == BeingId_zero)
+ if (id == BeingTypeId_zero)
{
logger->log("NPC Database: NPC with missing ID in %s!",
paths.getStringValue("npcsFile").c_str());
@@ -107,7 +107,7 @@ void NPCDB::loadXmlFile(const std::string &fileName)
"deadSortOffsetY", 31));
currentInfo->setAvatarId(fromInt(XML::getProperty(
- npcNode, "avatar", 0), BeingId));
+ npcNode, "avatar", 0), BeingTypeId));
SpriteDisplay display;
for_each_xml_child_node(spriteNode, npcNode)
@@ -160,7 +160,7 @@ void NPCDB::unload()
mLoaded = false;
}
-BeingInfo *NPCDB::get(const BeingId id)
+BeingInfo *NPCDB::get(const BeingTypeId id)
{
const BeingInfoIterator i = mNPCInfos.find(id);
@@ -176,10 +176,10 @@ BeingInfo *NPCDB::get(const BeingId id)
}
}
-BeingId NPCDB::getAvatarFor(const BeingId id)
+BeingTypeId NPCDB::getAvatarFor(const BeingTypeId id)
{
const BeingInfo *const info = get(id);
if (!info)
- return BeingId_zero;
+ return BeingTypeId_zero;
return info->getAvatarId();
}
diff --git a/src/resources/db/npcdb.h b/src/resources/db/npcdb.h
index 283671fba..90b50b1cc 100644
--- a/src/resources/db/npcdb.h
+++ b/src/resources/db/npcdb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_NPCDB_H
#define RESOURCES_DB_NPCDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include <string>
@@ -40,9 +40,9 @@ namespace NPCDB
void unload();
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
- BeingId getAvatarFor(const BeingId id);
+ BeingTypeId getAvatarFor(const BeingTypeId id);
void loadXmlFile(const std::string &fileName);
} // namespace NPCDB
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 242313d14..f219a6889 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -79,9 +79,9 @@ void PETDB::loadXmlFile(const std::string &fileName)
continue;
}
- const BeingId id = fromInt(XML::getProperty(
- petNode, "id", -1), BeingId);
- if (id == BeingId_negOne)
+ const BeingTypeId id = fromInt(XML::getProperty(
+ petNode, "id", -1), BeingTypeId);
+ if (id == BeingTypeId_negOne)
{
logger->log("PET Database: PET with missing ID in %s!",
paths.getStringValue("petsFile").c_str());
@@ -186,7 +186,7 @@ void PETDB::unload()
mLoaded = false;
}
-BeingInfo *PETDB::get(const BeingId id)
+BeingInfo *PETDB::get(const BeingTypeId id)
{
const BeingInfoIterator i = mPETInfos.find(id);
diff --git a/src/resources/db/petdb.h b/src/resources/db/petdb.h
index 893a9dcde..ebe1fce5d 100644
--- a/src/resources/db/petdb.h
+++ b/src/resources/db/petdb.h
@@ -23,7 +23,7 @@
#ifndef RESOURCES_DB_PETDB_H
#define RESOURCES_DB_PETDB_H
-#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/beingtypeid.h"
#include <string>
@@ -39,7 +39,7 @@ namespace PETDB
void unload();
- BeingInfo *get(const BeingId id) A_WARN_UNUSED;
+ BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED;
} // namespace PETDB
#endif // RESOURCES_DB_PETDB_H