Obj_AudienceInit: Improve follower name processing

- Convert underscores to spaces for string comparison
- Report typoes to the user
This commit is contained in:
toaster 2023-04-21 21:07:14 +01:00
parent c7cc730c35
commit 3dd44961a0

View file

@ -43,11 +43,21 @@ Obj_AudienceInit
// From mapthing
char *stringcopy = Z_StrDup(mthing->stringargs[0]);
char *tok = strtok(stringcopy, " ,");
char *c; // for erasing underscores
numref = 0;
while (tok && numref < MAXHEADERFOLLOWERS)
{
tempreflist[numref++] = K_FollowerAvailable(tok);
// Match follower name conversion
for (c = tok; *c; c++)
{
if (*c != '_')
continue;
*c = ' ';
}
if ((tempreflist[numref++] = K_FollowerAvailable(tok)) == -1)
CONS_Alert(CONS_WARNING, "Mapthing %s: Follower \"%s\" is invalid!\n", sizeu1(mthing-mapthings), tok);
tok = strtok(NULL, " ,");
}