(svn r2981) Remove a no-op
authortron
Sat, 24 Sep 2005 06:43:26 +0000
changeset 2455 43283b066cc4
parent 2454 a63075764541
child 2456 2317dd6f4b19
(svn r2981) Remove a no-op
texteff.c
--- a/texteff.c	Fri Sep 23 23:23:01 2005 +0000
+++ b/texteff.c	Sat Sep 24 06:43:26 2005 +0000
@@ -55,7 +55,7 @@
 // Duration is in game-days
 void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...)
 {
-	char buf[MAX_TEXTMESSAGE_LENGTH], buf2[MAX_TEXTMESSAGE_LENGTH];
+	char buf[MAX_TEXTMESSAGE_LENGTH];
 	va_list va;
 	int i, length;
 
@@ -67,15 +67,14 @@
 	if ((color & 0xFF) == 0xC9) color = 0x1CA;
 
 	/* Cut the message till it fits inside the chatbox */
-	snprintf(buf2, lengthof(buf2), "%s", buf); // remove any formatting
-	length = strlen(buf2);
-	while (GetStringWidth(buf2) > _textmessage_width - 9) buf2[--length] = '\0';
+	length = strlen(buf);
+	while (GetStringWidth(buf) > _textmessage_width - 9) buf[--length] = '\0';
 
 	/* Find an empty spot and put the message there */
 	for (i = 0; i < MAX_CHAT_MESSAGES; i++) {
 		if (_text_message_list[i].message[0] == '\0') {
 			// Empty spot
-			ttd_strlcpy(_text_message_list[i].message, buf2, sizeof(_text_message_list[i].message));
+			ttd_strlcpy(_text_message_list[i].message, buf, sizeof(_text_message_list[i].message));
 			_text_message_list[i].color = color;
 			_text_message_list[i].end_date = _date + duration;
 
@@ -86,7 +85,7 @@
 
 	// We did not found a free spot, trash the first one, and add to the end
 	memmove(&_text_message_list[0], &_text_message_list[1], sizeof(_text_message_list[0]) * (MAX_CHAT_MESSAGES - 1));
-	ttd_strlcpy(_text_message_list[MAX_CHAT_MESSAGES - 1].message, buf2, sizeof(_text_message_list[MAX_CHAT_MESSAGES - 1].message));
+	ttd_strlcpy(_text_message_list[MAX_CHAT_MESSAGES - 1].message, buf, sizeof(_text_message_list[MAX_CHAT_MESSAGES - 1].message));
 	_text_message_list[MAX_CHAT_MESSAGES - 1].color = color;
 	_text_message_list[MAX_CHAT_MESSAGES - 1].end_date = _date + duration;