From 7cdf41db4842ad81a896089e7f6e23cf59adfc1d Mon Sep 17 00:00:00 2001 From: Eric Branlund Date: Sat, 17 Dec 2022 20:15:48 -0700 Subject: [PATCH] MacOS: disable changing the tile set or wide tile mode when in an in-game menu --- src/main-cocoa.mm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main-cocoa.mm b/src/main-cocoa.mm index a200535d4..df6f3a71c 100644 --- a/src/main-cocoa.mm +++ b/src/main-cocoa.mm @@ -6016,7 +6016,14 @@ static void init_windows(void) { NSInteger requestedGraphicsMode = [[NSUserDefaults standardUserDefaults] integerForKey:AngbandGraphicsDefaultsKey]; [menuItem setState: (tag == requestedGraphicsMode)]; - return YES; + /* + * Only allow changes to the graphics mode when at the splash screen + * or in the game proper and at a command prompt. In other situations + * the saved screens for overlayed menus could have tile references + * that become outdated when the graphics mode is changed. + */ + return (!game_in_progress + || (w_ptr->character_generated && inkey_flag)) ? YES : NO; } else if( sel == @selector(toggleSound:) ) { @@ -6031,14 +6038,20 @@ static void init_windows(void) boolForKey:AngbandBigTileDefaultsKey]; [menuItem setState: ((is_on) ? NSOnState : NSOffState)]; - return YES; + /* + * Only allow changes to the tile size if tiles are not being used + * (then there's no effect on appearance) or, like changes to the + * graphics mode, if at the splash screen or command prompt. + */ + return (!graphics_are_enabled() || !game_in_progress + || (w_ptr->character_generated && inkey_flag)) ? YES : NO; } else if( sel == @selector(sendAngbandCommand:) || sel == @selector(saveGame:) ) { /* * we only want to be able to send commands during an active game - * after the birth screens when the core is waring for a player + * after the birth screens when the core is waiting for a player * command */ return !!game_in_progress && w_ptr->character_generated && inkey_flag; -- 2.11.0