summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2011-12-03 09:01:14 +0100
committerPerttu Ahola <celeron55@gmail.com>2012-03-10 20:11:10 +0200
commit967f25461bbde28dbc0247fa1c491e9d9938a5b2 (patch)
treed1e26464862551db3f1d12627cdbe9e31fe211a9 /src/client.cpp
parent00536518142a586f3fc51a07f76e12085e3cbd30 (diff)
downloadminetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.tar.gz
minetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.tar.bz2
minetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.zip
Chat console, including a number of rebases and modifications.
Defaults modified from original: alpha=200, key=F10
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(): "