OSDN Git Service

[Refactor] #37353 prt_map() を view-mainwindow.c/h に移動。
authordeskull <deskull@users.sourceforge.jp>
Thu, 18 Apr 2019 04:44:08 +0000 (13:44 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 18 Apr 2019 04:44:08 +0000 (13:44 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/externs.h
src/grid.c
src/view-mainwindow.c
src/view-mainwindow.h [new file with mode: 0644]

index ee425c6..0d5e930 100644 (file)
     <ClInclude Include="..\..\src\term.h" />\r
     <ClInclude Include="..\..\src\trap.h" />\r
     <ClInclude Include="..\..\src\types.h" />\r
+    <ClInclude Include="..\..\src\view-mainwindow.h" />\r
     <ClInclude Include="..\..\src\warning.h" />\r
     <ClInclude Include="..\..\src\wild.h" />\r
     <ClInclude Include="..\..\src\world.h" />\r
index 273820d..f97381e 100644 (file)
     <ClInclude Include="..\..\src\cmd-basic.h">
       <Filter>cmd</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\view-mainwindow.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\angband.rc" />
index 0f63bf1..3a0a639 100644 (file)
@@ -84,7 +84,7 @@ hengband_SOURCES = \
        variable.c wild.h wild.c wizard1.c wizard2.c \
        warning.c warning.h world.c world.h \
        \
-       view-mainwindow.c\
+       view-mainwindow.c view-mainwindow.h\
        \
        xtra2.c z-config.h \
        z-form.c z-form.h z-rand.c z-rand.h z-term.c z-term.h z-util.c z-util.h \
index fb14587..0bb8602 100644 (file)
@@ -428,7 +428,6 @@ extern void print_rel(SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x);
 extern void note_spot(POSITION y, POSITION x);
 extern void display_dungeon(void);
 extern void lite_spot(POSITION y, POSITION x);
-extern void prt_map(void);
 extern void prt_path(POSITION y, POSITION x);
 extern void display_map(int *cy, int *cx);
 extern void do_cmd_view_map(void);
index 74308d2..5706967 100644 (file)
@@ -32,6 +32,7 @@
 #include "monster-status.h"
 #include "player-status.h"
 #include "spells.h"
+#include "view-mainwindow.h"
 
 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
 static int match_autopick;
@@ -2109,17 +2110,6 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO
 
 
 /*
- * Calculate panel colum of a location in the map
- */
-static int panel_col_of(int col)
-{
-       col -= panel_col_min;
-       if (use_bigtile) col *= 2;
-       return col + 13;
-}
-
-
-/*
  * Moves the cursor to a given MAP (y,x) location
  */
 void move_cursor_relative(int row, int col)
@@ -2368,92 +2358,6 @@ void lite_spot(POSITION y, POSITION x)
 
 
 /*
- * Prints the map of the dungeon
- *
- * Note that, for efficiency, we contain an "optimized" version
- * of both "lite_spot()" and "print_rel()", and that we use the
- * "lite_spot()" function to display the player grid, if needed.
- */
-void prt_map(void)
-{
-       POSITION x, y;
-       int v;
-
-       /* map bounds */
-       POSITION xmin, xmax, ymin, ymax;
-
-       TERM_LEN wid, hgt;
-
-       Term_get_size(&wid, &hgt);
-
-       /* Remove map offset */
-       wid -= COL_MAP + 2;
-       hgt -= ROW_MAP + 2;
-
-       /* Access the cursor state */
-       (void)Term_get_cursor(&v);
-
-       /* Hide the cursor */
-       (void)Term_set_cursor(0);
-
-       /* Get bounds */
-       xmin = (0 < panel_col_min) ? panel_col_min : 0;
-       xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1;
-       ymin = (0 < panel_row_min) ? panel_row_min : 0;
-       ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1;
-
-       /* Bottom section of screen */
-       for (y = 1; y <= ymin - panel_row_prt; y++)
-       {
-               /* Erase the section */
-               Term_erase(COL_MAP, y, wid);
-       }
-
-       /* Top section of screen */
-       for (y = ymax - panel_row_prt; y <= hgt; y++)
-       {
-               /* Erase the section */
-               Term_erase(COL_MAP, y, wid);
-       }
-
-       /* Dump the map */
-       for (y = ymin; y <= ymax; y++)
-       {
-               /* Scan the columns of row "y" */
-               for (x = xmin; x <= xmax; x++)
-               {
-                       TERM_COLOR a;
-                       SYMBOL_CODE c;
-
-                       TERM_COLOR ta;
-                       SYMBOL_CODE tc;
-
-                       /* Determine what is there */
-                       map_info(y, x, &a, &c, &ta, &tc);
-
-                       /* Hack -- fake monochrome */
-                       if (!use_graphics)
-                       {
-                               if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
-                               else if (p_ptr->wraith_form) a = TERM_L_DARK;
-                       }
-
-                       /* Efficiency -- Redraw that grid of the map */
-                       Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
-               }
-       }
-
-       /* Display player */
-       lite_spot(p_ptr->y, p_ptr->x);
-
-       /* Restore the cursor */
-       (void)Term_set_cursor(v);
-}
-
-
-
-/*
  * print project path
  */
 void prt_path(POSITION y, POSITION x)
index 6109aca..696ca2d 100644 (file)
@@ -18,6 +18,7 @@
 #include "player-status.h"
 #include "monster.h"
 #include "realm-hex.h"
+#include "view-mainwindow.h"
 
  /*
   * Some screen locations for various display routines
@@ -2466,3 +2467,99 @@ void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
        *wid_p -= COL_MAP + 2;
        if (use_bigtile) *wid_p /= 2;
 }
+
+/*
+ * Calculate panel colum of a location in the map
+ */
+int panel_col_of(int col)
+{
+       col -= panel_col_min;
+       if (use_bigtile) col *= 2;
+       return col + 13;
+}
+
+/*
+ * Prints the map of the dungeon
+ *
+ * Note that, for efficiency, we contain an "optimized" version
+ * of both "lite_spot()" and "print_rel()", and that we use the
+ * "lite_spot()" function to display the player grid, if needed.
+ */
+void prt_map(void)
+{
+       POSITION x, y;
+       int v;
+
+       /* map bounds */
+       POSITION xmin, xmax, ymin, ymax;
+
+       TERM_LEN wid, hgt;
+
+       Term_get_size(&wid, &hgt);
+
+       /* Remove map offset */
+       wid -= COL_MAP + 2;
+       hgt -= ROW_MAP + 2;
+
+       /* Access the cursor state */
+       (void)Term_get_cursor(&v);
+
+       /* Hide the cursor */
+       (void)Term_set_cursor(0);
+
+       /* Get bounds */
+       xmin = (0 < panel_col_min) ? panel_col_min : 0;
+       xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1;
+       ymin = (0 < panel_row_min) ? panel_row_min : 0;
+       ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1;
+
+       /* Bottom section of screen */
+       for (y = 1; y <= ymin - panel_row_prt; y++)
+       {
+               /* Erase the section */
+               Term_erase(COL_MAP, y, wid);
+       }
+
+       /* Top section of screen */
+       for (y = ymax - panel_row_prt; y <= hgt; y++)
+       {
+               /* Erase the section */
+               Term_erase(COL_MAP, y, wid);
+       }
+
+       /* Dump the map */
+       for (y = ymin; y <= ymax; y++)
+       {
+               /* Scan the columns of row "y" */
+               for (x = xmin; x <= xmax; x++)
+               {
+                       TERM_COLOR a;
+                       SYMBOL_CODE c;
+
+                       TERM_COLOR ta;
+                       SYMBOL_CODE tc;
+
+                       /* Determine what is there */
+                       map_info(y, x, &a, &c, &ta, &tc);
+
+                       /* Hack -- fake monochrome */
+                       if (!use_graphics)
+                       {
+                               if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
+                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                               else if (p_ptr->wraith_form) a = TERM_L_DARK;
+                       }
+
+                       /* Efficiency -- Redraw that grid of the map */
+                       Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
+               }
+       }
+
+       /* Display player */
+       lite_spot(p_ptr->y, p_ptr->x);
+
+       /* Restore the cursor */
+       (void)Term_set_cursor(v);
+}
+
+
diff --git a/src/view-mainwindow.h b/src/view-mainwindow.h
new file mode 100644 (file)
index 0000000..e43b624
--- /dev/null
@@ -0,0 +1,4 @@
+#pragma once
+
+extern int panel_col_of(int col);
+extern void prt_map(void);