summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-24 22:19:12 +0000
committerDarkvater <darkvater@openttd.org>2006-10-24 22:19:12 +0000
commitbc018eb7acba986b71405ab1694d13207c0c72fd (patch)
treece3b39baf2cb4bc634febfbd26bcaf15dd2401ea
parentf48c419467197418d1f2b426cfcf1ee3e1bf554b (diff)
downloadopenttd-bc018eb7acba986b71405ab1694d13207c0c72fd.tar.xz
(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.
-rw-r--r--lang/english.txt13
-rw-r--r--network.c37
-rw-r--r--network_gui.c7
3 files changed, 25 insertions, 32 deletions
diff --git a/lang/english.txt b/lang/english.txt
index cb8826eec..ce0b0e15e 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -1431,11 +1431,14 @@ STR_NETWORK_ERR_CLIENT_SERVER_FULL :server full
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...
diff --git a/network.c b/network.c
index 5742eb045..377a1681c 100644
--- a/network.c
+++ b/network.c
@@ -150,36 +150,27 @@ void CDECL NetworkTextMessage(NetworkAction action, uint16 color, bool self_send
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;
}
diff --git a/network_gui.c b/network_gui.c
index 3b55b3aad..a51cc78b0 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1632,9 +1632,9 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
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 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
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;