1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Do not close game if fallback character is missing

It's quite rude to close the game. Especially if the user does not use
the console. They won't know why the game closed.

Instead, just return -1. All usages of font_idx() should be and are
bounds checked anyways. This will result in missing characters, but,
it's not like the characters had a font image in the first place,
otherwise we wouldn't be here. And if the user sees a bunch of
characters missing in their font, they'll probably work out what the
problem is even without having a console. And it's still far better than
abruptly closing the game.

And use WHINE_ONCE to prevent spamming the console.
This commit is contained in:
Misa 2021-08-06 21:06:04 -07:00 committed by Ethan Lee
parent 3094ddb8f3
commit 1841f1886a

View file

@ -258,8 +258,8 @@ int Graphics::font_idx(uint32_t ch)
iter = font_positions.find('?');
if (iter == font_positions.end())
{
puts("font.txt missing fallback character!");
VVV_exit(1);
WHINE_ONCE("font.txt missing fallback character!");
return -1;
}
}
return iter->second;