1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Make Player::peer_id server-side only and add getters and setters (#6478)

* Make Player::peer_id server-side only and add getters and setters

Player::peer_id has no sense client side, move it to server, make it private and add setter and getter
Also add some PEER_ID_INEXISTENT instead of harcoded 0
This commit is contained in:
Loïc Blot 2017-09-30 12:00:05 +02:00 committed by GitHub
parent f729b5d2bd
commit be10c0893e
8 changed files with 64 additions and 73 deletions

View file

@ -848,7 +848,7 @@ void PlayerSAO::addedToEnvironment(u32 dtime_s)
ServerActiveObject::addedToEnvironment(dtime_s);
ServerActiveObject::setBasePosition(m_base_position);
m_player->setPlayerSAO(this);
m_player->peer_id = m_peer_id;
m_player->setPeerId(m_peer_id);
m_last_good_position = m_base_position;
}
@ -1359,7 +1359,7 @@ void PlayerSAO::disconnected()
void PlayerSAO::unlinkPlayerSessionAndSave()
{
assert(m_player->getPlayerSAO() == this);
m_player->peer_id = 0;
m_player->setPeerId(PEER_ID_INEXISTENT);
m_env->savePlayer(m_player);
m_player->setPlayerSAO(NULL);
m_env->removePlayer(m_player);