[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src display.cpp
From: |
Isaac Clerencia |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src display.cpp |
Date: |
Mon, 20 Dec 2004 16:59:34 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Isaac Clerencia <address@hidden> 04/12/20 21:48:35
Modified files:
src : display.cpp
Log message:
Added "/me " IRC behaviour to in-game chat, it looks somewhat weird,
any suggestions are welcome
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.281&tr2=1.282&r1=text&r2=text
Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.281 wesnoth/src/display.cpp:1.282
--- wesnoth/src/display.cpp:1.281 Sat Dec 4 11:51:44 2004
+++ wesnoth/src/display.cpp Mon Dec 20 21:48:35 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.281 2004/12/04 11:51:44 silene Exp $ */
+/* $Id: display.cpp,v 1.282 2004/12/20 21:48:35 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2172,7 +2172,15 @@
void display::add_chat_message(const std::string& speaker, int side, const
std::string& message, display::MESSAGE_TYPE type)
{
- std::string msg = message;
+ bool action;
+ std::string msg;
+ if(message.find("/me ") == 0) {
+ msg.assign(message,4,message.size());
+ action = true;
+ } else {
+ msg = message;
+ action = false;
+ }
gui::text_to_lines(msg,80);
int ypos = chat_message_x;
@@ -2181,15 +2189,24 @@
}
std::stringstream str;
+ std::stringstream message_str;
+ message_str << msg;
if(type == MESSAGE_PUBLIC) {
- str << "<" << speaker << ">";
+ if(action) {
+ str << "<" << speaker;
+ message_str << ">";
+ } else {
+ str << "<" << speaker << ">";
+ }
} else {
- str << "*" << speaker << "*";
+ if(action) {
+ str << "*" << speaker;
+ message_str << "*";
+ } else {
+ str << "*" << speaker << "*";
+ }
}
- std::stringstream message_str;
- message_str << msg;
-
SDL_Color speaker_colour = {255,255,255,255};
if(side >= 1) {
speaker_colour = team::get_side_colour(side);