diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 16:19:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 16:19:21 +0300 |
commit | 7bdb50605562e47f1d6ae134881c09bd42293be5 (patch) | |
tree | 935228722e4eb48f5856abec53be1ec985a0b9d6 | |
parent | 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (diff) | |
download | mv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.gz mv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.bz2 mv-7bdb50605562e47f1d6ae134881c09bd42293be5.tar.xz mv-7bdb50605562e47f1d6ae134881c09bd42293be5.zip |
Add strong typed int type BeingTypeId.
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/being/being.cpp | 14 | ||||
-rw-r--r-- | src/enums/simpletypes/beingid.h | 7 | ||||
-rw-r--r-- | src/enums/simpletypes/beingtypeid.h | 29 | ||||
-rw-r--r-- | src/enums/simpletypes/intdefines.h | 2 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.h | 3 | ||||
-rw-r--r-- | src/net/ea/npchandler.cpp | 2 | ||||
-rw-r--r-- | src/resources/beinginfo.cpp | 2 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 10 | ||||
-rw-r--r-- | src/resources/db/avatardb.cpp | 6 | ||||
-rw-r--r-- | src/resources/db/avatardb.h | 4 | ||||
-rw-r--r-- | src/resources/db/homunculusdb.cpp | 8 | ||||
-rw-r--r-- | src/resources/db/homunculusdb.h | 4 | ||||
-rw-r--r-- | src/resources/db/mercenarydb.cpp | 8 | ||||
-rw-r--r-- | src/resources/db/mercenarydb.h | 4 | ||||
-rw-r--r-- | src/resources/db/monsterdb.cpp | 10 | ||||
-rw-r--r-- | src/resources/db/monsterdb.h | 4 | ||||
-rw-r--r-- | src/resources/db/npcdb.cpp | 14 | ||||
-rw-r--r-- | src/resources/db/npcdb.h | 6 | ||||
-rw-r--r-- | src/resources/db/petdb.cpp | 8 | ||||
-rw-r--r-- | src/resources/db/petdb.h | 4 |
24 files changed, 95 insertions, 65 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 472bbac8a..d2a925e6b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1058,6 +1058,7 @@ SET(SRCS enums/simpletypes/allowsort.h enums/simpletypes/allplayers.h enums/simpletypes/beingid.h + enums/simpletypes/beingtypeid.h enums/simpletypes/booldefines.h enums/simpletypes/damaged.h enums/simpletypes/enable.h diff --git a/src/Makefile.am b/src/Makefile.am index 2fe46a3db..374382f58 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1187,6 +1187,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ enums/simpletypes/allowsort.h \ enums/simpletypes/allplayers.h \ enums/simpletypes/beingid.h \ + enums/simpletypes/beingtypeid.h \ enums/simpletypes/booldefines.h \ enums/simpletypes/damaged.h \ enums/simpletypes/enable.h \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 6c3962e7b..12209df81 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -333,7 +333,7 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) if (mType == ActorType::Monster) { - mInfo = MonsterDB::get(fromInt(mSubType, BeingId)); + mInfo = MonsterDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) { setName(mInfo->getName()); @@ -347,7 +347,7 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) #ifdef EATHENA_SUPPORT if (mType == ActorType::Pet) { - mInfo = PETDB::get(fromInt(mSubType, BeingId)); + mInfo = PETDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) { setName(mInfo->getName()); @@ -360,7 +360,7 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) } else if (mType == ActorType::Mercenary) { - mInfo = MercenaryDB::get(fromInt(mSubType, BeingId)); + mInfo = MercenaryDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) { setName(mInfo->getName()); @@ -373,7 +373,7 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) } if (mType == ActorType::Homunculus) { - mInfo = HomunculusDB::get(fromInt(mSubType, BeingId)); + mInfo = HomunculusDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) { setName(mInfo->getName()); @@ -387,7 +387,7 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) #endif else if (mType == ActorType::Npc) { - mInfo = NPCDB::get(fromInt(mSubType, BeingId)); + mInfo = NPCDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) { setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false); @@ -396,13 +396,13 @@ void Being::setSubtype(const uint16_t subtype, const uint16_t look) } else if (mType == ActorType::Avatar) { - mInfo = AvatarDB::get(fromInt(mSubType, BeingId)); + mInfo = AvatarDB::get(fromInt(mSubType, BeingTypeId)); if (mInfo) setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false); } else if (mType == ActorType::LocalPet) { - mInfo = PETDB::get(mId); + mInfo = PETDB::get(fromInt(mId, BeingTypeId)); if (mInfo) { setName(mInfo->getName()); diff --git a/src/enums/simpletypes/beingid.h b/src/enums/simpletypes/beingid.h index dddd83932..ffc9eb6f6 100644 --- a/src/enums/simpletypes/beingid.h +++ b/src/enums/simpletypes/beingid.h @@ -24,11 +24,6 @@ #include "enums/simpletypes/intdefines.h" defIntEnum(BeingId, int); - -#ifdef ADVGCC -const BeingId BeingId_negOne = static_cast<BeingId>(-1); -#else -const BeingId BeingId_negOne = -1; -#endif +defIntEnumNeg(BeingId); #endif // ENUMS_SIMPLETYPES_BEINGID_H diff --git a/src/enums/simpletypes/beingtypeid.h b/src/enums/simpletypes/beingtypeid.h new file mode 100644 index 000000000..a36e7058b --- /dev/null +++ b/src/enums/simpletypes/beingtypeid.h @@ -0,0 +1,29 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ENUMS_SIMPLETYPES_BEINGTYPEID_H +#define ENUMS_SIMPLETYPES_BEINGTYPEID_H + +#include "enums/simpletypes/intdefines.h" + +defIntEnum(BeingTypeId, int); +defIntEnumNeg(BeingTypeId); + +#endif // ENUMS_SIMPLETYPES_BEINGTYPEID_H diff --git a/src/enums/simpletypes/intdefines.h b/src/enums/simpletypes/intdefines.h index 765318cdc..984e9d411 100644 --- a/src/enums/simpletypes/intdefines.h +++ b/src/enums/simpletypes/intdefines.h @@ -33,6 +33,7 @@ #define fromInt(val, name) static_cast<name>(val) #define toInt(val, name) static_cast<name>(val) +#define defIntEnumNeg(name) const name name##_negOne = static_cast<name>(-1) #else // ADVGCC @@ -41,6 +42,7 @@ const name name##_zero = 0 #define fromInt(val, name) (val) #define toInt(val, name) (val) +#define defIntEnumNeg(name) const name name##_negOne = -1 #endif // ADVGCC diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index ee34d4ff7..59c1cc469 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -389,7 +389,8 @@ bool PopupMenu::addBeingMenu() if (!being) return false; - BeingInfo *const info = NPCDB::get(fromInt(being->getSubType(), BeingId)); + BeingInfo *const info = NPCDB::get(fromInt( + being->getSubType(), BeingTypeId)); if (!info) return false; diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index c8ccd482e..c60cbd9b4 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -205,7 +205,7 @@ void NpcDialog::postInit() if (being) { showAvatar(NPCDB::getAvatarFor(fromInt( - being->getSubType(), BeingId))); + being->getSubType(), BeingTypeId))); setCaption(being->getName()); } } @@ -862,9 +862,9 @@ void NpcDialog::restoreCamera() mCameraMode = -1; } -void NpcDialog::showAvatar(const BeingId avatarId) +void NpcDialog::showAvatar(const BeingTypeId avatarId) { - const bool needShow = (avatarId != BeingId_zero); + const bool needShow = (avatarId != BeingTypeId_zero); if (needShow) { delete mAvatarBeing; diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 378bbd5e9..5d6786255 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -24,6 +24,7 @@ #define GUI_WINDOWS_NPCDIALOG_H #include "enums/simpletypes/beingid.h" +#include "enums/simpletypes/beingtypeid.h" #include "enums/simpletypes/visible.h" #include "gui/models/extendedlistmodel.h" @@ -197,7 +198,7 @@ class NpcDialog final : public Window, void refocus(); - void showAvatar(const BeingId avatarId); + void showAvatar(const BeingTypeId avatarId); void setAvatarDirection(const uint8_t direction); diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index bfa3c3f81..878a51552 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -165,7 +165,7 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg) case 6: // show avatar if (mDialog) { - mDialog->showAvatar(id); + mDialog->showAvatar(fromInt(id, BeingTypeId)); } break; case 7: // set avatar direction 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 |