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/actions | |
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/actions')
-rw-r--r-- | src/actions/actions.cpp | 19 | ||||
-rw-r--r-- | src/actions/commands.cpp | 7 | ||||
-rw-r--r-- | src/actions/pets.cpp | 4 |
3 files changed, 20 insertions, 10 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(); diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 9ec4ca28f..0bcca016c 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -254,7 +254,7 @@ impHandler(chatNuke) if (!being) return true; - actorManager->addBlock(static_cast<uint32_t>(being->getId())); + actorManager->addBlock(being->getId()); actorManager->destroy(being); return true; } @@ -268,7 +268,7 @@ impHandler(chatAdd) return true; const int id = atoi(event.args.c_str()); - if (!id) + if (id == 0) return true; Inventory *const inv = PlayerInfo::getInventory(); @@ -286,7 +286,8 @@ impHandler(chatAdd) return true; } - const FloorItem *const floorItem = actorManager->findItem(id); + const FloorItem *const floorItem = actorManager->findItem( + fromInt(id, BeingId)); if (floorItem) { diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp index a31e8aadc..a6c9a24df 100644 --- a/src/actions/pets.cpp +++ b/src/actions/pets.cpp @@ -66,8 +66,8 @@ static const Being *getPet() } #endif #ifdef EATHENA_SUPPORT - const int id = PlayerInfo::getPetBeingId(); - if (!id) + const BeingId id = PlayerInfo::getPetBeingId(); + if (id == BeingId_zero) return nullptr; return actorManager->findBeing(id); #else |