From 40d647ddde652bb8f1c7b4215279cc82d01ca38f Mon Sep 17 00:00:00 2001 From: Darkvater Date: Thu, 16 Nov 2006 20:57:23 +0000 Subject: (svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of always sending to teammate if the patch is on even if you do not have any allies. So with setting off you always send to 'all players', with setting on you send to teammates if you have any, otherwise to all players. --- lang/english.txt | 2 +- main_gui.c | 20 ++++++++++++++++---- settings.c | 2 +- settings_gui.c | 2 +- variables.h | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lang/english.txt b/lang/english.txt index f6113e811..9b1433685 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1070,7 +1070,7 @@ STR_CONFIG_PATCHES_LIVERIES :{LTBLUE}Show co STR_CONFIG_PATCHES_LIVERIES_NONE :None STR_CONFIG_PATCHES_LIVERIES_OWN :Own company STR_CONFIG_PATCHES_LIVERIES_ALL :All companies -STR_CONFIG_PATCHES_CHAT_TARGET :{LTBLUE}Prefer Team chat with : {ORANGE}{STRING1} +STR_CONFIG_PATCHES_PREFER_TEAMCHAT :{LTBLUE}Prefer team chat with : {ORANGE}{STRING1} STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Max trains per player: {ORANGE}{STRING1} STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}Max road vehicles per player: {ORANGE}{STRING1} diff --git a/main_gui.c b/main_gui.c index 96d91cd5e..0c759a39d 100644 --- a/main_gui.c +++ b/main_gui.c @@ -2298,11 +2298,23 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) break; #ifdef ENABLE_NETWORK - case WKC_RETURN: case 'T': // send to all players or to your team depending on setting + case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all if (_networking) { - const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index); - ShowNetworkChatQueryWindow(_patches.chat_target ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, ci->client_playas); - break; + const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); + bool teamchat = false; + + /* Only players actually playing can speak to team. Eg spectators cannot */ + if (_patches.prefer_teamchat && IsValidPlayer(cio->client_playas)) { + const NetworkClientInfo *ci; + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { + if (ci->client_playas == cio->client_playas && ci != cio) { + teamchat = true; + break; + } + } + } + + ShowNetworkChatQueryWindow(teamchat ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas); } break; diff --git a/settings.c b/settings.c index 0f33044f9..91213d02a 100644 --- a/settings.c +++ b/settings.c @@ -1266,7 +1266,7 @@ const SettingDesc _patch_settings[] = { SDT_VAR(Patches, map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL), SDT_BOOL(Patches, link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,NULL), SDT_VAR(Patches, liveries, SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_LIVERIES, RedrawScreen), - SDT_BOOL(Patches, chat_target, S, 0, false, STR_CONFIG_PATCHES_CHAT_TARGET, NULL), + SDT_BOOL(Patches, prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL), /***************************************************************************/ /* Construction section of the GUI-configure patches window */ diff --git a/settings_gui.c b/settings_gui.c index 6ffe6153d..7af75a6a6 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -572,7 +572,7 @@ static const char *_patches_ui[] = { "population_in_label", "link_terraform_toolbar", "liveries", - "chat_target", + "prefer_teamchat", }; static const char *_patches_construction[] = { diff --git a/variables.h b/variables.h index af4d26636..d1f213a62 100644 --- a/variables.h +++ b/variables.h @@ -127,7 +127,7 @@ typedef struct Patches { bool reverse_scroll; // Right-Click-Scrolling scrolls in the opposite direction bool measure_tooltip; // Show a permanent tooltip when dragging tools byte liveries; // Options for displaying company liveries, 0=none, 1=self, 2=all - bool chat_target; // Choose the chat message target with , true=all players, false=your team + bool prefer_teamchat; // Choose the chat message target with , true=all players, false=your team uint8 toolbar_pos; // position of toolbars, 0=left, 1=center, 2=right uint8 window_snap_radius; // Windows snap at each other if closer than this -- cgit v1.2.3-54-g00ecf