void _cmsg_add_aux(byte color, cptr str, int turn, int count) { msg_ptr m; /* Repeat last message? */ if (_msg_count) { m = msg_get(0); if (strcmp(string_buffer(m->msg), str) == 0) { m->count += count; m->turn = turn; m->color = color; return; } } m = _msgs[_msg_head]; if (!m) { m = _msg_alloc(NULL); _msgs[_msg_head] = m; _msg_count++; } else { string_clear(m->msg); string_shrink(m->msg, 128); } string_append_s(m->msg, str); m->turn = turn; m->count = count; m->color = color; _msg_head = (_msg_head + 1) % _msg_max; }
void string_trim(string_ptr str) { string_shrink(str, 0); }
void string_trim(string_t *str) { string_shrink(str, 0); }