summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-09 15:35:00 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-09 15:35:00 +0000
commit91176f564ae9462d50819f033756cb6e32b113ac (patch)
treeb6b4579ab02e37a570c8209510e85283563310fd
parent9085123bab570e32ddec9dda6ecfae40a3ac25f1 (diff)
downloadmana-client-91176f564ae9462d50819f033756cb6e32b113ac.tar.gz
mana-client-91176f564ae9462d50819f033756cb6e32b113ac.tar.bz2
mana-client-91176f564ae9462d50819f033756cb6e32b113ac.tar.xz
mana-client-91176f564ae9462d50819f033756cb6e32b113ac.zip
Applied some patches by peavey related to chatlog and the quit dialog.
-rw-r--r--ChangeLog11
-rw-r--r--src/game.cpp6
-rw-r--r--src/gui/chat.cpp20
-rw-r--r--src/gui/chat.h2
4 files changed, 31 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ce8d4331..fddcf3f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,16 @@
+2008-03-09 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/game.cpp: Pressing escape in the quit dialog closes the dialog.
+ (patch by peavey)
+ * src/gui/chat.cpp, src/gui/chat.h: Fixed a bug with chat messages
+ without a sender which include semicolons (patch by peavey).
+ * src/chat.cpp: Added "/clear" command to clear chat window
+ (patch by peavey).
+
2008-03-08 Philipp Sehmisch <tmw@crushnet.org>
* tools/tmxcopy/main.cpp, tools/tmxcopy/main.map.cpp,
- tools/tmxcopy/plibutils.cpp: Fixed some width/height mixups in
+ tools/tmxcopy/zlibutils.cpp: Fixed some width/height mixups in
TMXCopy.
2008-03-07 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/game.cpp b/src/game.cpp
index 52d70bc0..553f80c3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -525,8 +525,12 @@ void Game::handleInput()
exitConfirm = new ConfirmDialog(
"Quit", "Are you sure you want to quit?");
exitConfirm->addActionListener(&exitListener);
+ exitConfirm->requestMoveToTop();
+ }
+ else
+ {
+ exitConfirm->action(gcn::ActionEvent(NULL, "no"));
}
- exitConfirm->requestMoveToTop();
break;
default:
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 2e7e109b..effb58d2 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -97,10 +97,13 @@ ChatWindow::logic()
void
ChatWindow::chatLog(std::string line, int own)
{
+ // Trim whitespace
+ trim(line);
CHATLOG tmp;
tmp.own = own;
tmp.nick = "";
+ tmp.text = line;
// Fix the owner of welcome message.
if (line.substr(0, 7) == "Welcome")
@@ -111,12 +114,9 @@ ChatWindow::chatLog(std::string line, int own)
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:
@@ -132,7 +132,8 @@ ChatWindow::chatLog(std::string line, int own)
lineColor = "##0"; // Equiv. to BrowserBox::BLACK
break;
case BY_SERVER:
- tmp.nick += std::string("Server: ");
+ tmp.nick = "Server: ";
+ tmp.text = line;
lineColor = "##7"; // Equiv. to BrowserBox::PINK
break;
case ACT_WHISPER:
@@ -144,6 +145,8 @@ ChatWindow::chatLog(std::string line, int own)
lineColor = "##5"; // Equiv. to BrowserBox::YELLOW
break;
case BY_LOGGER:
+ tmp.nick = "";
+ tmp.text = line;
lineColor = "##8"; // Equiv. to BrowserBox::GREY
break;
}
@@ -162,7 +165,7 @@ ChatWindow::chatLog(std::string line, int own)
<< (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
@@ -277,6 +280,7 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
chatLog("/announce : Global announcement (GM only)", BY_SERVER);
chatLog("/where : Display map name", BY_SERVER);
chatLog("/who : Display number of online users", BY_SERVER);
+ chatLog("/clear : Clears this window", BY_SERVER);
}
else if (msg.substr(0, IS_WHERE_LENGTH) == IS_WHERE)
{
@@ -287,6 +291,10 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
MessageOut outMsg(mNetwork);
outMsg.writeInt16(0x00c1);
}
+ else if (msg.substr(0, IS_CLEAR_LENGTH) == IS_CLEAR)
+ {
+ mTextOutput->clearRows();
+ }
else
{
chatLog("Unknown command", BY_SERVER);
diff --git a/src/gui/chat.h b/src/gui/chat.h
index b857f4b4..cbfc8a63 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -56,6 +56,8 @@ class ScrollArea;
#define IS_WHERE_LENGTH 6
#define IS_WHO "/who"
#define IS_WHO_LENGTH 4
+#define IS_CLEAR "/clear"
+#define IS_CLEAR_LENGTH 6
/**
* gets in between usernick and message text depending on