+ /* Check for change to out of sight grid */
+ else if (!player_can_see_bold(y, x)) c_ptr->info &= ~(CAVE_MARK);
+
+ /* Notice */
+ note_spot(y, x);
+
+ /* Redraw */
+ lite_spot(y, x);
+ }
+
+ /* Hack -- glow the deep lava */
+ if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+ {
+ int i, yy, xx;
+
+ for (i = 0; i < 9; i++)
+ {
+ yy = y + ddy_ddd[i];
+ xx = x + ddx_ddd[i];
+ if (!in_bounds2(yy, xx)) continue;
+ cave[yy][xx].info |= CAVE_GLOW;
+ if (character_dungeon && player_has_los_bold(yy, xx))
+ {
+ /* Notice */
+ note_spot(yy, xx);
+
+ /* Redraw */
+ lite_spot(yy, xx);
+ }
+ }
+ }
+}
+
+
+int conv_dungeon_feat(int newfeat)
+{
+ feature_type *f_ptr = &f_info[newfeat];
+
+ if (have_flag(f_ptr->flags, FF_CONVERT))
+ {
+ switch (f_ptr->power)
+ {
+ case CONVERT_TYPE_FLOOR:
+ return floor_type[randint0(100)];
+ case CONVERT_TYPE_WALL:
+ return fill_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[dungeon_type].stream1;
+ case CONVERT_TYPE_STREAM2:
+ return d_info[dungeon_type].stream2;
+ default:
+ return newfeat;
+ }
+ }
+ else return newfeat;
+}
+
+
+/*
+ * Take a feature, determine what that feature becomes
+ * through applying the given action.
+ */
+int feat_state(int feat, int action)
+{
+ feature_type *f_ptr = &f_info[feat];
+ int i;
+
+ /* 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 (have_flag(f_ptr->flags, FF_PERMANENT)) return feat;
+
+ return (feature_action_flags[action] & FAF_DESTROY) ? conv_dungeon_feat(f_ptr->destroyed) : feat;
+}
+
+/*
+ * Takes a location and action and changes the feature at that
+ * location through applying the given action.
+ */
+void cave_alter_feat(int y, int x, int action)
+{
+ /* Set old feature */
+ int oldfeat = cave[y][x].feat;
+
+ /* Get the new feat */
+ int newfeat = feat_state(oldfeat, action);
+
+ /* No change */
+ if (newfeat == oldfeat) return;
+
+ /* Set the new feature */
+ cave_set_feat(y, x, newfeat);
+
+ if (!(feature_action_flags[action] & FAF_NO_DROP))
+ {
+ feature_type *old_f_ptr = &f_info[oldfeat];
+ feature_type *f_ptr = &f_info[newfeat];
+ bool found = FALSE;
+
+ /* Handle gold */
+ if (have_flag(old_f_ptr->flags, FF_HAS_GOLD) && !have_flag(f_ptr->flags, FF_HAS_GOLD))
+ {
+ /* Place some gold */
+ place_gold(y, x);
+ found = TRUE;
+ }
+
+ /* Handle item */
+ if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - dun_level / 2)))
+ {
+ /* Place object */
+ place_object(y, x, 0L);
+ found = TRUE;
+ }
+
+ if (found && character_dungeon && player_can_see_bold(y, x))
+ {
+#ifdef JP
+ msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
+#else
+ msg_print("You have found something!");
+#endif
+ }
+ }