This bug occured when clicking on the "previous level" or "next level"
gadget on the high score screen, followed by an empty scores screen,
which itself treats any button click as a "leave screen" event, thus
handling that mouse click twice, which results in that empty scores
screen to be immediately left (although it should wait for *another*
button click here, of course). This fix makes sure that button clicks
on gadgets that were already handled are not immediately handled again.
int num_entries = numTreeInfoInGroup(ti);
int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
boolean position_set_by_scrollbar = (dx == 999);
+ boolean button_action = (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE);
+ boolean button_is_valid = (mx >= 0 && my >= 0);
+ boolean button_screen_clicked = (button_action && button_is_valid);
if (game_status == GAME_MODE_SCORES)
{
{
drawChooseTreeScreen_Scores_NotAvailable();
}
- else if (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE)
+ else if (button_screen_clicked)
{
PlaySound(SND_MENU_ITEM_SELECTING);