summaryrefslogtreecommitdiff
path: root/src/gui/windows/npcdialog.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/gui/windows/npcdialog.cpp
parent01773c71a4698c6f01fe70d864f922bda65506cb (diff)
downloadmv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz
mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2
mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz
mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip
Add strong typed int type BeingId.
Diffstat (limited to 'src/gui/windows/npcdialog.cpp')
-rw-r--r--src/gui/windows/npcdialog.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 2c7c27f57..c8ccd482e 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -81,7 +81,7 @@ NpcDialogs NpcDialog::mNpcDialogs;
typedef std::vector<Image *>::iterator ImageVectorIter;
-NpcDialog::NpcDialog(const int npcId) :
+NpcDialog::NpcDialog(const BeingId npcId) :
// TRANSLATORS: npc dialog name
Window(_("NPC"), Modal_false, nullptr, "npc.xml"),
ActionListener(),
@@ -204,7 +204,8 @@ void NpcDialog::postInit()
const Being *const being = actorManager->findBeing(mNpcId);
if (being)
{
- showAvatar(NPCDB::getAvatarFor(being->getSubType()));
+ showAvatar(NPCDB::getAvatarFor(fromInt(
+ being->getSubType(), BeingId)));
setCaption(being->getName());
}
}
@@ -861,13 +862,16 @@ void NpcDialog::restoreCamera()
mCameraMode = -1;
}
-void NpcDialog::showAvatar(const uint16_t avatarId)
+void NpcDialog::showAvatar(const BeingId avatarId)
{
- const bool needShow = (avatarId != 0);
+ const bool needShow = (avatarId != BeingId_zero);
if (needShow)
{
delete mAvatarBeing;
- mAvatarBeing = new Being(0, ActorType::Avatar, avatarId, nullptr);
+ mAvatarBeing = new Being(BeingId_zero,
+ ActorType::Avatar,
+ toInt(avatarId, uint16_t),
+ nullptr);
mPlayerBox->setPlayer(mAvatarBeing);
if (!mAvatarBeing->empty())
{
@@ -973,7 +977,8 @@ void NpcDialog::mousePressed(MouseEvent &event)
}
}
-void NpcDialog::copyToClipboard(const int npcId, const int x, const int y)
+void NpcDialog::copyToClipboard(const BeingId npcId,
+ const int x, const int y)
{
NpcDialogs::iterator it = mNpcDialogs.find(npcId);
if (it != mNpcDialogs.end())