mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
RemotePlayer: make peer ID always reflect the validity of PlayerSAO (#14317)
Upon disconnect, RemotePlayer still had a peer ID assigned even though the PlayerSAO object was maked as gone (for removal). This commit makes that the following always holds true: (!sao || sao->isGone()) === (peer_id == PEER_ID_INEXISTENT)
This commit is contained in:
parent
893594d81a
commit
e7dbd325d2
10 changed files with 86 additions and 61 deletions
|
@ -42,7 +42,7 @@ class RemotePlayer : public Player
|
|||
|
||||
public:
|
||||
RemotePlayer(const char *name, IItemDefManager *idef);
|
||||
virtual ~RemotePlayer() = default;
|
||||
virtual ~RemotePlayer();
|
||||
|
||||
PlayerSAO *getPlayerSAO() { return m_sao; }
|
||||
void setPlayerSAO(PlayerSAO *sao) { m_sao = sao; }
|
||||
|
@ -135,6 +135,7 @@ public:
|
|||
u16 protocol_version = 0;
|
||||
u16 formspec_version = 0;
|
||||
|
||||
/// returns PEER_ID_INEXISTENT when PlayerSAO is not ready
|
||||
session_t getPeerId() const { return m_peer_id; }
|
||||
|
||||
void setPeerId(session_t peer_id) { m_peer_id = peer_id; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue