OSDN Git Service

[Fix] #38796 マーフォーク用の rgold_adj を追加。 / Add to rgold_adj for Merfolk.
[hengband/hengband.git] / src / wild.c
index 946b286..26aa5a9 100644 (file)
  */
 
 #include "angband.h"
+#include "world.h"
+#include "monster.h"
+#include "realm-hex.h"
+#include "player-status.h"
 
 /*!
  * @brief 地形生成確率を決める要素100の配列を確率テーブルから作成する
@@ -44,7 +48,7 @@ static void set_floor_and_wall_aux(s16b feat_type[100], feat_prob prob[DUNGEON_F
 void set_floor_and_wall(DUNGEON_IDX type)
 {
        DUNGEON_IDX cur_type = 255;
-       dungeon_info_type *d_ptr;
+       dungeon_type *d_ptr;
 
        /* Already filled */
        if (cur_type == type) return;
@@ -52,8 +56,8 @@ void set_floor_and_wall(DUNGEON_IDX type)
        cur_type = type;
        d_ptr = &d_info[type];
 
-       set_floor_and_wall_aux(floor_type, d_ptr->floor);
-       set_floor_and_wall_aux(fill_type, d_ptr->fill);
+       set_floor_and_wall_aux(feat_ground_type, d_ptr->floor);
+       set_floor_and_wall_aux(feat_wall_type, d_ptr->fill);
 
        feat_wall_outer = d_ptr->outer_wall;
        feat_wall_inner = d_ptr->inner_wall;
@@ -74,16 +78,16 @@ void set_floor_and_wall(DUNGEON_IDX type)
  * @param depth_max 深みの最大値
  * @return なし
  */
