OSDN Git Service

MacOS: disable changing the tile set of wide tile mode when in an in-game menu
authorEric Branlund <ebranlund@fastmail.com>
Tue, 20 Dec 2022 13:07:05 +0000 (06:07 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Tue, 20 Dec 2022 13:07:05 +0000 (06:07 -0700)
src/main-cocoa.m

index eb5587d..06f9b71 100644 (file)
@@ -5973,7 +5973,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
+            || (character_generated && inkey_flag)) ? YES : NO;
     }
     else if( sel == @selector(toggleSound:) )
     {
@@ -5988,7 +5995,13 @@ 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
+            || (character_generated && inkey_flag)) ? YES : NO;
     }
     else if( sel == @selector(sendAngbandCommand:) ||
             sel == @selector(saveGame:) )