summaryrefslogtreecommitdiff
path: root/src/actormanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-03 20:03:30 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-03 20:03:30 +0300
commitabeecf1255d28a7870aef9f70dc3353d9b5f4f2d (patch)
tree975878d832cb3b2249684569f181c519c67566a3 /src/actormanager.cpp
parentedb279bdc22d94a88aabdd994bed5dd2b1c5659e (diff)
downloadManaVerse-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.gz
ManaVerse-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.bz2
ManaVerse-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.tar.xz
ManaVerse-abeecf1255d28a7870aef9f70dc3353d9b5f4f2d.zip
Replace some ifs to switches.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r--src/actormanager.cpp58
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)