OSDN Git Service

MacOS: disable changing the tile set or wide tile mode when in an in-game menu
authorEric Branlund <ebranlund@fastmail.com>
Sun, 18 Dec 2022 03:15:48 +0000 (20:15 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Sun, 18 Dec 2022 03:15:48 +0000 (20:15 -0700)
src/main-cocoa.mm

index a200535..df6f3a7 100644 (file)
@@ -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;