(svn r7173) -Codechange (r6824): Allow the user to change the chat-destination when chatting with <ENTER> or 'T' instead of the game choosing one for you automatically.
authorDarkvater
Thu, 16 Nov 2006 17:44:04 +0000
changeset 5102 ce4b27298f90
parent 5101 797a070e5b22
child 5103 db210d789741
(svn r7173) -Codechange (r6824): Allow the user to change the chat-destination when chatting with <ENTER> or 'T' instead of the game choosing one for you automatically.
lang/english.txt
main_gui.c
settings.c
settings_gui.c
variables.h
--- a/lang/english.txt	Thu Nov 16 17:41:24 2006 +0000
+++ b/lang/english.txt	Thu Nov 16 17:44:04 2006 +0000
@@ -1070,6 +1070,7 @@
 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 <ENTER>: {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}
--- a/main_gui.c	Thu Nov 16 17:41:24 2006 +0000
+++ b/main_gui.c	Thu Nov 16 17:44:04 2006 +0000
@@ -2298,23 +2298,10 @@
 				break;
 
 #ifdef ENABLE_NETWORK
-			case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all
+			case WKC_RETURN: case 'T': // send to all players or to your team depending on setting
 				if (_networking) {
-					const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index);
-					bool has_team = false;
-
-					/* Only players actually playing can speak to team. Eg spectators cannot */
-					if (IsValidPlayer(cio->client_playas)) {
-						const NetworkClientInfo *ci;
-						FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
-							if (ci->client_playas == cio->client_playas && ci != cio) {
-								has_team = true;
-								break;
-							}
-						}
-					}
-
-					ShowNetworkChatQueryWindow(has_team ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas);
+					const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
+					ShowNetworkChatQueryWindow(_patches.chat_target ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, ci->client_playas);
 					break;
 				}
 				break;
--- a/settings.c	Thu Nov 16 17:41:24 2006 +0000
+++ b/settings.c	Thu Nov 16 17:44:04 2006 +0000
@@ -1266,6 +1266,7 @@
 	 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),
 
 	/***************************************************************************/
 	/* Construction section of the GUI-configure patches window */
--- a/settings_gui.c	Thu Nov 16 17:41:24 2006 +0000
+++ b/settings_gui.c	Thu Nov 16 17:44:04 2006 +0000
@@ -572,6 +572,7 @@
 	"population_in_label",
 	"link_terraform_toolbar",
 	"liveries",
+	"chat_target",
 };
 
 static const char *_patches_construction[] = {
--- a/variables.h	Thu Nov 16 17:41:24 2006 +0000
+++ b/variables.h	Thu Nov 16 17:44:04 2006 +0000
@@ -127,6 +127,7 @@
 	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 <ENTER>, 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