OSDN Git Service

[Refactor] #38997 conv_dungeon_feat() に floor_type * 引数を追加. / Add floor_type * argume...
authordeskull <deskull@users.sourceforge.jp>
Sun, 22 Dec 2019 06:05:21 +0000 (15:05 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 22 Dec 2019 06:05:21 +0000 (15:05 +0900)
src/dungeon-file.c
src/floor.c
src/floor.h
src/grid.c
src/grid.h

index ce9080e..ba121a8 100644 (file)
@@ -3951,7 +3951,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        ARTIFACT_IDX artifact_index = letter[idx].artifact;
 
                        /* Lay down a floor */
-                       g_ptr->feat = conv_dungeon_feat(letter[idx].feature);
+                       g_ptr->feat = conv_dungeon_feat(p_ptr->current_floor_ptr, letter[idx].feature);
 
                        /* Only the features */
                        if (init_flags & INIT_ONLY_FEATURES) continue;
@@ -4054,7 +4054,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        else if (letter[idx].trap)
                        {
                                g_ptr->mimic = g_ptr->feat;
-                               g_ptr->feat = conv_dungeon_feat(letter[idx].trap);
+                               g_ptr->feat = conv_dungeon_feat(p_ptr->current_floor_ptr, letter[idx].trap);
                        }
                        else if (object_index)
                        {
index ded15c0..0abf715 100644 (file)
@@ -1135,3 +1135,34 @@ void try_door(floor_type *floor_ptr, POSITION y, POSITION x)
                place_random_door(floor_ptr, y, x, FALSE);
        }
 }
+
+
+FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat)
+{
+       feature_type *f_ptr = &f_info[newfeat];
+
+       if (have_flag(f_ptr->flags, FF_CONVERT))
+       {
+               switch (f_ptr->subtype)
+               {
+               case CONVERT_TYPE_FLOOR:
+                       return feat_ground_type[randint0(100)];
+               case CONVERT_TYPE_WALL:
+                       return feat_wall_type[randint0(100)];
+               case CONVERT_TYPE_INNER:
+                       return feat_wall_inner;
+               case CONVERT_TYPE_OUTER:
+                       return feat_wall_outer;
+               case CONVERT_TYPE_SOLID:
+                       return feat_wall_solid;
+               case CONVERT_TYPE_STREAM1:
+                       return d_info[floor_ptr->dungeon_idx].stream1;
+               case CONVERT_TYPE_STREAM2:
+                       return d_info[floor_ptr->dungeon_idx].stream2;
+               default:
+                       return newfeat;
+               }
+       }
+       else return newfeat;
+}
+
index 10547b0..e41bab1 100644 (file)
@@ -398,3 +398,4 @@ extern void vault_trap_aux(floor_type *floor_ptr, POSITION y, POSITION x, POSITI
 extern bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y);
 extern void try_door(floor_type *floor_ptr, POSITION y, POSITION x);
 
+extern FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
index 49df35c..01d2532 100644 (file)
@@ -1097,37 +1097,6 @@ void update_flow(void)
        }
 }
 
-
-FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat)
-{
-       feature_type *f_ptr = &f_info[newfeat];
-
-       if (have_flag(f_ptr->flags, FF_CONVERT))
-       {
-               switch (f_ptr->subtype)
-               {
-               case CONVERT_TYPE_FLOOR:
-                       return feat_ground_type[randint0(100)];
-               case CONVERT_TYPE_WALL:
-                       return feat_wall_type[randint0(100)];
-               case CONVERT_TYPE_INNER:
-                       return feat_wall_inner;
-               case CONVERT_TYPE_OUTER:
-                       return feat_wall_outer;
-               case CONVERT_TYPE_SOLID:
-                       return feat_wall_solid;
-               case CONVERT_TYPE_STREAM1:
-                       return d_info[p_ptr->dungeon_idx].stream1;
-               case CONVERT_TYPE_STREAM2:
-                       return d_info[p_ptr->dungeon_idx].stream2;
-               default:
-                       return newfeat;
-               }
-       }
-       else return newfeat;
-}
-
-
 /*
  * Take a feature, determine what that feature becomes
  * through applying the given action.
@@ -1140,12 +1109,12 @@ FEAT_IDX feat_state(FEAT_IDX feat, int action)
        /* Get the new feature */
        for (i = 0; i < MAX_FEAT_STATES; i++)
        {
-               if (f_ptr->state[i].action == action) return conv_dungeon_feat(f_ptr->state[i].result);
+               if (f_ptr->state[i].action == action) return conv_dungeon_feat(p_ptr->current_floor_ptr, f_ptr->state[i].result);
        }
 
        if (have_flag(f_ptr->flags, FF_PERMANENT)) return feat;
 
-       return (feature_action_flags[action] & FAF_DESTROY) ? conv_dungeon_feat(f_ptr->destroyed) : feat;
+       return (feature_action_flags[action] & FAF_DESTROY) ? conv_dungeon_feat(p_ptr->current_floor_ptr, f_ptr->destroyed) : feat;
 }
 
 /*
index 75903ce..829a08f 100644 (file)
@@ -400,7 +400,6 @@ extern void note_spot(POSITION y, POSITION x);
 extern void lite_spot(POSITION y, POSITION x);
 extern void delayed_visual_update(void);
 extern void update_flow(void);
-extern FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat);
 extern FEAT_IDX feat_state(FEAT_IDX feat, int action);
 extern void cave_alter_feat(POSITION y, POSITION x, int action);
 extern void remove_mirror(POSITION y, POSITION x);