Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Remove client-side chat prediction. (#5055)
Network lag isn't really a big issue with chat and chat prediction makes writing mods harder.
- Loading branch information
Showing
with
17 additions
and 4 deletions.
- +1 −0 builtin/game/features.lua
- +7 −4 src/client.cpp
- +1 −0 src/network/networkprotocol.h
- +8 −0 src/server.cpp
@@ -2826,7 +2826,15 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna | ||
|
||
std::vector<u16> clients = m_clients.getClientIDs(); | ||
|
||
/* | ||
Send the message back to the inital sender | ||
if they are using protocol version >= 29 | ||
*/ | ||
|
||
u16 peer_id_to_avoid_sending = (player ? player->peer_id : PEER_ID_INEXISTENT); | ||
if (player->protocol_version >= 29) | ||
peer_id_to_avoid_sending = PEER_ID_INEXISTENT; | ||
|
||
This comment has been minimized.
This comment has been minimized.
sfan5
Member
|
||
for (u16 i = 0; i < clients.size(); i++) { | ||
u16 cid = clients[i]; | ||
if (cid != peer_id_to_avoid_sending) | ||
@red-001, this looks like peer_id_to_avoid_sending is set to PEER_ID_INEXISTENT if player is 0, so
player->protocol_version
could cause a crash, couldn't it?How about this?
u16 peer_id_to_avoid_sending = player && player->protocol_version < 29 ? player->peer_id : PEER_ID_INEXISTENT;