summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 72cd28b18..14f93a1a1 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2036,7 +2036,21 @@ void Client::printDebugInfo(std::ostream &os)
//<<", m_opt_not_found_history.size()="<<m_opt_not_found_history.size()
<<std::endl;*/
}
-
+
+core::list<std::wstring> Client::getConnectedPlayerNames()
+{
+ core::list<Player*> players = m_env.getPlayers(true);
+ core::list<std::wstring> playerNames;
+ for(core::list<Player*>::Iterator
+ i = players.begin();
+ i != players.end(); i++)
+ {
+ Player *player = *i;
+ playerNames.push_back(narrow_to_wide(player->getName()));
+ }
+ return playerNames;
+}
+
u32 Client::getDayNightRatio()
{
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
@@ -2084,6 +2098,39 @@ void Client::clearTempMod(v3s16 p)
}
}
+bool Client::getChatMessage(std::wstring &message)
+{
+ if(m_chat_queue.size() == 0)
+ return false;
+ message = m_chat_queue.pop_front();
+ return true;
+}
+
+void Client::typeChatMessage(const std::wstring &message)
+{
+ // Discard empty line
+ if(message == L"")
+ return;
+
+ // Send to others
+ sendChatMessage(message);
+
+ // Show locally
+ if (message[0] == L'/')
+ {
+ m_chat_queue.push_back(
+ (std::wstring)L"issued command: "+message);
+ }
+ else
+ {
+ LocalPlayer *player = m_env.getLocalPlayer();
+ assert(player != NULL);
+ std::wstring name = narrow_to_wide(player->getName());
+ m_chat_queue.push_back(
+ (std::wstring)L"<"+name+L"> "+message);
+ }
+}
+
void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server)
{
/*infostream<<"Client::addUpdateMeshTask(): "