Replace getPlayer(playername) by getPlayer(peer_id) in some possible cases. ok @Zeno-

master
Loic Blot 2015-01-26 12:21:18 +01:00
parent da8199799d
commit bb59a8543d
1 changed files with 2 additions and 4 deletions

View File

@ -1192,7 +1192,7 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
m_clients.Unlock(); m_clients.Unlock();
RemotePlayer *player = RemotePlayer *player =
static_cast<RemotePlayer*>(m_env->getPlayer(playername.c_str())); static_cast<RemotePlayer*>(m_env->getPlayer(peer_id));
// If failed, cancel // If failed, cancel
if((playersao == NULL) || (player == NULL)) { if((playersao == NULL) || (player == NULL)) {
@ -1602,7 +1602,6 @@ void Server::handleCommand_Init2(ToServerPacket* pkt)
m_clients.event(pkt->getPeerId(), CSE_GotInit2); m_clients.event(pkt->getPeerId(), CSE_GotInit2);
u16 protocol_version = m_clients.getProtocolVersion(pkt->getPeerId()); u16 protocol_version = m_clients.getProtocolVersion(pkt->getPeerId());
///// begin compatibility code ///// begin compatibility code
PlayerSAO* playersao = NULL; PlayerSAO* playersao = NULL;
if (protocol_version <= 22) { if (protocol_version <= 22) {
@ -5138,13 +5137,12 @@ v3f findSpawnPos(ServerMap &map)
PlayerSAO* Server::emergePlayer(const char *name, u16 peer_id) PlayerSAO* Server::emergePlayer(const char *name, u16 peer_id)
{ {
RemotePlayer *player = NULL;
bool newplayer = false; bool newplayer = false;
/* /*
Try to get an existing player Try to get an existing player
*/ */
player = static_cast<RemotePlayer*>(m_env->getPlayer(name)); RemotePlayer *player = static_cast<RemotePlayer*>(m_env->getPlayer(name));
// If player is already connected, cancel // If player is already connected, cancel
if(player != NULL && player->peer_id != 0) if(player != NULL && player->peer_id != 0)