-static void perturb_point_mid(POSITION x1, POSITION x2, POSITION x3, POSITION x4, POSITION xmid, POSITION ymid, POSITION rough, POSITION depth_max)
+static void perturb_point_mid(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, FEAT_IDX x4, POSITION xmid, POSITION ymid, FEAT_IDX rough, FEAT_IDX depth_max)
 {
        /*
         * Average the four corners & perturb it a bit.
         * tmp is a random int +/- rough
         */
-       int tmp2 = rough*2 + 1;
-       int tmp = randint1(tmp2) - (rough + 1);
+       FEAT_IDX tmp2 = rough*2 + 1;
+       FEAT_IDX tmp = randint1(tmp2) - (rough + 1);
 
-       int avg = ((x1 + x2 + x3 + x4) / 4) + tmp;
+       FEAT_IDX avg = ((x1 + x2 + x3 + x4) / 4) + tmp;
 
        /* Division always rounds down, so we round up again */
        if (((x1 + x2 + x3 + x4) % 4) > 1)
@@ -94,7 +98,7 @@ static void perturb_point_mid(POSITION x1, POSITION x2, POSITION x3, POSITION x4
        if (avg > depth_max) avg = depth_max;
 
        /* Set the new value. */
-       cave[ymid][xmid].feat = (s16b)avg;
+       cave[ymid][xmid].feat = (FEAT_IDX)avg;
 }
 
 
@@ -110,17 +114,16 @@ static void perturb_point_mid(POSITION x1, POSITION x2, POSITION x3, POSITION x4
  * @param depth_max 深みの最大値
  * @return なし
  */
-static void perturb_point_end(int x1, int x2, int x3,
-                         int xmid, int ymid, int rough, int depth_max)
+static void perturb_point_end(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, POSITION xmid, POSITION ymid, FEAT_IDX rough, FEAT_IDX depth_max)
 {
        /*
         * Average the three corners & perturb it a bit.
         * tmp is a random int +/- rough
         */
-       int tmp2 = rough * 2 + 1;
-       int tmp = randint0(tmp2) - rough;
+       FEAT_IDX tmp2 = rough * 2 + 1;
+       FEAT_IDX tmp = randint0(tmp2) - rough;
 
-       int avg = ((x1 + x2 + x3) / 3) + tmp;
+       FEAT_IDX avg = ((x1 + x2 + x3) / 3) + tmp;
 
        /* Division always rounds down, so we round up again */
        if ((x1 + x2 + x3) % 3) avg++;
@@ -130,7 +133,7 @@ static void perturb_point_end(int x1, int x2, int x3,
        if (avg > depth_max) avg = depth_max;
 
        /* Set the new value. */
-       cave[ymid][xmid].feat = (s16b)avg;
+       cave[ymid][xmid].feat = (FEAT_IDX)avg;
 }
 
 
@@ -153,7 +156,7 @@ static void perturb_point_end(int x1, int x2, int x3,
  * need to be converted to features.
  * </pre>
  */
-static void plasma_recursive(POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION depth_max, POSITION rough)
+static void plasma_recursive(POSITION x1, POSITION y1, POSITION x2, POSITION y2, FEAT_IDX depth_max, FEAT_IDX rough)
 {
        /* Find middle */
        POSITION xmid = (x2 - x1) / 2 + x1;
@@ -205,7 +208,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
 {
        POSITION x1, y1;
        int table_size = sizeof(terrain_table[0]) / sizeof(s16b);
-       int roughness = 1; /* The roughness of the level. */
+       FEAT_IDX roughness = 1; /* The roughness of the level. */
        u32b state_backup[4];
 
        /* Unused */
@@ -298,8 +301,8 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
 /*!
  * @brief 荒野フロア生成のメインルーチン /
  * Load a town or generate a terrain level using "plasma" fractals.
- * @param y 広域マップY座標
- * @param x 広域マップY座標
+ * @param y 広域Y座標
+ * @param x 広域X座標
  * @param border 広域マップの辺部分としての生成ならばTRUE
  * @param corner 広域マップの角部分としての生成ならばTRUE
  * @return なし
@@ -463,8 +466,6 @@ void wilderness_gen(void)
 
        x = p_ptr->wilderness_x;
        y = p_ptr->wilderness_y;
-
-       /* Prepare allocation table */
        get_mon_num_prep(get_monster_hook(), NULL);
 
        /* North border */
@@ -852,7 +853,7 @@ errr parse_line_wilderness(char *buf, int ymin, int xmin, int ymax, int xmax, in
                        wilderness[*y][*x].level = w_letter[id].level;
                        wilderness[*y][*x].town = w_letter[id].town;
                        wilderness[*y][*x].road = w_letter[id].road;
-                       strcpy(town[w_letter[id].town].name, w_letter[id].name);
+                       strcpy(town_info[w_letter[id].town].name, w_letter[id].name);
                }
                
                (*y)++;
@@ -964,13 +965,13 @@ errr init_wilderness(void)
  * @param fmt 地勢内の地形数を参照するための独自フォーマット
  * @return なし
  */
-static void init_terrain_table(int terrain, s16b feat_global, cptr fmt, ...)
+static void init_terrain_table(int terrain, s16b feat_global, concptr fmt, ...)
 {
        va_list vp;
-       cptr    p;
+       concptr    p;
        int     cur = 0;
        char    check = 'a';
-       s16b    feat;
+       FEAT_IDX feat;
        int     num;
 
        /* Begin the varargs stuff */
@@ -1150,21 +1151,21 @@ bool change_wild_mode(void)
 #else
                msg_print("You cannot enter global map, since there is some monsters nearby!");
 #endif
-               p_ptr->energy_use = 0;
+               free_turn(p_ptr);
                return FALSE;
        }
 
        if (have_pet)
        {
 #ifdef JP
-               cptr msg = "ペットを置いて広域マップに入りますか?";
+               concptr msg = "ペットを置いて広域マップに入りますか?";
 #else
-               cptr msg = "Do you leave your pets behind? ";
+               concptr msg = "Do you leave your pets behind? ";
 #endif
 
                if (!get_check_strict(msg, CHECK_OKAY_CANCEL))
                {
-                       p_ptr->energy_use = 0;
+                       free_turn(p_ptr);
                        return FALSE;
                }
        }