mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
check for even number of escape characters
to allow colored names, while preventing invalid escape characters
This commit is contained in:
parent
6ddb7388cc
commit
c3c4ba6b0a
1 changed files with 3 additions and 1 deletions
|
|
@ -329,13 +329,15 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
|
|||
|
||||
bool djui_panel_player_name_valid(char* buffer) {
|
||||
if (buffer[0] == '\0') { return false; }
|
||||
u16 numEscapeChars = 0;
|
||||
char* c = buffer;
|
||||
while (*c != '\0') {
|
||||
if (*c == ' ') { return false; }
|
||||
if (*c == '\\') { return false; }
|
||||
if (!djui_unicode_valid_char(c)) { return false; }
|
||||
if (*c == '\\') { numEscapeChars++; }
|
||||
c = djui_unicode_next_char(c);
|
||||
}
|
||||
if (numEscapeChars % 2 != 0) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue