diff options
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/server.cpp b/src/server.cpp index 3bdabdfa6..e210d4d64 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2313,6 +2313,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) dstream<<"CHAT: "<<wide_to_narrow(message)<<std::endl; + // Get player name of this client + std::wstring name = narrow_to_wide(player->getName()); + + std::wstring line = std::wstring(L"<")+name+L"> "+message; + /* Send the message to all other clients */ @@ -2330,14 +2335,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) if(peer_id == client->peer_id) continue; - // Get player name of this client - std::wstring name = L"unknown"; - Player *player = m_env.getPlayer(client->peer_id); - if(player != NULL) - name = narrow_to_wide(player->getName()); - - SendChatMessage(client->peer_id, - std::wstring(L"<")+name+L"> "+message); + SendChatMessage(client->peer_id, line); } } else |