summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 17:45:52 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 17:45:52 +0300
commit2d32dc27210d16102f9200de115f2c3f79a5cb22 (patch)
tree5aa84ebe6c5c1d708b14bee2bf0ce95df714fc1d /src/gui
parent7bdb50605562e47f1d6ae134881c09bd42293be5 (diff)
downloadmv-2d32dc27210d16102f9200de115f2c3f79a5cb22.tar.gz
mv-2d32dc27210d16102f9200de115f2c3f79a5cb22.tar.bz2
mv-2d32dc27210d16102f9200de115f2c3f79a5cb22.tar.xz
mv-2d32dc27210d16102f9200de115f2c3f79a5cb22.zip
Use BeingTypeId in Being for subtypeid.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp4
-rw-r--r--src/gui/windows/npcdialog.cpp2
-rw-r--r--src/gui/windows/questswindow.cpp16
-rw-r--r--src/gui/windows/questswindow.h4
5 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index 704f1a114..1dfd56c1a 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -326,7 +326,7 @@ void TargetDebugTab::logic()
_("Target Id:"), toInt(target->getId(), int)));
mTargetTypeLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
- _("Target type:"), target->getSubType()));
+ _("Target type:"), toInt(target->getSubType(), int)));
if (target->getLevel())
{
mTargetLevelLabel->setCaption(strprintf("%s %d",
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 917cc51fb..f37749756 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -124,7 +124,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
mPlayer(new Being(BeingId_zero,
ActorType::Player,
- static_cast<uint16_t>(0U),
+ BeingTypeId_zero,
nullptr)),
mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
"charcreate_selectedplayerbox.xml")),
@@ -652,7 +652,7 @@ void CharCreateDialog::updateLook()
{
mLook = 0;
}
- mPlayer->setSubtype(static_cast<uint16_t>(mRace),
+ mPlayer->setSubtype(fromInt(mRace, BeingTypeId),
static_cast<uint8_t>(mLook));
if (mRaceNameLabel)
{
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index c60cbd9b4..ebc716d0f 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -870,7 +870,7 @@ void NpcDialog::showAvatar(const BeingTypeId avatarId)
delete mAvatarBeing;
mAvatarBeing = new Being(BeingId_zero,
ActorType::Avatar,
- toInt(avatarId, uint16_t),
+ avatarId,
nullptr);
mPlayerBox->setPlayer(mAvatarBeing);
if (!mAvatarBeing->empty())
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 9279220ac..608d84954 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -245,12 +245,12 @@ void QuestsWindow::loadEffect(const int var, const XmlNodePtr node)
{
QuestEffect *const effect = new QuestEffect;
effect->map = XML::getProperty(node, "map", "");
- effect->id = XML::getProperty(node, "npc", -1);
+ effect->id = fromInt(XML::getProperty(node, "npc", -1), BeingTypeId);
effect->effectId = XML::getProperty(node, "effect", -1);
const std::string values = XML::getProperty(node, "value", "");
splitToIntSet(effect->values, values, ',');
- if (effect->map.empty() || effect->id == -1
+ if (effect->map.empty() || effect->id == BeingTypeId_negOne
|| effect->effectId == -1 || values.empty())
{
delete effect;
@@ -465,13 +465,13 @@ void QuestsWindow::updateEffects()
if (!actorManager)
return;
- std::set<int> removeEffects;
- std::map<int, int> addEffects;
+ std::set<BeingTypeId> removeEffects;
+ std::map<BeingTypeId, int> addEffects;
// for old effects
FOR_EACH (NpcQuestEffectMapCIter, it, oldNpc)
{
- const int id = (*it).first;
+ const BeingTypeId id = (*it).first;
const QuestEffect *const effect = (*it).second;
const NpcQuestEffectMapCIter itNew = mNpcEffects.find(id);
@@ -493,7 +493,7 @@ void QuestsWindow::updateEffects()
// for new effects
FOR_EACH (NpcQuestEffectMapCIter, it, mNpcEffects)
{
- const int id = (*it).first;
+ const BeingTypeId id = (*it).first;
const QuestEffect *const effect = (*it).second;
const NpcQuestEffectMapCIter itNew = oldNpc.find(id);
@@ -509,8 +509,8 @@ void QuestsWindow::addEffect(Being *const being)
{
if (!being)
return;
- const int id = being->getSubType();
- const std::map<int, const QuestEffect*>::const_iterator
+ const BeingTypeId id = being->getSubType();
+ const std::map<BeingTypeId, const QuestEffect*>::const_iterator
it = mNpcEffects.find(id);
if (it != mNpcEffects.end())
{
diff --git a/src/gui/windows/questswindow.h b/src/gui/windows/questswindow.h
index 927b32540..0430569a3 100644
--- a/src/gui/windows/questswindow.h
+++ b/src/gui/windows/questswindow.h
@@ -23,6 +23,8 @@
#include "localconsts.h"
+#include "enums/simpletypes/beingtypeid.h"
+
#include "gui/widgets/window.h"
#include "utils/xml.h"
@@ -41,7 +43,7 @@ class QuestsModel;
struct QuestEffect;
struct QuestItem;
-typedef std::map<int, const QuestEffect*> NpcQuestEffectMap;
+typedef std::map<BeingTypeId, const QuestEffect*> NpcQuestEffectMap;
typedef NpcQuestEffectMap::const_iterator NpcQuestEffectMapCIter;
class QuestsWindow final : public Window,