OSDN Git Service

Be more consistent about the format of comments.
authorEric Branlund <ebranlund@fastmail.com>
Tue, 6 Oct 2020 20:29:01 +0000 (13:29 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Tue, 6 Oct 2020 20:29:01 +0000 (13:29 -0700)
src/main-cocoa.m

index 038b144..0248530 100644 (file)
@@ -1804,8 +1804,10 @@ static void draw_image_tile(
  */
 #define GLYPH_COUNT 256
 
-/* An AngbandContext represents a logical Term (i.e. what Angband thinks is
- * a window). */
+/*
+ * An AngbandContext represents a logical Term (i.e. what Angband thinks is
+ * a window).
+ */
 @interface AngbandContext : NSObject <NSWindowDelegate>
 {
 @public
@@ -1890,8 +1892,10 @@ static void draw_image_tile(
 - (void)drawWChar:(wchar_t)wchar inRect:(NSRect)tile screenFont:(NSFont*)font
          context:(CGContextRef)ctx;
 
-/* Returns the primary window for this angband context, creating it if
- * necessary */
+/*
+ * Returns the primary window for this angband context, creating it if
+ * necessary
+ */
 - (NSWindow *)makePrimaryWindow;
 
 /* Handle becoming the main window */
@@ -1983,8 +1987,10 @@ u32b AngbandMaskForValidSubwindowFlags(void)
  */
 static void AngbandUpdateWindowVisibility(void)
 {
-    /* Because this function is called frequently, we'll make the mask static.
-        * It doesn't change between calls, as the flags themselves are hardcoded */
+    /*
+     * Because this function is called frequently, we'll make the mask static.
+     * It doesn't change between calls, as the flags themselves are hardcoded
+     */
     static u32b validWindowFlagsMask = 0;
 
     if( validWindowFlagsMask == 0 )
@@ -1992,9 +1998,11 @@ static void AngbandUpdateWindowVisibility(void)
         validWindowFlagsMask = AngbandMaskForValidSubwindowFlags();
     }
 
-    /* Loop through all of the subwindows and see if there is a change in the
-        * flags. If so, show or hide the corresponding window. We don't care about
-        * the flags themselves; we just want to know if any are set. */
+    /*
+     * Loop through all of the subwindows and see if there is a change in the
+     * flags. If so, show or hide the corresponding window. We don't care about
+     * the flags themselves; we just want to know if any are set.
+     */
     for( int i = 1; i < ANGBAND_TERM_MAX; i++ )
     {
         AngbandContext *angbandContext =
@@ -2005,12 +2013,14 @@ static void AngbandUpdateWindowVisibility(void)
             continue;
         }
 
-        /* This horrible mess of flags is so that we can try to maintain some
-                * user visibility preference. This should allow the user a window and
-                * have it stay closed between application launches. However, this
-                * means that when a subwindow is turned on, it will no longer appear
-                * automatically. Angband has no concept of user control over window
-                * visibility, other than the subwindow flags. */
+        /*
+         * This horrible mess of flags is so that we can try to maintain some
+         * user visibility preference. This should allow the user a window and
+         * have it stay closed between application launches. However, this
+         * means that when a subwindow is turned on, it will no longer appear
+         * automatically. Angband has no concept of user control over window
+         * visibility, other than the subwindow flags.
+         */
         if( !angbandContext.windowVisibilityChecked )
         {
             if( [angbandContext windowVisibleUsingDefaults] )
@@ -2144,8 +2154,10 @@ static bool initialized = FALSE;
 }
 @end
 
-/* Methods for pulling images out of the Angband bundle (which may be separate
- * from the current bundle in the case of a screensaver */
+/*
+ * Methods for pulling images out of the Angband bundle (which may be separate
+ * from the current bundle in the case of a screensaver
+ */
 @interface NSImage (AngbandImages)
 + (NSImage *)angbandImage:(NSString *)name;
 @end
@@ -2163,8 +2175,10 @@ static bool initialized = FALSE;
 
 @implementation NSImage (AngbandImages)
 
-/* Returns an image in the resource directoy of the bundle containing the
- * Angband view class. */
+/*
+ * Returns an image in the resource directoy of the bundle containing the
+ * Angband view class.
+ */
 + (NSImage *)angbandImage:(NSString *)name
 {
     NSBundle *bundle = [NSBundle bundleForClass:[AngbandView class]];
@@ -2441,10 +2455,12 @@ static int compare_advances(const void *ap, const void *bp)
        advances, 1);
     CGSize advance = advances[0];
 
-    /* If our font is not monospaced, our tile width is deliberately not big
-        * enough for every character. In that event, if our glyph is too wide, we
-        * need to compress it horizontally. Compute the compression ratio.
-        * 1.0 means no compression. */
+    /*
+     * If our font is not monospaced, our tile width is deliberately not big
+     * enough for every character. In that event, if our glyph is too wide, we
+     * need to compress it horizontally. Compute the compression ratio.
+     * 1.0 means no compression.
+     */
     double compressionRatio;
     if (advance.width <= NSWidth(tile))
     {
@@ -2503,8 +2519,10 @@ static int compare_advances(const void *ap, const void *bp)
 
     if( adjustTerminal )
     {
-        /* Adjust terminal to fit window with new font; save the new columns
-                * and rows since they could be changed */
+        /*
+         * Adjust terminal to fit window with new font; save the new columns
+         * and rows since they could be changed
+         */
         NSRect contentRect =
            [self.primaryWindow
                 contentRectForFrameRect: [self.primaryWindow frame]];
@@ -2629,8 +2647,10 @@ static __strong NSFont* gDefaultFont = nil;
 {
     if (! self.primaryWindow)
     {
-        /* This has to be done after the font is set, which it already is in
-                * term_init_cocoa() */
+        /*
+         * This has to be done after the font is set, which it already is in
+         * term_init_cocoa()
+         */
         NSSize sz = self.baseSize;
         NSRect contentRect = NSMakeRect( 0.0, 0.0, sz.width, sz.height );
 
@@ -3271,8 +3291,9 @@ static int compare_nsrect_yorigin_greater(const void *ap, const void *bp)
  */
 - (void)drawRect:(NSRect)rect inView:(NSView *)view
 {
-    /* Take this opportunity to throttle so we don't flush faster than desired.
-        */
+    /*
+     * Take this opportunity to throttle so we don't flush faster than desired.
+     */
     [self throttle];
 
     CGFloat bottomY =
@@ -4962,31 +4983,39 @@ static void AngbandHandleEventMouseDown( NSEvent *event )
                NSSize border = angbandContext.borderSize;
                NSPoint windowPoint = [event locationInWindow];
 
-               /* Adjust for border; add border height because window origin is at
-                * bottom */
+               /*
+                * Adjust for border; add border height because window origin
+                * is at bottom
+                */
                windowPoint = NSMakePoint( windowPoint.x - border.width, windowPoint.y + border.height );
 
                NSPoint p = [[[event window] contentView] convertPoint: windowPoint fromView: nil];
                x = floor( p.x / tileSize.width );
                y = floor( p.y / tileSize.height );
 
-               /* Being safe about this, since xcode doesn't seem to like the
-                * bool_hack stuff */
+               /*
+                * Being safe about this, since xcode doesn't seem to like the
+                * bool_hack stuff
+                */
                BOOL displayingMapInterface = ((int)inkey_flag != 0);
 
                /* Sidebar plus border == thirteen characters; top row is reserved. */
                /* Coordinates run from (0,0) to (cols-1, rows-1). */
                BOOL mouseInMapSection = (x > 13 && x <= cols - 1 && y > 0  && y <= rows - 2);
 
-               /* If we are displaying a menu, allow clicks anywhere within
+               /*
+                * If we are displaying a menu, allow clicks anywhere within
                 * the terminal bounds; if we are displaying the main game
-                * interface, only allow clicks in the map section */
+                * interface, only allow clicks in the map section
+                */
                if ((!displayingMapInterface && x >= 0 && x < cols &&
                     y >= 0 && y < rows) ||
                     (displayingMapInterface && mouseInMapSection))
                {
-                       /* [event buttonNumber] will return 0 for left click,
-                        * 1 for right click, but this is safer */
+                       /*
+                        * [event buttonNumber] will return 0 for left click,
+                        * 1 for right click, but this is safer
+                        */
                        int button = ([event type] == NSLeftMouseDown) ? 1 : 2;
 
 #ifdef KC_MOD_ALT
@@ -5780,7 +5809,7 @@ static void init_windows(void)
         {
            /*
             * Another window is only usable after Term_init_cocoa() has
-            * been called for it.  For Angband if window_flag[i] is nonzero
+            * been called for it.  For Angband, if window_flag[i] is nonzero
             * then that has happened for window i.  For Hengband, that is
             * not the case so also test angband_term[i]->data.
             */
@@ -6068,8 +6097,10 @@ static void init_windows(void)
 {
     [self beginGame];
     
-    /* Once beginGame finished, the game is over - that's how Angband works,
-        * and we should quit */
+    /*
+     * Once beginGame finished, the game is over - that's how Angband works,
+     * and we should quit
+     */
     game_is_finished = TRUE;
     [NSApp terminate:self];
 }
@@ -6091,12 +6122,16 @@ static void init_windows(void)
         /* Stop playing */
         /* player->upkeep->playing = FALSE; */
 
-        /* Post an escape event so that we can return from our get-key-event
-                * function */
+        /*
+         * Post an escape event so that we can return from our get-key-event
+         * function
+         */
         wakeup_event_loop();
         quit_when_ready = true;
-        /* Must return Cancel, not Later, because we need to get out of the
-                * run loop and back to Angband's loop */
+        /*
+         * Must return Cancel, not Later, because we need to get out of the
+         * run loop and back to Angband's loop
+         */
         return NSTerminateCancel;
     }
 }
@@ -6110,10 +6145,12 @@ static void init_windows(void)
     if (! [menu isEqual:self.graphicsMenu])
         return;
     
-    /* If it's non-empty, then we've already built it. Currently graphics modes
-        * won't change once created; if they ever can we can remove this check.
+    /*
+     * If it's non-empty, then we've already built it. Currently graphics modes
+     * won't change once created; if they ever can we can remove this check.
      * Note that the check mark does change, but that's handled in
-        * validateMenuItem: instead of menuNeedsUpdate: */
+     * validateMenuItem: instead of menuNeedsUpdate:
+     */
     if ([menu numberOfItems] > 0)
         return;
     
@@ -6181,8 +6218,10 @@ static void init_windows(void)
 
     game_in_progress = TRUE;
 
-    /* Wake us up in case this arrives while we're sitting at the Welcome
-        * screen! */
+    /*
+     * Wake us up in case this arrives while we're sitting at the Welcome
+     * screen!
+     */
     wakeup_event_loop();
 
     [[NSApplication sharedApplication]