fixed a crash that would occur when hugging the bottem edge of a menu with one option example: auto=choice sacrifice

This commit is contained in:
omegablast2002@yahoo.com
2012-03-25 19:39:10 +00:00
parent 142fcef4c4
commit bf88bee58a

View File

@@ -247,7 +247,14 @@ bool SimpleMenu::CheckUserInput(JButton key)
if (y < menuTopEdge)
n = (mCurr - 1) > 0 ? mCurr -1 : 0;
else if (y >= menuBottomEdge)
n = (mCurr + 1) < mCount ? mCurr + 1 : mCurr - 1;
{
if(mCurr +1 < mCount)
n = mCurr + 1;
else if(mCurr - 1 > 0)
n = mCurr - 1;
else
n = 0;
}
else
{
for (int i = 0; i < mCount; i++)
@@ -259,7 +266,6 @@ bool SimpleMenu::CheckUserInput(JButton key)
}
}
}
// check to see if the user clicked
if (n != mCurr && mObjects[mCurr] != NULL && mObjects[mCurr]->Leaving(JGE_BTN_DOWN))
{