network.c
changeset 4943 c2005edc4f84
parent 4912 d04b3f2bca70
child 4944 c61494b1ec35
--- 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;
 	}