mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-03 06:20:57 +00:00
host_cmd.c (Host_SavegameComment): Remove CR/LFs from level name.
Avoids broken saves, e.g. with autumn_sp map. See: https://celephais.net/board/view_thread.php?id=60452&start=3666
This commit is contained in:
parent
9c9e45d9bb
commit
15a41d2169
1 changed files with 11 additions and 0 deletions
|
@ -1000,9 +1000,18 @@ void Host_SavegameComment (char *text)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char kills[20];
|
char kills[20];
|
||||||
|
char *p1, *p2;
|
||||||
|
|
||||||
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||||
text[i] = ' ';
|
text[i] = ' ';
|
||||||
|
|
||||||
|
// Remove CR/LFs from level name to avoid broken saves, e.g. with autumn_sp map:
|
||||||
|
// https://celephais.net/board/view_thread.php?id=60452&start=3666
|
||||||
|
p1 = strchr(cl.levelname, '\n');
|
||||||
|
p2 = strchr(cl.levelname, '\r');
|
||||||
|
if (p1 != NULL) *p1 = 0;
|
||||||
|
if (p2 != NULL) *p2 = 0;
|
||||||
|
|
||||||
memcpy (text, cl.levelname, q_min(strlen(cl.levelname),22)); //johnfitz -- only copy 22 chars.
|
memcpy (text, cl.levelname, q_min(strlen(cl.levelname),22)); //johnfitz -- only copy 22 chars.
|
||||||
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||||
memcpy (text+22, kills, strlen(kills));
|
memcpy (text+22, kills, strlen(kills));
|
||||||
|
@ -1012,6 +1021,8 @@ void Host_SavegameComment (char *text)
|
||||||
if (text[i] == ' ')
|
if (text[i] == ' ')
|
||||||
text[i] = '_';
|
text[i] = '_';
|
||||||
}
|
}
|
||||||
|
if (p1 != NULL) *p1 = '\n';
|
||||||
|
if (p2 != NULL) *p2 = '\r';
|
||||||
text[SAVEGAME_COMMENT_LENGTH] = '\0';
|
text[SAVEGAME_COMMENT_LENGTH] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue