aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2022-02-08 19:28:32 +0100
committerGitHub <noreply@github.com>2022-02-08 19:28:32 +0100
commitb9ee29a9456a66c3670b2a1389878e0896395f58 (patch)
tree7d032d8828e454523850bfc7af1ce60a3043fe29 /src
parentbe05c9022d8b6eff63f477bc8ca52efd7d631cb6 (diff)
downloadminetest-b9ee29a9456a66c3670b2a1389878e0896395f58.tar.gz
minetest-b9ee29a9456a66c3670b2a1389878e0896395f58.tar.bz2
minetest-b9ee29a9456a66c3670b2a1389878e0896395f58.zip
Send HUD flags only if changed
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server.cpp b/src/server.cpp
index df7083b68..76345686a 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3271,9 +3271,12 @@ bool Server::hudSetFlags(RemotePlayer *player, u32 flags, u32 mask)
if (!player)
return false;
+ u32 new_hud_flags = (player->hud_flags & ~mask) | flags;
+ if (new_hud_flags == player->hud_flags) // no change
+ return true;
+
SendHUDSetFlags(player->getPeerId(), flags, mask);
- player->hud_flags &= ~mask;
- player->hud_flags |= flags;
+ player->hud_flags = new_hud_flags;
PlayerSAO* playersao = player->getPlayerSAO();