From 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 May 2015 14:30:20 +0300 Subject: Add strong typed int type BeingId. --- src/gui/windows/npcdialog.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/gui/windows/npcdialog.cpp') 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::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()) -- cgit v1.2.3-70-g09d2