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/actions/actions.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/actions/actions.cpp') 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(); -- cgit v1.2.3-60-g2f50