diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 3 | ||||
-rw-r--r-- | src/gui/chat.cpp | 23 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 4 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 1 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 2 |
5 files changed, 23 insertions, 10 deletions
diff --git a/src/game.cpp b/src/game.cpp index fcbc5aba..039a1916 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -540,10 +540,11 @@ void Game::handleInput() if (!quitDialog) { quitDialog = new QuitDialog(&done, &quitDialog); + quitDialog->requestMoveToTop(); } else { - quitDialog->requestMoveToTop(); + quitDialog->action(gcn::ActionEvent(NULL, "cancel")); } break; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index d490853c..a9f3b931 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -120,9 +120,13 @@ ChatWindow::logic() void ChatWindow::chatLog(std::string line, int own, const std::string &channelName) { + // Trim whitespace + trim(line); + CHATLOG tmp; tmp.own = own; tmp.nick = ""; + tmp.text = line; BrowserBox *output = mChannelOutput[channelName]; ScrollArea *scroll = mChannelScroll[channelName]; @@ -136,12 +140,9 @@ ChatWindow::chatLog(std::string line, int own, const std::string &channelName) std::string::size_type pos = line.find(" : "); if (pos != std::string::npos) { tmp.nick = line.substr(0, pos); - line.erase(0, pos + 3); + tmp.text = line.substr(pos + 3); } - // Trim whitespace - trim(line); - std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK switch (own) { case BY_GM: @@ -157,10 +158,13 @@ ChatWindow::chatLog(std::string line, int own, const std::string &channelName) lineColor = "##0"; // Equiv. to BrowserBox::BLACK break; case BY_SERVER: - tmp.nick += "Server: "; + tmp.nick = "Server: "; + tmp.text = line; lineColor = "##7"; // Equiv. to BrowserBox::PINK break; case BY_LOGGER: + tmp.nick = ""; + tmp.text = line; lineColor = "##8"; // Equiv. to BrowserBox::GREY break; } @@ -179,7 +183,7 @@ ChatWindow::chatLog(std::string line, int own, const std::string &channelName) << (int)((t / 60) % 60) << "] "; - line = lineColor + timeStr.str() + tmp.nick + line; + line = lineColor + timeStr.str() + tmp.nick + tmp.text; // We look if the Vertical Scroll Bar is set at the max before // adding a row, otherwise the max will always be a row higher @@ -314,6 +318,7 @@ void ChatWindow::chatSend(std::string const &nick, std::string const &msg, chatLog("/join > Join an already registered channel", BY_SERVER, channelName); chatLog("/quit > Leave a channel", BY_SERVER, channelName); chatLog("/admin > Send a command to the server (GM only)", BY_SERVER, channelName); + chatLog("/clear > Clears this window", BY_SERVER); } else if (command == "where") { @@ -365,6 +370,12 @@ void ChatWindow::chatSend(std::string const &nick, std::string const &msg, { Net::GameServer::Player::say("/" + arg); } + else if (command == "clear") + { + BrowserBox *output = mChannelOutput[channelName]; + if (output) + output->clearRows(); + } else { chatLog("Unknown command", BY_SERVER, channelName); diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 97384fa3..9c88f8e3 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -86,8 +86,8 @@ void ScrollArea::init() // Load the background skin ResourceManager *resman = ResourceManager::getInstance(); Image *textbox = resman->getImage("graphics/gui/deepbox.png"); - int bggridx[4] = {0, 3, 28, 31}; - int bggridy[4] = {0, 3, 28, 31}; + const int bggridx[4] = {0, 3, 28, 31}; + const int bggridy[4] = {0, 3, 28, 31}; int a = 0, x, y; for (y = 0; y < 3; y++) { diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index a8fd452c..819cb761 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -57,6 +57,7 @@ Viewport::Viewport(): mViewY(0.0f), mShowDebugPath(false), mPlayerFollowMouse(false), + mWalkTime(0), mLocalWalkTime(-1) { setOpaque(false); diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 92ce2fe9..76efe380 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -354,7 +354,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable) void OpenGLGraphics::drawRectangle(const gcn::Rectangle& rect, bool filled) { - float offset = filled ? 0 : 0.5f; + const float offset = filled ? 0 : 0.5f; setTexturingAndBlending(false); |