1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 23:58:48 -05:00

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

This commit is contained in:
Loic Blot 2015-01-26 12:21:18 +01:00
parent da8199799d
commit bb59a8543d

View File

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