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
20
src/m_cond.c
20
src/m_cond.c
|
|
@ -1511,13 +1511,31 @@ char *M_BuildConditionSetString(UINT8 unlockid)
|
|||
}
|
||||
}
|
||||
|
||||
// Valid sentence capitalisation handling.
|
||||
{
|
||||
// Finds the first : character, indicating the end of the prefix.
|
||||
for (i = 0; message[i]; i++)
|
||||
{
|
||||
if (message[i] == toupper(message[i]))
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue