summaryrefslogtreecommitdiff
path: root/texteff.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-09-24 06:43:26 +0000
committertron <tron@openttd.org>2005-09-24 06:43:26 +0000
commit73d3667dc3aadfaa9061b47b46e653ee3fab13d6 (patch)
tree25b7a8190b2d9b4c570bdc50a99be5cc7b1e6810 /texteff.c
parent985bcc6af715cd123e9b489ebfcb79e7d5727f01 (diff)
downloadopenttd-73d3667dc3aadfaa9061b47b46e653ee3fab13d6.tar.xz
(svn r2981) Remove a no-op
Diffstat (limited to 'texteff.c')
-rw-r--r--texteff.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/texteff.c b/texteff.c
index 3e33a2dc6..18325cd05 100644
--- a/texteff.c
+++ b/texteff.c
@@ -55,7 +55,7 @@ extern void memcpy_pitch(void *d, void *s, int w, int h, int spitch, int dpitch)
// 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 @@ void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...
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 @@ void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...
// 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;