(uprnf): A print function must not change its text argument!

This commit is contained in:
Markus Armbruster 2005-06-13 18:28:10 +00:00
parent b5ff7e3beb
commit 1bf1b5b303

View file

@ -73,12 +73,20 @@ pr(char *format, ...)
pr_player(player, C_DATA, buf);
}
/*
* Print UTF-8 text BUF to current player.
*/
void
uprnf(char *buf /* buf is message text */)
uprnf(char *buf)
{
if (!(player->flags & PF_UTF8))
copy_utf8_to_ascii_no_funny(buf, buf);
char *p;
if (!(player->flags & PF_UTF8)) {
p = malloc(strlen(buf) + 1);
copy_utf8_to_ascii_no_funny(p, buf);
pr_player(player, C_DATA, p);
free(p);
} else
pr_player(player, C_DATA, buf);
}