summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 16:24:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 16:24:06 +0000
commit843cfe68a7dc43f14522f80725627599c949b70d (patch)
tree73d8bf633b234f39a525d8646b60e4b172e002c2 /src/gui
parentb94970f6f79980a9b386cf499da31880006247b0 (diff)
downloadmana-client-843cfe68a7dc43f14522f80725627599c949b70d.tar.gz
mana-client-843cfe68a7dc43f14522f80725627599c949b70d.tar.bz2
mana-client-843cfe68a7dc43f14522f80725627599c949b70d.tar.xz
mana-client-843cfe68a7dc43f14522f80725627599c949b70d.zip
Merged revisions 3962-3983,3985-3999,4001-4021 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r3962 | crush_tmw | 2008-03-09 16:35:00 +0100 (Sun, 09 Mar 2008) | 1 line Applied some patches by peavey related to chatlog and the quit dialog. ........ r3968 | umperio | 2008-03-11 14:56:47 +0100 (Tue, 11 Mar 2008) | 1 line Removed unused image. ........ r3969 | b_lindeijer | 2008-03-11 17:44:20 +0100 (Tue, 11 Mar 2008) | 2 lines Also removed unused image from the files to be installed. ........ r4006 | crush_tmw | 2008-03-26 00:28:05 +0100 (Wed, 26 Mar 2008) | 1 line Initialized some uninitialized variables (patch by peavey). ........ r4008 | b_lindeijer | 2008-03-27 15:51:10 +0100 (Thu, 27 Mar 2008) | 2 lines Applied patch by peavey and added his name to the ChangeLog some more. ........ r4010 | b_lindeijer | 2008-03-30 16:06:14 +0200 (Sun, 30 Mar 2008) | 2 lines Updated configure.ac for tmwdata split (patch by peavey). ........ r4018 | crush_tmw | 2008-04-01 03:02:30 +0200 (Tue, 01 Apr 2008) | 1 line Added makefile for TMXCopy by jaxad. ........ r4019 | crush_tmw | 2008-04-01 03:34:29 +0200 (Tue, 01 Apr 2008) | 1 line compilation fixes suggested by peavey. ........ r4020 | crush_tmw | 2008-04-01 03:37:51 +0200 (Tue, 01 Apr 2008) | 1 line renaming makefile to Makefile ........ r4021 | crush_tmw | 2008-04-01 03:38:35 +0200 (Tue, 01 Apr 2008) | 1 line renaming makefile to Makefile ........
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp23
-rw-r--r--src/gui/scrollarea.cpp4
-rw-r--r--src/gui/viewport.cpp1
3 files changed, 20 insertions, 8 deletions
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);