summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-01-01 16:13:01 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2017-01-01 23:11:26 +0100
commit52ba1f867e5edb579a59a44fbb8286d4f1e54931 (patch)
treed95e2032d3fcf18bd972cc018e6b44470664d75c /src/client.cpp
parenta1346c916e1d0f0cde2ccecc680857896c717a3d (diff)
downloadminetest-52ba1f867e5edb579a59a44fbb8286d4f1e54931.tar.gz
minetest-52ba1f867e5edb579a59a44fbb8286d4f1e54931.tar.bz2
minetest-52ba1f867e5edb579a59a44fbb8286d4f1e54931.zip
Breath cheat fix: server side
Breath is now handled server side. Changing this behaviour required some modifications to core: * Ignore TOSERVER_BREATH package, marking it as obsolete * Clients doesn't send the breath to server anymore * Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain) * drop a useless static_cast in emergePlayer
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5476aad0e..1446ebad8 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -499,9 +499,10 @@ void Client::step(float dtime)
m_client_event_queue.push(event);
}
}
- else if(event.type == CEE_PLAYER_BREATH) {
- u16 breath = event.player_breath.amount;
- sendBreath(breath);
+ // Protocol v29 or greater obsoleted this event
+ else if (event.type == CEE_PLAYER_BREATH && m_proto_ver < 29) {
+ u16 breath = event.player_breath.amount;
+ sendBreath(breath);
}
}
@@ -1270,6 +1271,10 @@ void Client::sendBreath(u16 breath)
{
DSTACK(FUNCTION_NAME);
+ // Protocol v29 make this obsolete
+ if (m_proto_ver >= 29)
+ return;
+
NetworkPacket pkt(TOSERVER_BREATH, sizeof(u16));
pkt << breath;
Send(&pkt);