Add chat messages to log in client

Cleanup redundant code in GUIChat class
This commit is contained in:
Koncord 2016-09-10 13:40:06 +08:00
parent e5e9c90441
commit a34d46f57e
2 changed files with 5 additions and 16 deletions

View file

@ -9,6 +9,7 @@
#include <apps/openmw/mwgui/windowmanagerimp.hpp> #include <apps/openmw/mwgui/windowmanagerimp.hpp>
#include <apps/openmw/mwinput/inputmanagerimp.hpp> #include <apps/openmw/mwinput/inputmanagerimp.hpp>
#include <MyGUI_InputManager.h> #include <MyGUI_InputManager.h>
#include <components/openmw-mp/Log.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -66,22 +67,13 @@ namespace mwmp
//WindowBase::exit(); //WindowBase::exit();
} }
void GUIChat::resetReference()
{
ReferenceInterface::resetReference();
//setSelectedObject(MWWorld::Ptr());
}
void GUIChat::onReferenceUnavailable()
{
//setSelectedObject(MWWorld::Ptr());
}
void GUIChat::acceptCommand(MyGUI::EditBox *_sender) void GUIChat::acceptCommand(MyGUI::EditBox *_sender)
{ {
const std::string &cm = mCommandLine->getOnlyText(); const std::string &cm = mCommandLine->getOnlyText();
if (cm.empty()) return; if (cm.empty()) return;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Player: %s", cm.c_str());
// Add the command to the history, and set the current pointer to // Add the command to the history, and set the current pointer to
// the end of the list // the end of the list
if (mCommandHistory.empty() || mCommandHistory.back() != cm) if (mCommandHistory.empty() || mCommandHistory.back() != cm)
@ -115,6 +107,7 @@ namespace mwmp
setVisible(true); setVisible(true);
} }
mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg)); mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg));
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", msg.c_str());
} }
void GUIChat::printOK(const std::string &msg) void GUIChat::printOK(const std::string &msg)

View file

@ -23,7 +23,7 @@
namespace mwmp namespace mwmp
{ {
class GUIController; class GUIController;
class GUIChat : public MWGui::WindowBase, public MWGui::ReferenceInterface class GUIChat : public MWGui::WindowBase
{ {
friend class GUIController; friend class GUIController;
public: public:
@ -76,14 +76,10 @@ namespace mwmp
/// Error message /// Error message
void printError(const std::string &msg); void printError(const std::string &msg);
virtual void resetReference ();
void send(const std::string &str); void send(const std::string &str);
protected: protected:
virtual void onReferenceUnavailable();
private: private:
void keyPress(MyGUI::Widget* _sender, void keyPress(MyGUI::Widget* _sender,