aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp11
-rw-r--r--src/network/networkprotocol.h1
-rw-r--r--src/server.cpp8
3 files changed, 16 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index c2471dbd7..30058a2b0 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1563,10 +1563,13 @@ void Client::typeChatMessage(const std::wstring &message)
}
else
{
- LocalPlayer *player = m_env.getLocalPlayer();
- assert(player != NULL);
- std::wstring name = narrow_to_wide(player->getName());
- m_chat_queue.push((std::wstring)L"<" + name + L"> " + message);
+ // compatibility code
+ if (m_proto_ver < 29) {
+ LocalPlayer *player = m_env.getLocalPlayer();
+ assert(player != NULL);
+ std::wstring name = narrow_to_wide(player->getName());
+ m_chat_queue.push((std::wstring)L"<" + name + L"> " + message);
+ }
}
}
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h
index 45bf76ff8..23c8a665b 100644
--- a/src/network/networkprotocol.h
+++ b/src/network/networkprotocol.h
@@ -142,6 +142,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Server doesn't accept TOSERVER_BREATH anymore
serialization of TileAnimation params changed
TAT_SHEET_2D
+ Removed client-sided chat perdiction
*/
#define LATEST_PROTOCOL_VERSION 29
diff --git a/src/server.cpp b/src/server.cpp
index 29dce5a4a..74d9541c9 100644
--- a/src/server.cpp
+++ b/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;
+
for (u16 i = 0; i < clients.size(); i++) {
u16 cid = clients[i];
if (cid != peer_id_to_avoid_sending)