OSDN Git Service

[Refactor] #38997 fill_treasure() に floor_type * 引数を追加. / Add floor_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Fri, 13 Sep 2019 00:11:02 +0000 (09:11 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 13 Sep 2019 00:11:02 +0000 (09:11 +0900)
src/rooms-vault.c
src/rooms.c
src/rooms.h

index 8316020..c8f326d 100644 (file)
@@ -165,7 +165,7 @@ static void build_bubble_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
+       fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
 }
 
 /* Create a random vault that looks like a collection of overlapping rooms */
@@ -213,7 +213,7 @@ static void build_room_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION
        }
 
        /* Fill with monsters and treasure, high difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
+       fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
 }
 
 
@@ -264,7 +264,7 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
+       fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 
 
@@ -918,7 +918,7 @@ static void build_target_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO
        add_door(x0, y0 - y);
 
        /* Fill with stuff - medium difficulty */
-       fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
+       fill_treasure(current_floor_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
 }
 
 
@@ -1010,7 +1010,7 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1,
+       fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1,
                y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 #endif /* ALLOW_CAVERNS_AND_LAKES */
@@ -1135,7 +1135,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO
        }
 
        /* Fill with monsters and treasure, highest difficulty */
-       fill_treasure(x1, x2, y1, y2, 10);
+       fill_treasure(current_floor_ptr, x1, x2, y1, y2, 10);
 
        C_KILL(visited, num_vertices, int);
 }
@@ -1178,7 +1178,7 @@ static void build_castle_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO
        build_recursive_room(x1, y1, x2, y2, randint1(5));
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(x1, x2, y1, y2, randint1(3));
+       fill_treasure(current_floor_ptr, x1, x2, y1, y2, randint1(3));
 }
 
 
index 81f007d..be5197c 100644 (file)
@@ -1379,7 +1379,7 @@ void build_lake(int type)
 /*
  * Routine that fills the empty areas of a room with treasure and monsters.
  */
-void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
+void fill_treasure(floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
 {
        POSITION x, y, cx, cy, size;
        s32b value;
@@ -1410,28 +1410,28 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
                                if (value < 0)
                                {
                                        /* Meanest monster + treasure */
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level + 40;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 40;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level;
-                                       current_floor_ptr->object_level = current_floor_ptr->base_level + 20;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level + 20;
                                        place_object(y, x, AM_GOOD);
-                                       current_floor_ptr->object_level = current_floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level;
                                }
                                else if (value < 5)
                                {
                                        /* Mean monster +treasure */
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level + 20;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 20;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level;
-                                       current_floor_ptr->object_level = current_floor_ptr->base_level + 10;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level + 10;
                                        place_object(y, x, AM_GOOD);
-                                       current_floor_ptr->object_level = current_floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level;
                                }
                                else if (value < 10)
                                {
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level + 9;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 9;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
                                }
                                else if (value < 17)
                                {
@@ -1459,9 +1459,9 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
                                else if (value < 30)
                                {
                                        /* Monster and trap */
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level + 5;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 5;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       current_floor_ptr->monster_level = current_floor_ptr->base_level;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
                                        place_trap(y, x);
                                }
                                else if (value < 40)
@@ -1469,15 +1469,15 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
                                        /* Monster or object */
                                        if (randint0(100) < 50)
                                        {
-                                               current_floor_ptr->monster_level = current_floor_ptr->base_level + 3;
+                                               floor_ptr->monster_level = floor_ptr->base_level + 3;
                                                place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                               current_floor_ptr->monster_level = current_floor_ptr->base_level;
+                                               floor_ptr->monster_level = floor_ptr->base_level;
                                        }
                                        if (randint0(100) < 50)
                                        {
-                                               current_floor_ptr->object_level = current_floor_ptr->base_level + 7;
+                                               floor_ptr->object_level = floor_ptr->base_level + 7;
                                                place_object(y, x, 0L);
-                                               current_floor_ptr->object_level = current_floor_ptr->base_level;
+                                               floor_ptr->object_level = floor_ptr->base_level;
                                        }
                                }
                                else if (value < 50)
@@ -1746,7 +1746,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize,
        r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
 
        /* Fill with monsters and treasure, low difficulty */
-       if (is_vault) fill_treasure(x1, x2, y1, y2, randint1(5));
+       if (is_vault) fill_treasure(current_floor_ptr, x1, x2, y1, y2, randint1(5));
 
        C_KILL(visited, num_vertices, int);
 }
index 3bd220d..24c2e2c 100644 (file)
@@ -9,6 +9,9 @@
  * are included in all such copies.  Other copyrights may also apply.<br
  */
 
+#pragma once
+#include "floor.h"
+
 #define ALLOW_CAVERNS_AND_LAKES
 
 #define DUN_ROOMS_MAX  40 /*!< 部屋生成処理の最大試行数 / Number of rooms to attempt (was 50) */
@@ -95,7 +98,7 @@ extern void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION
 extern void generate_fill_perm_bold(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
 extern void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff);
 extern bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room);
-extern void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty);
+extern void fill_treasure(floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty);
 extern bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int c1, int c2, int c3, int type);
 extern void build_recursive_room(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int power);
 extern void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2);