mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Add bounds check to textbox functions that use m
It seems to be a bit bad to blindly use `m` without checking it. In fact, this has caused a few segfaults already, actually.
This commit is contained in:
parent
a0f10d80e5
commit
c95c1ab250
1 changed files with 45 additions and 0 deletions
|
@ -1141,16 +1141,31 @@ void Graphics::textboxremove()
|
|||
|
||||
void Graphics::textboxtimer( int t )
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].timer=t;
|
||||
}
|
||||
|
||||
void Graphics::addline( std::string t )
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].addline(t);
|
||||
}
|
||||
|
||||
void Graphics::textboxadjust()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].adjust();
|
||||
}
|
||||
|
||||
|
@ -2787,33 +2802,63 @@ void Graphics::setwarprect( int a, int b, int c, int d )
|
|||
|
||||
void Graphics::textboxcenter()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centerx();
|
||||
textbox[m].centery();
|
||||
}
|
||||
|
||||
void Graphics::textboxcenterx()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centerx();
|
||||
}
|
||||
|
||||
int Graphics::textboxwidth()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return textbox[m].w;
|
||||
}
|
||||
|
||||
void Graphics::textboxmove(int xo, int yo)
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].xp += xo;
|
||||
textbox[m].yp += yo;
|
||||
}
|
||||
|
||||
void Graphics::textboxmoveto(int xo)
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].xp = xo;
|
||||
}
|
||||
|
||||
void Graphics::textboxcentery()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centery();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue