+/*
+ * 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
+ }
+ }
+
+ if (feature_action_flags[action] & FAF_CRASH_GLASS)
+ {
+ feature_type *old_f_ptr = &f_info[oldfeat];
+
+ if (have_flag(old_f_ptr->flags, FF_GLASS) && character_dungeon)
+ {
+ project(PROJECT_WHO_GLASS_SHARDS, 1, y, x, MIN(dun_level, 100) / 4, GF_SHARDS,
+ (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
+ }
+ }
+}
+
+