enable "teamchat" for observers in multiplayer games
This commit is contained in:
parent
69dd48409d
commit
9bc6613ff3
8 changed files with 26 additions and 13 deletions
|
@ -34,6 +34,7 @@ Version 1.3.6+svn:
|
|||
the selected game (bug #7471)
|
||||
* multiplayer lobby: tab completion works for all player names now,
|
||||
not only for those which are not in a game (bug #9350)
|
||||
* enable "teamchat" for observers
|
||||
* graphics
|
||||
* fixed a glitch with the undo of recruit or recall on high places.
|
||||
* Improve rendering of "black stripes": don't hide footsteps and fog
|
||||
|
|
|
@ -21,6 +21,8 @@ Version 1.3.6+svn:
|
|||
* The random starting time of day setting is will now be remembered if
|
||||
"Use map settings" is used.
|
||||
* The "Soul Shooter" is now renamed to "Banebow".
|
||||
* The players in the selected game in the server lobby are highlighted now.
|
||||
* Observers can now chat as a "team" (without disturbing the players).
|
||||
|
||||
* User interface
|
||||
* Enable "Save Game" and "View Chat Log" menu entries in replay mode.
|
||||
|
|
|
@ -672,27 +672,26 @@ namespace events{
|
|||
void menu_handler::speak()
|
||||
{
|
||||
textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"),
|
||||
has_friends() ? _("Send to allies only") : "", preferences::message_private(), *gui_);
|
||||
has_friends() ? is_observer() ? _("Send to observers only") : _("Send to allies only")
|
||||
: "", preferences::message_private(), *gui_);
|
||||
}
|
||||
|
||||
void menu_handler::whisper()
|
||||
{
|
||||
preferences::set_message_private(true);
|
||||
textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"),
|
||||
has_friends() ? _("Send to allies only") : "", true, *gui_);
|
||||
speak();
|
||||
}
|
||||
|
||||
void menu_handler::shout()
|
||||
{
|
||||
preferences::set_message_private(false);
|
||||
textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"),
|
||||
has_friends() ? _("Send to allies only") : "", false, *gui_);
|
||||
speak();
|
||||
}
|
||||
|
||||
bool menu_handler::has_friends() const
|
||||
{
|
||||
if(is_observer()) {
|
||||
return false;
|
||||
return !gui_->observers().empty();
|
||||
}
|
||||
|
||||
for(size_t n = 0; n != teams_.size(); ++n) {
|
||||
|
@ -1734,7 +1733,11 @@ namespace events{
|
|||
bool private_message = has_friends() && allies_only;
|
||||
|
||||
if(private_message) {
|
||||
cfg["team_name"] = teams_[gui_->viewing_team()].team_name();
|
||||
if (is_observer()) {
|
||||
cfg["team_name"] = "observer";
|
||||
} else {
|
||||
cfg["team_name"] = teams_[gui_->viewing_team()].team_name();
|
||||
}
|
||||
}
|
||||
|
||||
recorder.speak(cfg);
|
||||
|
|
|
@ -350,9 +350,9 @@ bool playmp_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
|
|||
bool res = true;
|
||||
switch (command){
|
||||
case hotkey::HOTKEY_CLEAR_LABELS:
|
||||
case hotkey::HOTKEY_SPEAK_ALLY:
|
||||
res = !is_observer();
|
||||
case hotkey::HOTKEY_SPEAK:
|
||||
case hotkey::HOTKEY_SPEAK_ALLY:
|
||||
case hotkey::HOTKEY_SPEAK_ALL:
|
||||
res = res && network::nconnections() > 0;
|
||||
break;
|
||||
|
|
|
@ -718,7 +718,8 @@ bool do_replay(game_display& disp, const gamemap& map, const game_data& gameinfo
|
|||
} else if((child = cfg->child("speak")) != NULL) {
|
||||
const std::string& team_name = (*child)["team_name"];
|
||||
const std::string& speaker_name = (*child)["description"];
|
||||
if(team_name == "" || teams[disp.viewing_team()].team_name() == team_name) {
|
||||
if (team_name == "" || !is_observer() && teams[disp.viewing_team()].team_name() == team_name
|
||||
|| is_observer() && team_name == "observer") {
|
||||
bool is_lobby_join = (speaker_name == "server"
|
||||
&& (*child)["message"].value().find("has logged into the lobby") != std::string::npos);
|
||||
std::string str = (*child)["message"];
|
||||
|
|
|
@ -836,10 +836,12 @@ void game::send_data_team(const config& data, const std::string& team, network::
|
|||
}
|
||||
}
|
||||
|
||||
void game::send_data_observers(const config& data)
|
||||
void game::send_data_observers(const config& data, network::connection exclude)
|
||||
{
|
||||
for(std::vector<network::connection>::const_iterator i = observers_.begin(); i != observers_.end(); ++i) {
|
||||
network::queue_data(data,*i);
|
||||
if (*i != exclude) {
|
||||
network::queue_data(data,*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
config construct_server_message(const std::string& message);
|
||||
void send_data(const config& data, network::connection exclude=0);
|
||||
void send_data_team(const config& data, const std::string& team, network::connection exclude=0);
|
||||
void send_data_observers(const config& data);
|
||||
void send_data_observers(const config& data, network::connection exclude=0);
|
||||
|
||||
void record_data(const config& data);
|
||||
void reset_history();
|
||||
|
|
|
@ -1305,7 +1305,11 @@ void server::process_data_from_player_in_game(const network::connection sock, co
|
|||
//if all there are are messages and they're all private, then
|
||||
//just forward them on to the client that should receive them.
|
||||
if(nprivate > 0 && npublic == 0 && nother == 0) {
|
||||
g->send_data_team(data,team_name,sock);
|
||||
if (team_name == "observer") {
|
||||
g->send_data_observers(data,sock);
|
||||
} else {
|
||||
g->send_data_team(data,team_name,sock);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue