summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-09-30 12:00:05 +0200
committerGitHub <noreply@github.com>2017-09-30 12:00:05 +0200
commitbe10c0893e2e6d1852a027abccc4cd3cdc85a140 (patch)
treeeabfe8164007c420326f52bfc7e13e9be0f6bfb6 /src/client.cpp
parentf729b5d2bdc65ce3c51f1004c58cb93a37504b49 (diff)
downloadminetest-be10c0893e2e6d1852a027abccc4cd3cdc85a140.tar.gz
minetest-be10c0893e2e6d1852a027abccc4cd3cdc85a140.tar.bz2
minetest-be10c0893e2e6d1852a027abccc4cd3cdc85a140.zip
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
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 13ee8bb76..2538f52aa 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1190,7 +1190,7 @@ void Client::sendReady()
void Client::sendPlayerPos()
{
LocalPlayer *myplayer = m_env.getLocalPlayer();
- if(myplayer == NULL)
+ if (!myplayer)
return;
ClientMap &map = m_env.getClientMap();
@@ -1216,16 +1216,6 @@ void Client::sendPlayerPos()
myplayer->last_camera_fov = camera_fov;
myplayer->last_wanted_range = wanted_range;
- //infostream << "Sending Player Position information" << std::endl;
-
- session_t our_peer_id = m_con->GetPeerID();
-
- // Set peer id if not set already
- if(myplayer->peer_id == PEER_ID_INEXISTENT)
- myplayer->peer_id = our_peer_id;
-
- assert(myplayer->peer_id == our_peer_id);
-
NetworkPacket pkt(TOSERVER_PLAYERPOS, 12 + 12 + 4 + 4 + 4 + 1 + 1);
writePlayerPos(myplayer, &map, &pkt);
@@ -1236,16 +1226,9 @@ void Client::sendPlayerPos()
void Client::sendPlayerItem(u16 item)
{
LocalPlayer *myplayer = m_env.getLocalPlayer();
- if(myplayer == NULL)
+ if (!myplayer)
return;
- session_t our_peer_id = m_con->GetPeerID();
-
- // Set peer id if not set already
- if(myplayer->peer_id == PEER_ID_INEXISTENT)
- myplayer->peer_id = our_peer_id;
- assert(myplayer->peer_id == our_peer_id);
-
NetworkPacket pkt(TOSERVER_PLAYERITEM, 2);
pkt << item;