[Client] Do not copy strings in getLocalActor and getDedicatedActor

This commit is contained in:
Koncord 2018-01-19 15:50:44 +08:00
parent e2e197d84a
commit c2578918f2
2 changed files with 4 additions and 4 deletions

View file

@ -434,12 +434,12 @@ void Cell::uninitializeDedicatedActors()
dedicatedActors.clear(); dedicatedActors.clear();
} }
LocalActor *Cell::getLocalActor(std::string actorIndex) LocalActor *Cell::getLocalActor(const std::string &actorIndex)
{ {
return localActors.at(actorIndex); return localActors.at(actorIndex);
} }
DedicatedActor *Cell::getDedicatedActor(std::string actorIndex) DedicatedActor *Cell::getDedicatedActor(const std::string &actorIndex)
{ {
return dedicatedActors.at(actorIndex); return dedicatedActors.at(actorIndex);
} }

View file

@ -36,8 +36,8 @@ namespace mwmp
void uninitializeLocalActors(); void uninitializeLocalActors();
void uninitializeDedicatedActors(); void uninitializeDedicatedActors();
virtual LocalActor *getLocalActor(std::string actorIndex); virtual LocalActor *getLocalActor(const std::string &actorIndex);
virtual DedicatedActor *getDedicatedActor(std::string actorIndex); virtual DedicatedActor *getDedicatedActor(const std::string &actorIndex);
bool hasLocalAuthority(); bool hasLocalAuthority();
void setAuthority(const RakNet::RakNetGUID& guid); void setAuthority(const RakNet::RakNetGUID& guid);