mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
M_BuildConditionSetString: Fix capitalisation rules to prevent "NO CONTEST On GREEN HILLS"
(The desired version of the string is "NO CONTEST on GREEN HILLS".) Instead, searches for the first ':'. - If found, goes to the first non-whitespace character afterwards and toupper's it. - If not, goes to the first non-whitespace character at all and toupper's it.
This commit is contained in:
parent
412107c140
commit
7b917930d4
1 changed files with 23 additions and 5 deletions
28
src/m_cond.c
28
src/m_cond.c
|
|
@ -1511,12 +1511,30 @@ char *M_BuildConditionSetString(UINT8 unlockid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; message[i]; i++)
|
// Valid sentence capitalisation handling.
|
||||||
{
|
{
|
||||||
if (message[i] == toupper(message[i]))
|
// Finds the first : character, indicating the end of the prefix.
|
||||||
continue;
|
for (i = 0; message[i]; i++)
|
||||||
message[i] = toupper(message[i]);
|
{
|
||||||
break;
|
if (message[i] != ':')
|
||||||
|
continue;
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we didn't find a prefix, just start from the first character again.
|
||||||
|
if (!message[i])
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
// Okay, now make the first non-whitespace character after the prefix a capital.
|
||||||
|
// Doesn't matter if !isalpha() - toupper is a no-op.
|
||||||
|
for (; message[i]; i++)
|
||||||
|
{
|
||||||
|
if ((message[i] & 0x80) || isspace(message[i]))
|
||||||
|
continue;
|
||||||
|
message[i] = toupper(message[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue