diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
commit | 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (patch) | |
tree | 6259593b8436178ad8d981a96a8fd71eab9e04cc /src/being/localplayer.cpp | |
parent | 01773c71a4698c6f01fe70d864f922bda65506cb (diff) | |
download | manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2 manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip |
Add strong typed int type BeingId.
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index efb483f6a..2bc2d928b 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -111,7 +111,8 @@ extern int weightNoticeTime; extern MiniStatusWindow *miniStatusWindow; extern SkillDialog *skillDialog; -LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : +LocalPlayer::LocalPlayer(const BeingId id, + const uint16_t subtype) : Being(id, ActorType::Player, subtype, nullptr), AttributeListener(), PlayerDeathListener(), @@ -139,7 +140,7 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : mActivityTime(0), mNavigateX(0), mNavigateY(0), - mNavigateId(0), + mNavigateId(BeingId_zero), mCrossX(0), mCrossY(0), mOldX(0), @@ -780,7 +781,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, if (!dontChangeEquipment) changeEquipmentBeforeAttack(target); - const int targetId = target->getId(); + const BeingId targetId = target->getId(); playerHandler->attack(targetId, mServerAttack); #ifdef EATHENA_SUPPORT PlayerInfo::updateAttackAi(targetId, mServerAttack); @@ -813,13 +814,15 @@ void LocalPlayer::untarget() setTarget(nullptr); } -void LocalPlayer::pickedUp(const ItemInfo &itemInfo, const int amount, - const unsigned char color, const int floorItemId, +void LocalPlayer::pickedUp(const ItemInfo &itemInfo, + const int amount, + const unsigned char color, + const BeingId floorItemId, const Pickup::Type fail) { if (fail != Pickup::OKAY) { - if (actorManager && floorItemId) + if (actorManager && floorItemId != BeingId_zero) { FloorItem *const item = actorManager->findItem(floorItemId); if (item) @@ -1942,7 +1945,7 @@ bool LocalPlayer::navigateTo(const int x, const int y) mOldTileY = mY; mNavigateX = x; mNavigateY = y; - mNavigateId = 0; + mNavigateId = BeingId_zero; mNavigatePath = mMap->findPath( static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, @@ -1966,7 +1969,7 @@ void LocalPlayer::navigateClean() mOldTileY = 0; mNavigateX = 0; mNavigateY = 0; - mNavigateId = 0; + mNavigateId = BeingId_zero; mNavigatePath.clear(); @@ -2024,7 +2027,7 @@ void LocalPlayer::updateCoords() / mapTileSize; const int y = static_cast<int>(playerPos.y - mapTileSize) / mapTileSize; - if (mNavigateId) + if (mNavigateId != BeingId_zero) { if (!actorManager) { |