diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-03 20:03:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-03 20:03:30 +0300 |
commit | abeecf1255d28a7870aef9f70dc3353d9b5f4f2d (patch) | |
tree | 975878d832cb3b2249684569f181c519c67566a3 /src/actormanager.cpp | |
parent | edb279bdc22d94a88aabdd994bed5dd2b1c5659e (diff) | |
download | plus-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.gz plus-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.bz2 plus-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.xz plus-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.zip |
Replace some ifs to switches.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r-- | src/actormanager.cpp | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index befd952e6..b557f3e36 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -276,31 +276,41 @@ Being *ActorManager::createBeing(const BeingId id, mActorsIdMap[being->getId()] = being; - if (type == ActorType::Player - || type == ActorType::Mercenary - || type == ActorType::Pet - || type == ActorType::Homunculus - || type == ActorType::Npc) + switch (type) { - being->updateFromCache(); - if (beingHandler) - beingHandler->requestNameById(id); - if (localPlayer) - localPlayer->checkNewName(being); - } - else if (type == ActorType::Monster) - { - if (serverFeatures && serverFeatures->haveMonsterName()) - beingHandler->requestNameById(id); - } - else if (type == ActorType::Portal) - { - if (beingHandler && - serverFeatures && - serverFeatures->haveServerWarpNames()) - { - beingHandler->requestNameById(id); - } + case ActorType::Player: + case ActorType::Mercenary: + case ActorType::Pet: + case ActorType::Homunculus: + case ActorType::Npc: + being->updateFromCache(); + if (beingHandler) + beingHandler->requestNameById(id); + if (localPlayer) + localPlayer->checkNewName(being); + break; + case ActorType::Monster: + if (serverFeatures && serverFeatures->haveMonsterName()) + beingHandler->requestNameById(id); + break; + case ActorType::Portal: + if (beingHandler && + serverFeatures && + serverFeatures->haveServerWarpNames()) + { + beingHandler->requestNameById(id); + } + break; + case ActorType::SkillUnit: + case ActorType::Elemental: + break; + default: + case ActorType::FloorItem: + case ActorType::LocalPet: + case ActorType::Avatar: + case ActorType::Unknown: + reportAlways("CreateBeing for unknown type %d", CAST_S32(type)); + break; } if (type == ActorType::Player) |