- Don't record pointers to OptionValues outside of the OptionValues table, so that they can be redefined.
SVN r3675 (trunk)
This commit is contained in:
parent
9e31ff0799
commit
36d348dba6
3 changed files with 39 additions and 38 deletions
|
|
@ -169,12 +169,16 @@ public:
|
|||
int GetSelection()
|
||||
{
|
||||
double f = SELECTED_JOYSTICK->GetAxisMap(mAxis);
|
||||
// Map from joystick axis to menu selection.
|
||||
for(unsigned i=0;i<mValues->mValues.Size(); i++)
|
||||
FOptionValues **opt = OptionValues.CheckKey(mValues);
|
||||
if (opt != NULL && *opt != NULL)
|
||||
{
|
||||
if (fabs(f - mValues->mValues[i].Value) < FLT_EPSILON)
|
||||
// Map from joystick axis to menu selection.
|
||||
for(unsigned i = 0; i < (*opt)->mValues.Size(); i++)
|
||||
{
|
||||
return i;
|
||||
if (fabs(f - (*opt)->mValues[i].Value) < FLT_EPSILON)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
|
@ -182,14 +186,15 @@ public:
|
|||
|
||||
void SetSelection(int selection)
|
||||
{
|
||||
FOptionValues **opt = OptionValues.CheckKey(mValues);
|
||||
// Map from menu selection to joystick axis.
|
||||
if ((unsigned)selection >= mValues->mValues.Size())
|
||||
if (opt == NULL || *opt == NULL || (unsigned)selection >= (*opt)->mValues.Size())
|
||||
{
|
||||
selection = JOYAXIS_None;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection = (int)mValues->mValues[selection].Value;
|
||||
selection = (int)(*opt)->mValues[selection].Value;
|
||||
}
|
||||
SELECTED_JOYSTICK->SetAxisMap(mAxis, (EJoyAxis)selection);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue