Skip to content

Commit

Permalink
Further fix to the player message log (messages truncated one charact…
Browse files Browse the repository at this point in the history
…er short).
  • Loading branch information
danij committed Jun 14, 2009
1 parent 23ecab9 commit e2be205
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions doomsday/plugins/common/src/hu_log.c
Expand Up @@ -148,18 +148,14 @@ static void logPush(msglog_t* log, const char* txt, int tics)
len = strlen(txt);
msg = &log->msgs[log->nextMsg];

if(len > msg->maxLen)
if(len >= msg->maxLen)
{
msg->text = realloc(msg->text, len + 1);
msg->maxLen = len;
}
else
{
memset(msg->text, 0, msg->maxLen);
msg->text = realloc(msg->text, msg->maxLen+1);
}

dd_snprintf(msg->text, len, "%s", txt);
msg->text[len] = '\0';
memset(msg->text, 0, msg->maxLen+1);
dd_snprintf(msg->text, msg->maxLen+1, "%s", txt);
msg->ticsRemain = msg->tics = tics;
msg->flags = MF_JUSTADDED;

Expand Down

0 comments on commit e2be205

Please sign in to comment.