(svn r6931) -Codechange: Change textmessage format a bit. Only the sender's name and target are
authorDarkvater
Tue, 24 Oct 2006 22:19:12 +0000
changeset 4943 c2005edc4f84
parent 4942 f990abfa4438
child 4944 c61494b1ec35
(svn r6931) -Codechange: Change textmessage format a bit. Only the sender's name and target are
in the sender's colour, the actual message is in white. Should improve readability.
lang/english.txt
network.c
network_gui.c
--- a/lang/english.txt	Tue Oct 24 19:19:25 2006 +0000
+++ b/lang/english.txt	Tue Oct 24 22:19:12 2006 +0000
@@ -1431,11 +1431,14 @@
 STR_NETWORK_CLIENT_JOINED                                       :has joined the game
 STR_NETWORK_GIVE_MONEY                                          :gave your company some money ({CURRENCY})
 STR_NETWORK_GAVE_MONEY_AWAY                                     :you gave {STRING} some money ({CURRENCY})
-STR_NETWORK_CHAT_COMPANY                                        :[Team] {STRING}:
-STR_NETWORK_CHAT_TO_COMPANY                                     :[Team] To {STRING}:
-STR_NETWORK_CHAT_CLIENT                                         :[Private] {STRING}:
-STR_NETWORK_CHAT_TO_CLIENT                                      :[Private] To {STRING}:
-STR_NETWORK_CHAT_ALL                                            :[All] {STRING}:
+STR_NETWORK_CHAT_COMPANY_CAPTION                                :[Team] :
+STR_NETWORK_CHAT_COMPANY                                        :[Team] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_TO_COMPANY                                     :[Team] To {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_CLIENT_CAPTION                                 :[Private] :
+STR_NETWORK_CHAT_CLIENT                                         :[Private] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_TO_CLIENT                                      :[Private] To {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_ALL_CAPTION                                    :[All] :
+STR_NETWORK_CHAT_ALL                                            :[All] {STRING}: {GRAY}{STRING}
 STR_NETWORK_NAME_CHANGE                                         :has changed his/her name to
 STR_NETWORK_SERVER_SHUTDOWN                                     :{WHITE} The server closed the session
 STR_NETWORK_SERVER_REBOOT                                       :{WHITE} The server is restarting...{}Please wait...
--- a/network.c	Tue Oct 24 19:19:25 2006 +0000
+++ b/network.c	Tue Oct 24 22:19:12 2006 +0000
@@ -150,36 +150,27 @@
 				snprintf(message, sizeof(message), "*** %s %s", name, temp);
 			}
 			break;
-		case NETWORK_ACTION_CHAT_COMPANY:
-			if (self_send) {
-				SetDParamStr(0, name);
-				GetString(temp, STR_NETWORK_CHAT_TO_COMPANY, lastof(temp));
-				snprintf(message, sizeof(message), "%s %s", temp, buf);
-			} else {
-				SetDParamStr(0, name);
-				GetString(temp, STR_NETWORK_CHAT_COMPANY, lastof(temp));
-				snprintf(message, sizeof(message), "%s %s", temp, buf);
-			}
-			break;
-		case NETWORK_ACTION_CHAT_CLIENT:
-			if (self_send) {
-				SetDParamStr(0, name);
-				GetString(temp, STR_NETWORK_CHAT_TO_CLIENT, lastof(temp));
-				snprintf(message, sizeof(message), "%s %s", temp, buf);
-			} else {
-				SetDParamStr(0, name);
-				GetString(temp, STR_NETWORK_CHAT_CLIENT, lastof(temp));
-				snprintf(message, sizeof(message), "%s %s", temp, buf);
-			}
-			break;
 		case NETWORK_ACTION_NAME_CHANGE:
 			GetString(temp, STR_NETWORK_NAME_CHANGE, lastof(temp));
 			snprintf(message, sizeof(message), "*** %s %s %s", name, temp, buf);
 			break;
+		case NETWORK_ACTION_CHAT_COMPANY:
+			SetDParamStr(0, name);
+			SetDParamStr(1, buf);
+			GetString(temp, self_send ? STR_NETWORK_CHAT_TO_COMPANY : STR_NETWORK_CHAT_COMPANY, lastof(temp));
+			ttd_strlcpy(message, temp, sizeof(message));
+			break;
+		case NETWORK_ACTION_CHAT_CLIENT:
+			SetDParamStr(0, name);
+			SetDParamStr(1, buf);
+			GetString(temp, self_send ? STR_NETWORK_CHAT_TO_CLIENT : STR_NETWORK_CHAT_CLIENT, lastof(temp));
+			ttd_strlcpy(message, temp, sizeof(message));
+			break;
 		default:
 			SetDParamStr(0, name);
+			SetDParamStr(1, buf);
 			GetString(temp, STR_NETWORK_CHAT_ALL, lastof(temp));
-			snprintf(message, sizeof(message), "%s %s", temp, buf);
+			ttd_strlcpy(message, temp, sizeof(message));
 			break;
 	}
 
--- a/network_gui.c	Tue Oct 24 19:19:25 2006 +0000
+++ b/network_gui.c	Tue Oct 24 22:19:12 2006 +0000
@@ -1632,9 +1632,9 @@
 
 	case WE_PAINT: {
 		static const StringID chat_captions[] = {
-			STR_NETWORK_CHAT_ALL,
-			STR_NETWORK_CHAT_COMPANY,
-			STR_NETWORK_CHAT_CLIENT
+			STR_NETWORK_CHAT_ALL_CAPTION,
+			STR_NETWORK_CHAT_COMPANY_CAPTION,
+			STR_NETWORK_CHAT_CLIENT_CAPTION
 		};
 		StringID msg;
 
@@ -1642,7 +1642,6 @@
 
 		assert(GB(WP(w, querystr_d).caption, 0, 8) < lengthof(chat_captions));
 		msg = chat_captions[GB(WP(w, querystr_d).caption, 0, 8)];
-		SetDParam(0, STR_EMPTY);
 		DrawStringRightAligned(w->widget[2].left - 2, w->widget[2].top + 1, msg, 16);
 		DrawEditBox(w, &WP(w, querystr_d), 2);
 	} break;