summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-04 23:23:20 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-04 23:23:20 +0000
commite8cf7d5436f7b525e79b9d5949e34bc5f8024fa0 (patch)
treeb0a316c23ba426217522dae0ff4685320ce6c875 /src/gui
parent7a57cee0d153a4db1d82369aae9160e8ece9ba26 (diff)
downloadMana-e8cf7d5436f7b525e79b9d5949e34bc5f8024fa0.tar.gz
Mana-e8cf7d5436f7b525e79b9d5949e34bc5f8024fa0.tar.bz2
Mana-e8cf7d5436f7b525e79b9d5949e34bc5f8024fa0.tar.xz
Mana-e8cf7d5436f7b525e79b9d5949e34bc5f8024fa0.zip
README updates for 0.0.10 and made chat messages wrap at 80 characters.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 5c947859..82c808be 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -78,37 +78,39 @@ void ChatBox::chat_log(std::string line, int own)
// A try to get text sentences no too long...
bool finished = false;
- while (!finished)
- {
- std::string tempText;
- if (line.length() > 60)
- {
-
- if (line.length() > 60)
- tempText = line.substr(0, 60);
- else
- tempText = line;
-
- tmp.text = tempText;
-
- //chatlog_file << tmp.nick << tmp.text << "\n";
- //chatlog_file.flush();
+ int maxLength = 80;
- chatlog.push_front(tmp);
-
- if ( line.length() > 60 )
- line = line.substr(60, line.length() - 60);
- }
- else // Normal message
- {
- tmp.text = line;
- //chatlog_file << tmp.nick << tmp.text << "\n";
- //chatlog_file.flush();
+ while (!finished)
+ {
+ std::string tempText;
+ if (line.length() > maxLength)
+ {
- chatlog.push_front(tmp);
- finished = true;
- }
+ if (line.length() > maxLength)
+ tempText = line.substr(0, maxLength);
+ else
+ tempText = line;
+
+ tmp.text = tempText;
+
+ //chatlog_file << tmp.nick << tmp.text << "\n";
+ //chatlog_file.flush();
+
+ chatlog.push_front(tmp);
+
+ if (line.length() > maxLength)
+ line = line.substr(maxLength, line.length() - maxLength);
}
+ else // Normal message
+ {
+ tmp.text = line;
+ //chatlog_file << tmp.nick << tmp.text << "\n";
+ //chatlog_file.flush();
+
+ chatlog.push_front(tmp);
+ finished = true;
+ }
+ }
}
void ChatBox::chat_log(CHATSKILL action) {