merged commit 2006-10-19T12:48:28Z!rusty@rustcorp.com.au from 1.2

This commit is contained in:
Mark de Wever 2007-02-24 22:54:40 +00:00
parent dada2d48e1
commit 7bf5325486
7 changed files with 16 additions and 14 deletions

View file

@ -348,7 +348,7 @@ void ai_interface::diagnostic(const std::string& msg)
void ai_interface::log_message(const std::string& msg)
{
if(game_config::debug) {
info_.disp.add_chat_message("ai",info_.team_num,msg,display::MESSAGE_PUBLIC);
info_.disp.add_chat_message("ai",info_.team_num,msg,display::MESSAGE_PUBLIC,false);
}
}

View file

@ -2395,7 +2395,7 @@ namespace {
const SDL_Color chat_message_bg = {0,0,0,140};
}
void display::add_chat_message(const std::string& speaker, int side, const std::string& message, display::MESSAGE_TYPE type)
void display::add_chat_message(const std::string& speaker, int side, const std::string& message, display::MESSAGE_TYPE type, bool bell)
{
config* cignore;
bool ignored = false;
@ -2414,6 +2414,10 @@ void display::add_chat_message(const std::string& speaker, int side, const std::
bool action;
std::string msg;
if (bell) {
sound::play_sound(game_config::sounds::receive_message);
}
if(message.find("/me ") == 0) {
msg.assign(message,4,message.size());
action = true;

View file

@ -377,7 +377,7 @@ public:
void set_diagnostic(const std::string& msg);
enum MESSAGE_TYPE { MESSAGE_PUBLIC, MESSAGE_PRIVATE };
void add_chat_message(const std::string& speaker, int side, const std::string& msg, MESSAGE_TYPE type);
void add_chat_message(const std::string& speaker, int side, const std::string& msg, MESSAGE_TYPE type, bool bell);
void clear_chat_messages() { prune_chat_messages(true); }
//function to draw the image of a unit at a certain location

View file

@ -181,7 +181,7 @@ namespace gui{
completion_list += " ";
completion_list += *it;
}
gui.add_chat_message("",0,completion_list,display::MESSAGE_PRIVATE);
gui.add_chat_message("",0,completion_list,display::MESSAGE_PRIVATE,false);
}
box_->set_text(text);
}

View file

@ -1483,7 +1483,7 @@ namespace events{
void menu_handler::add_chat_message(const std::string& speaker, int side, const std::string& message, display::MESSAGE_TYPE type)
{
gui_->add_chat_message(speaker,side,message,type);
gui_->add_chat_message(speaker,side,message,type,false);
}
chat_handler::~chat_handler()

View file

@ -72,7 +72,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
sound::play_sound(game_config::sounds::receive_message);
const config& cwhisper = *cfg.child("whisper");
gui_.add_chat_message("whisper: "+cwhisper["sender"],0,cwhisper["message"], display::MESSAGE_PRIVATE);
gui_.add_chat_message("whisper: "+cwhisper["sender"],0,cwhisper["message"], display::MESSAGE_PRIVATE, preferences::message_bell());
}
if(cfg.child("observer") != NULL) {
const config::child_list& observers = cfg.get_children("observer");

View file

@ -625,7 +625,7 @@ void check_checksums(display& disp,const unit_map& units,const config& cfg)
if(u == units.end()) {
std::stringstream message;
message << "non existant unit to checksum at " << loc.x+1 << "," << loc.y+1 << "!";
disp.add_chat_message("verification",1,message.str(),display::MESSAGE_PRIVATE);
disp.add_chat_message("verification",1,message.str(),display::MESSAGE_PRIVATE,false);
continue;
}
std::string check;
@ -633,7 +633,7 @@ void check_checksums(display& disp,const unit_map& units,const config& cfg)
if(check != (**ci)["value"]) {
std::stringstream message;
message << "checksum mismatch at " << loc.x+1 << "," << loc.y+1 << "!";
disp.add_chat_message("verification",1,message.str(),display::MESSAGE_PRIVATE);
disp.add_chat_message("verification",1,message.str(),display::MESSAGE_PRIVATE,false);
}
}
}
@ -726,14 +726,12 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
bool is_lobby_join_of_friend = ((*cignore)[buf] == "friend");
bool is_whisper = (speaker_name.find("whisper: ") == 0);
if((!replayer.is_skipping() || is_whisper) &&
(!is_lobby_join || ((is_lobby_join && preferences::lobby_joins() == preferences::SHOW_ALL) || (is_lobby_join_of_friend && preferences::lobby_joins() == preferences::SHOW_FRIENDS)))) {
if(preferences::message_bell()) {
sound::play_sound(game_config::sounds::receive_message);
}
(!is_lobby_join ||
((is_lobby_join && preferences::lobby_joins() == preferences::SHOW_ALL) ||
(is_lobby_join_of_friend && preferences::lobby_joins() == preferences::SHOW_FRIENDS)))) {
const int side = lexical_cast_default<int>((*child)["side"].c_str(),0);
disp.add_chat_message(speaker_name,side,(*child)["message"],
team_name == "" ? display::MESSAGE_PUBLIC : display::MESSAGE_PRIVATE);
team_name == "" ? display::MESSAGE_PUBLIC : display::MESSAGE_PRIVATE, preferences::message_bell());
}
}
} else if((child = cfg->child("label")) != NULL) {