mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 01:29:43 +01:00
Add assert for giving func if it won't be used
This adds an assert to Graphics::textboxtranslate() to make sure that callers don't accidentally provide a function when specifying a translation type that isn't TEXTTRANSLATE_FUNCTION, because in that case the function won't be used, and then it will make them scratch their heads wondering why their function won't work. And yes, I am stupid enough to blindly type TEXTTRANSLATE_CUTSCENE when I meant to type TEXTTRANSLATE_FUNCTION. This assert has already caught one of my mistakes. :)
This commit is contained in:
parent
76483f96ef
commit
668d0c744d
1 changed files with 5 additions and 0 deletions
|
@ -3361,6 +3361,11 @@ void Graphics::textboxtranslate(const TextboxTranslate translate, const TextboxF
|
|||
SDL_assert(0 && "function is NULL!");
|
||||
return;
|
||||
}
|
||||
if (translate != TEXTTRANSLATE_FUNCTION && function != NULL)
|
||||
{
|
||||
SDL_assert(0 && "function provided when it won't be used!");
|
||||
return;
|
||||
}
|
||||
|
||||
textboxes[m].translate = translate;
|
||||
textboxes[m].function = function;
|
||||
|
|
Loading…
Reference in a new issue