News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[Chat windows] Company message ticker never happens

Started by Yona-TYT, August 28, 2024, 10:24:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

simmesg.cc (line 404)

show_message |= channel == world()->get_active_player_nr(); // company message for us?
This condition is never met because company messages are only seen by the player using the same company that sent the message, but it seems that "send this message to a ticker if public channel message" is not executed if the player uses the same company as the sender.

Edit.

This fixes the problem:
// send this message to a ticker if public channel message
if (channel >= -1) {
if (sender_nr >= 0  &&  sender_nr != PLAYER_UNOWNED) {
bool company = channel == world()->get_active_player_nr();
if (player != world()->get_active_player() || company) {
// so it is not a message sent from us
bool show_message = channel == -1; // message for all?
show_message |= company == true; // company message for us?
show_message |= recipient && strcmp(recipient, env_t::nickname.c_str()) == 0; // private chat for us?
if(show_message) {
buf.printf("%s: %s", sender_.c_str(), text);
ticker::add_msg(buf, koord3d::invalid, PLAYER_FLAG|sender_nr);
env_t::chat_unread_public++;
sound_play(sound_desc_t::message_sound, 255, TOOL_SOUND);
}
}
}
}

prissi