diff options
author | ANAND <ClobberXD@gmail.com> | 2019-08-21 18:38:41 +0530 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-09-14 20:16:55 +0200 |
commit | eea082ee3fc3e2680c13aba1d82ca080365d28b6 (patch) | |
tree | 64e8fd618d9506b2f086b702021491f8a199387c | |
parent | e2d6445f2a64c45437f9762b891413142c4a66a3 (diff) | |
download | minetest-eea082ee3fc3e2680c13aba1d82ca080365d28b6.tar.gz minetest-eea082ee3fc3e2680c13aba1d82ca080365d28b6.tar.bz2 minetest-eea082ee3fc3e2680c13aba1d82ca080365d28b6.zip |
client.cpp: Fix code-style in Client::sendPlayerPos
-rw-r--r-- | src/client/client.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp index ce09f343c..6bb118695 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1234,42 +1234,41 @@ void Client::sendReady() void Client::sendPlayerPos() { - LocalPlayer *myplayer = m_env.getLocalPlayer(); - if (!myplayer) + LocalPlayer *player = m_env.getLocalPlayer(); + if (!player) return; ClientMap &map = m_env.getClientMap(); - - u8 camera_fov = map.getCameraFov(); - u8 wanted_range = map.getControl().wanted_range; + u8 camera_fov = map.getCameraFov(); + u8 wanted_range = map.getControl().wanted_range; // Save bandwidth by only updating position when // player is not dead and something changed - if (m_activeobjects_received && myplayer->isDead()) + if (m_activeobjects_received && player->isDead()) return; if ( - myplayer->last_position == myplayer->getPosition() && - myplayer->last_speed == myplayer->getSpeed() && - myplayer->last_pitch == myplayer->getPitch() && - myplayer->last_yaw == myplayer->getYaw() && - myplayer->last_keyPressed == myplayer->keyPressed && - myplayer->last_camera_fov == camera_fov && - myplayer->last_wanted_range == wanted_range) + player->last_position == player->getPosition() && + player->last_speed == player->getSpeed() && + player->last_pitch == player->getPitch() && + player->last_yaw == player->getYaw() && + player->last_keyPressed == player->keyPressed && + player->last_camera_fov == camera_fov && + player->last_wanted_range == wanted_range) return; - myplayer->last_position = myplayer->getPosition(); - myplayer->last_speed = myplayer->getSpeed(); - myplayer->last_pitch = myplayer->getPitch(); - myplayer->last_yaw = myplayer->getYaw(); - myplayer->last_keyPressed = myplayer->keyPressed; - myplayer->last_camera_fov = camera_fov; - myplayer->last_wanted_range = wanted_range; + player->last_position = player->getPosition(); + player->last_speed = player->getSpeed(); + player->last_pitch = player->getPitch(); + player->last_yaw = player->getYaw(); + player->last_keyPressed = player->keyPressed; + player->last_camera_fov = camera_fov; + player->last_wanted_range = wanted_range; NetworkPacket pkt(TOSERVER_PLAYERPOS, 12 + 12 + 4 + 4 + 4 + 1 + 1); - writePlayerPos(myplayer, &map, &pkt); + writePlayerPos(player, &map, &pkt); Send(&pkt); } |