Fixed the controls crash

This commit is contained in:
George Sokianos 2022-08-22 19:40:53 +01:00
parent 3b3fe085fa
commit 0ab9bfac9d
3 changed files with 10 additions and 7 deletions

View File

@ -80,7 +80,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NUM_ATLAS_BUCKETS 64
#define NUM_GLYPH_BUCKETS 128
#define MAX_STARS 250
#define MAX_STARS 100
#define MAX_CHALLENGES 3

View File

@ -180,8 +180,6 @@ static void changeWindowSize(char *value)
static void changeEffectsReduction(char *value)
{
app.effects = atoi(value);
// Mix_Volume(-1, app.effects * MIX_MAX_VOLUME / 10);
}
static void changeSoundVolume(char *value)

View File

@ -59,7 +59,7 @@ void doWidgets(void)
if (drawingWidgets)
{
updateSelectWidgets();
handleMouse();
handleKeyboard();
@ -69,17 +69,21 @@ void doWidgets(void)
handleControlWidgets();
}
}
#if !defined(__amigaos4__)
if (hoverWidget != selectedWidget)
{
selectedWidget = NULL;
}
#endif
drawingWidgets = 0;
}
static void updateSelectWidgets(void)
{
#if !defined(__amigaos4__)
Widget *w;
for (w = head.next; w != NULL ; w = w->next)
@ -99,6 +103,7 @@ static void updateSelectWidgets(void)
}
}
}
#endif
}
Widget *getWidget(const char *name, const char *group)
@ -320,7 +325,6 @@ static void handleMouse(void)
static void handleKeyboard(void)
{
Widget *old;
if (selectedWidget != NULL)
{
if (selectedWidget->type == WT_BUTTON)
@ -357,7 +361,7 @@ static void handleControlWidgets(void)
}
else
{
if (app.lastKeyPressed != -1)
if (app.lastKeyPressed != -1 && selectedWidget->name)
{
updateControlKey(selectedWidget->name);
@ -601,3 +605,4 @@ void destroyWidgets(void)
head.next = NULL;
}