new: a command to clear on-screen chat messages

This commit is contained in:
donat-b 2015-10-11 22:47:56 +03:00
parent ecea68e463
commit 1c95d84534
4 changed files with 20 additions and 8 deletions

View File

@ -94,6 +94,7 @@ Engine
* Liquids drop torches and plants
#### Client
* Clearing on-screen chat by invoking the /clear command
* Fixed some input issues: not working numpad and some keys in azerty layout
* Chat forms were replaced with console (opens up to 10% height of the screen)
* Default keymap for console changed to tilde (~)

View File

@ -67,6 +67,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#if !MINETEST_PROTO
#include "network/fm_clientpacketsender.cpp"
#endif
#include "chat.h"
extern gui::IGUIEnvironment* guienv;
@ -1632,15 +1633,18 @@ void Client::typeChatMessage(const std::string &message)
if(message.empty())
return;
// Send to others
sendChatMessage(message);
// Show locally
if (message[0] == '/')
{
m_chat_queue.push("issued command: " + message);
if (message[0] == '/') {
// TODO register client commands in help
std::string command = message.substr(1,-1);
// Clears on-screen chat messages
if (command.compare("clear") == 0) {
chat_backend->clearRecentChat();
return;
// it's kinda self-evident when you run a local command
} else {
m_chat_queue.push("issued command: " + message);
}
}
//freeminer display self message after recieving from server
#if MINETEST_PROTO
else
@ -1651,6 +1655,9 @@ void Client::typeChatMessage(const std::string &message)
m_chat_queue.push(std::string() + "<" + name + "> " + message);
}
#endif
// Send to others
sendChatMessage(message);
}
void Client::addUpdateMeshTask(v3s16 p, bool urgent, int step)

View File

@ -59,6 +59,7 @@ class Database;
class Server;
class Mapper;
struct MinimapMapblock;
class ChatBackend;
/*
struct QueuedMeshUpdate
@ -546,6 +547,8 @@ public:
void makeScreenshot(const std::string & name = "screenshot_", IrrlichtDevice *device = nullptr);
ChatBackend *chat_backend;
private:
// Virtual methods from con::PeerHandler

View File

@ -2373,6 +2373,7 @@ bool Game::connectToServer(const std::string &playername,
if (!client)
return false;
client->chat_backend = chat_backend;
gamedef = client; // Client acts as our GameDef
infostream << "Connecting to server at ";