summaryrefslogtreecommitdiff
path: root/src/actions/actions.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/actions/actions.cpp
parent01773c71a4698c6f01fe70d864f922bda65506cb (diff)
downloadmanaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz
manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip
Add strong typed int type BeingId.
Diffstat (limited to 'src/actions/actions.cpp')
-rw-r--r--src/actions/actions.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index a666d01a2..0b8e8aedc 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -480,7 +480,8 @@ impHandler(heal)
const Being *being = nullptr;
if (args[0] == ':')
{
- being = actorManager->findBeing(atoi(args.substr(1).c_str()));
+ being = actorManager->findBeing(fromInt(atoi(
+ args.substr(1).c_str()), BeingId));
if (being && being->getType() == ActorType::Monster)
being = nullptr;
}
@@ -588,7 +589,8 @@ impHandler(pickup)
}
else
{
- FloorItem *const item = actorManager->findItem(atoi(args.c_str()));
+ FloorItem *const item = actorManager->findItem(fromInt(
+ atoi(args.c_str()), BeingId));
if (item)
localPlayer->pickUp(item);
}
@@ -758,7 +760,8 @@ impHandler(attack)
}
else
{
- target = actorManager->findBeing(atoi(args.substr(1).c_str()));
+ target = actorManager->findBeing(fromInt(atoi(
+ args.substr(1).c_str()), BeingId));
if (target && target->getType() != ActorType::Monster)
target = nullptr;
}
@@ -789,7 +792,8 @@ impHandler(targetAttack)
}
else
{
- target = actorManager->findBeing(atoi(args.substr(1).c_str()));
+ target = actorManager->findBeing(fromInt(atoi(
+ args.substr(1).c_str()), BeingId));
if (target && target->getType() != ActorType::Monster)
target = nullptr;
}
@@ -1599,9 +1603,14 @@ impHandler(kick)
if (!args.empty())
{
if (args[0] != ':')
+ {
target = actorManager->findNearestByName(args);
+ }
else
- target = actorManager->findBeing(atoi(args.substr(1).c_str()));
+ {
+ target = actorManager->findBeing(fromInt(atoi(
+ args.substr(1).c_str()), BeingId));
+ }
}
if (!target)
target = localPlayer->getTarget();