summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Baldeck <alexander@archlinux.org>2004-09-29 08:56:37 +0000
committerAlexander Baldeck <alexander@archlinux.org>2004-09-29 08:56:37 +0000
commit55883ed2e95f5d430cfb49f728890cf300c07178 (patch)
treed3962b802f960c7caa96455ad001b7ee5d91abf1 /src
parent41c268f0192405e949d1513cbd086eb96aaa0f94 (diff)
downloadmana-55883ed2e95f5d430cfb49f728890cf300c07178.tar.gz
mana-55883ed2e95f5d430cfb49f728890cf300c07178.tar.bz2
mana-55883ed2e95f5d430cfb49f728890cf300c07178.tar.xz
mana-55883ed2e95f5d430cfb49f728890cf300c07178.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/gui/chat.cpp53
-rw-r--r--src/gui/chat.h8
2 files changed, 30 insertions, 31 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index fb424b4e..6c17942d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -1,4 +1,4 @@
-/**
+/*
The Mana World
Copyright 2004 The Mana World Development Team
@@ -21,15 +21,6 @@
*/
-/**
- Simple ChatLog Object v0.5 (i'd say...)
-
- Bestviewd w/ Bitstream Vera Sans Mono @ 9pt and a tab-width of 2 spaces
-
- Author: kth5 aka Alexander Baldeck
- pipe your questions, suggestions and flames to: kth5@gawab.com
-*/
-
#include "../main.h"
#include "chat.h"
#include <list>
@@ -38,6 +29,14 @@
using namespace std;
+/**
+ Simple ChatLog Object v0.5 (i'd say...)
+
+ Bestviewd w/ Bitstream Vera Sans Mono @ 9pt and a tab-width of 2 spaces
+
+ Author: kth5 aka Alexander Baldeck
+ pipe your questions, suggestions and flames to: kth5@gawab.com
+*/
Chat::Chat(const char * logfile, int item_num) {
chatlog_file.open(logfile, ios::out | ios::app);
@@ -58,7 +57,7 @@ void Chat::chat_dlgrsize(int) {
string line -> message text
int own -> type of message (usually the owner-type)
ALFONT_FONT * font -> font that'll be used to draw the text later
-
+
NOTE:
to all of you who wonder why the font needs to be passed, simple.
i already store the width in pixel in the list rather than
@@ -92,13 +91,13 @@ void Chat::chat_log(string line, int own, ALFONT_FONT * font) {
}else {
tmp.nick = "";
tmp.width = 1;
- }
- tmp.own = own;
- tmp.text = line;
+ }
+ tmp.own = own;
+ tmp.text = line;
chatlog_file << tmp.nick << tmp.text << "\n";
chatlog_file.flush();
-
+
chatlog.push_front(tmp);
}
@@ -113,7 +112,7 @@ void Chat::chat_log(CHATSKILL action, ALFONT_FONT * font) {
BITMAP * bmp -> Allegro type bitmap buffer to draw onto
int n -> number of lines to be drawn
ALFONT_FONT * font -> font to use
-
+
NOTE:
take great care using this, make sure the buffer passed is
empty! ;-) anyway, line wrapping is not supported yet.
@@ -122,11 +121,11 @@ void Chat::chat_draw(BITMAP * bmp, int n, ALFONT_FONT * font) {
int y = 600-35, i = 0;
CHATLOG line;
n -= 1;
-
- for(iter = chatlog.begin(); iter != chatlog.end(); iter++) {
+
+ for(iter = chatlog.begin(); iter != chatlog.end(); iter++) {
line = *iter;
y -=11;
-
+
switch(line.own) {
case BY_GM :
alfont_textprintf_aa(bmp, font, 1, y, COLOR_BLUE, "Global announcement: ");
@@ -143,7 +142,7 @@ void Chat::chat_draw(BITMAP * bmp, int n, ALFONT_FONT * font) {
default :
alfont_textprintf_aa(bmp, font, 1, y, COLOR_LIGHTBLUE, line.text.c_str());
}
-
+
if(i>=n)
return;
i++;
@@ -155,7 +154,7 @@ void Chat::chat_draw(BITMAP * bmp, int n, ALFONT_FONT * font) {
string nick -> the character's name to display infront
string msg -> the message's text which is to be send.
-
+
NOTE:
the nickname is required by the server, if not specified
the message may not be sent unless a command was intended
@@ -195,7 +194,7 @@ char * Chat::chat_send(string nick, string msg) {
nick += msg;
msg = nick;
packid = 0x008c;
- }
+ }
msg += "\0";
@@ -206,13 +205,13 @@ char * Chat::chat_send(string nick, string msg) {
WFIFOSET((int)msg.length()+4);
nick = msg = "";
return "";
-}
+}
-/** PRIVATE :
+/** PRIVATE :
NOTE:
these usually will be left undocumented coz u can't call them
directly anyway. ;-)
-*/
+*/
/** constructs failed messages for actions */
string Chat::const_msg(CHATSKILL action) {
@@ -238,7 +237,7 @@ string Chat::const_msg(CHATSKILL action) {
msg = "Cannot shout!";
break;
}
-
+
switch(action.reason) {
case RFAIL_SKILLDEP :
msg += " You have not yet reached a high enough lvl!";
@@ -287,7 +286,7 @@ string Chat::const_msg(CHATSKILL action) {
break;
}
}
-
+
return msg;
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index ea1637b4..76de1f95 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -1,4 +1,4 @@
-/**
+/*
The Mana World
Copyright 2004 The Mana World Development Team
@@ -57,7 +57,7 @@ using namespace std;
/**
gets in between usernick and message text depending on
- message type
+ message type
*/
#define CAT_NORMAL ": "
#define CAT_IS ""
@@ -135,13 +135,13 @@ class Chat {
int own;
int width;
};
-
+
list<CHATLOG> chatlog; // list object ready to accept out CHATLOG struct :)
list<CHATLOG>::iterator iter;
int items;
int items_keep;
-
+
string const_msg(CHATSKILL); // contructs action-fail messages
string const_msg(int); // constructs normal messages (not implemented yet)
};