OSDN Git Service

Add Doxygen comment to cmd4.c.
[hengband/hengband.git] / src / floors.c
index b2b5cf6..64fd137 100644 (file)
@@ -1,27 +1,29 @@
-/* File: floors.c */
-
-/* Purpose: management of the saved floor */
-
-/*
- * Copyright (c) 2002  Mogami
- *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+/*!
+ * @file floors.c
+ * @brief Êݸ¤µ¤ì¤¿³¬¤Î´ÉÍý / management of the saved floor
+ * @date 2014/01/04
+ * @author
+ * Copyright (c) 2002  Mogami \n
+ * This software may be copied and distributed for educational, research, and \n
+ * not for profit purposes provided that this copyright and statement are \n
+ * included in all such copies. \n
+ * 2014 Deskull rearranged comment for Doxygen. \n
  */
 
 #include "angband.h"
 #include "grid.h"
 
 
-static s16b new_floor_id;       /* floor_id of the destination */
-static u32b change_floor_mode;  /* Mode flags for changing floor */
-static u32b latest_visit_mark;  /* Max number of visit_mark */
+static s16b new_floor_id;       /*!<¼¡¤Î¥Õ¥í¥¢¤ÎID / floor_id of the destination */
+static u32b change_floor_mode;  /*!<¥Õ¥í¥¢°Ü¹Ô½èÍý¤Ë´Ø¤¹¤ë¥Õ¥é¥° / Mode flags for changing floor */
+static u32b latest_visit_mark;  /*!<¥Õ¥í¥¢¤òÅϤ俲ó¿ô¡©(³ÎǧÃæ) / Max number of visit_mark */
 
 
-/*
- * Initialize saved_floors array.  Make sure that old temporal files
- * are not remaining as gurbages.
+/*!
+ * @brief Êݸ¥Õ¥í¥¢ÇÛÎó¤ò½é´ü²½¤¹¤ë / Initialize saved_floors array. 
+ * @param force ¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤¬»Ä¤Ã¤Æ¤¤¤¿¾ì¹ç¤â·Ù¹ð¤Ê¤·¤Ç¶¯À©Åª¤Ëºï½ü¤¹¤ë¡£
+ * @details Make sure that old temporal files are not remaining as gurbages.
+ * @return ¤Ê¤·
  */
 void init_saved_floors(bool force)
 {
@@ -115,10 +117,10 @@ void init_saved_floors(bool force)
 #endif
 }
 
-
-/*
- * Kill temporal files
- * Should be called just before the game quit.
+/*!
+ * @brief Êݸ¥Õ¥í¥¢Íѥƥó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë / Kill temporal files
+ * @details Should be called just before the game quit.
+ * @return ¤Ê¤·
  */
 void clear_saved_floor_files(void)
 {
@@ -161,9 +163,10 @@ void clear_saved_floor_files(void)
 #endif
 }
 
-
-/*
- * Get a pointer for an item of the saved_floors array.
+/*!
+ * @brief Êݸ¥Õ¥í¥¢ID¤«¤é»²¾È¥Ý¥¤¥ó¥¿¤òÆÀ¤ë / Get a pointer for an item of the saved_floors array.
+ * @param floor_id Êݸ¥Õ¥í¥¢ID
+ * @return ID¤ËÂбþ¤¹¤ëÊݸ¥Õ¥í¥¢¤Î¥Ý¥¤¥ó¥¿¡¢¤Ê¤¤¾ì¹ç¤ÏNULL¤òÊÖ¤¹¡£
  */
 saved_floor_type *get_sf_ptr(s16b floor_id)
 {
@@ -184,8 +187,10 @@ saved_floor_type *get_sf_ptr(s16b floor_id)
 }
 
 
-/*
- * kill a saved floor and get an empty space
+/*!
+ * @brief »²¾È¥Ý¥¤¥ó¥¿Àè¤ÎÊݸ¥Õ¥í¥¢¤òËõ¾Ã¤¹¤ë / kill a saved floor and get an empty space
+ * @param sf_ptr Êݸ¥Õ¥í¥¢¤Î»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
  */
 static void kill_saved_floor(saved_floor_type *sf_ptr)
 {
@@ -224,9 +229,11 @@ static void kill_saved_floor(saved_floor_type *sf_ptr)
 }
 
 
-/*
- * Initialize new saved floor and get its floor id.  If number of
- * saved floors are already MAX_SAVED_FLOORS, kill the oldest one.
+/*!
+ * @brief ¿·µ¬¤ËÍøÍѲÄǽ¤ÊÊݸ¥Õ¥í¥¢¤òÊÖ¤¹ / Initialize new saved floor and get its floor id.
+ * @return ÍøÍѲÄǽ¤ÊÊݸ¥Õ¥í¥¢ID
+ * @details
+ * If number of saved floors are already MAX_SAVED_FLOORS, kill the oldest one.
  */
 s16b get_new_floor_id(void)
 {
@@ -292,17 +299,19 @@ s16b get_new_floor_id(void)
 }
 
 
-/*
- * Prepare mode flags of changing floor
+/*!
+ * @brief ¥Õ¥í¥¢ÀÚ¤êÂؤ¨»þ¤Î½èÍý¥Õ¥é¥°¤òÄɲ乤ë / Prepare mode flags of changing floor
+ * @param mode Äɲä·¤¿¤¤½ê»ý¥Õ¥é¥°
+ * @return ¤Ê¤·
  */
 void prepare_change_floor_mode(u32b mode)
 {
        change_floor_mode |= mode;
 }
 
-
-/*
- * Builds the dead end
+/*!
+ * @brief ³¬ÃÊ°ÜÆ°Àè¤Î¥Õ¥í¥¢¤¬À¸À®¤Ç¤­¤Ê¤¤»þ¤Ë´Êñ¤Ê¹Ô¤­»ß¤Þ¤ê¥Þ¥Ã¥×¤òºîÀ®¤¹¤ë / Builds the dead end
+ * @return ¤Ê¤·
  */
 static void build_dead_end(void)
 {
@@ -339,14 +348,13 @@ static void build_dead_end(void)
 }
 
 
-/* Maximum number of preservable pets */
-#define MAX_PARTY_MON 21
-
-static monster_type party_mon[MAX_PARTY_MON];
 
+#define MAX_PARTY_MON 21 /*!< ¥Õ¥í¥¢°ÜÆ°»þ¤ËÀè¤Î¥Õ¥í¥¢¤ËÏ¢¤ì¤Æ¹Ô¤±¤ë¥Ú¥Ã¥È¤ÎºÇÂç¿ô Maximum number of preservable pets */
+static monster_type party_mon[MAX_PARTY_MON]; /*!< ¥Õ¥í¥¢°ÜÆ°¤ËÊݸ¤¹¤ë¥Ú¥Ã¥È¥â¥ó¥¹¥¿¡¼¤ÎÇÛÎó */
 
-/*
- * Preserve_pets
+/*!
+ * @brief ¥Õ¥í¥¢°ÜÆ°»þ¤Î¥Ú¥Ã¥ÈÊݸ½èÍý / Preserve_pets
+ * @return ¤Ê¤·
  */
 static void preserve_pet(void)
 {
@@ -371,7 +379,7 @@ static void preserve_pet(void)
                else
                {
                        /* Preserve the mount */
-                       COPY(&party_mon[0], m_ptr, monster_type);
+                       (void)COPY(&party_mon[0], m_ptr, monster_type);
 
                        /* Delete from this floor */
                        delete_monster_idx(p_ptr->riding);
@@ -422,7 +430,7 @@ static void preserve_pet(void)
                                }
                        }
 
-                       COPY(&party_mon[num], &m_list[i], monster_type);
+                       (void)COPY(&party_mon[num], &m_list[i], monster_type);
 
                        num++;
 
@@ -444,7 +452,7 @@ static void preserve_pet(void)
                        if (p_ptr->riding == i) continue;
 
                        monster_desc(m_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-                       do_cmd_write_nikki(NIKKI_NAMED_PET, 4, m_name);
+                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_MOVED, m_name);
                }
        }
 
@@ -480,8 +488,10 @@ static void preserve_pet(void)
 }
 
 
-/*
- * Pre-calculate the racial counters of preserved pets
+/*!
+ * @brief ¥Õ¥í¥¢°ÜÆ°»þ¤Ë¥Ú¥Ã¥È¤òȼ¤Ã¤¿¾ì¹ç¤Î½àÈ÷½èÍý / Pre-calculate the racial counters of preserved pets
+ * @return ¤Ê¤·
+ * @details
  * To prevent multiple generation of unique monster who is the minion of player
  */
 void precalc_cur_num_of_pet(void)
@@ -502,9 +512,9 @@ void precalc_cur_num_of_pet(void)
        }
 }
 
-
-/*
- * Place preserved pet monsters on new floor
+/*!
+ * @brief °ÜÆ°Àè¤Î¥Õ¥í¥¢¤Ëȼ¤Ã¤¿¥Ú¥Ã¥È¤òÇÛÃÖ¤¹¤ë / Place preserved pet monsters on new floor
+ * @return ¤Ê¤·
  */
 static void place_pet(void)
 {
@@ -606,7 +616,7 @@ static void place_pet(void)
                        if (record_named_pet && m_ptr->nickname)
                        {
                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                               do_cmd_write_nikki(NIKKI_NAMED_PET, 5, m_name);
+                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
                        }
 
                        /* Pre-calculated in precalc_cur_num_of_pet(), but need to decrease */
@@ -615,16 +625,18 @@ static void place_pet(void)
        }
 
        /* For accuracy of precalc_cur_num_of_pet() */
-       C_WIPE(party_mon, MAX_PARTY_MON, monster_type);
+       (void)C_WIPE(party_mon, MAX_PARTY_MON, monster_type);
 }
 
 
-/*
- * Hack -- Update location of unique monsters and artifacts
- *
- * The r_ptr->floor_id and a_ptr->floor_id are not updated correctly
- * while new floor creation since dungeons may be re-created by
- * auto-scum option.
+/*!
+ * @brief ¥æ¥Ë¡¼¥¯¥â¥ó¥¹¥¿¡¼¤ä¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î½êºß¥Õ¥í¥¢¤ò¹¹¿·¤¹¤ë / Hack -- Update location of unique monsters and artifacts
+ * @param cur_floor_id ¸½ºß¤Î¥Õ¥í¥¢ID
+ * @return ¤Ê¤·
+ * @details 
+ * The r_ptr->floor_id and a_ptr->floor_id are not updated correctly\n
+ * while new floor creation since dungeons may be re-created by\n
+ * auto-scum option.\n
  */
 static void update_unique_artifact(s16b cur_floor_id)
 {
@@ -667,9 +679,9 @@ static void update_unique_artifact(s16b cur_floor_id)
 }
 
 
-/*
- * When a monster is at a place where player will return,
- * Get out of the my way!
+/*!
+ * @brief ¥Õ¥í¥¢°ÜÆ°»þ¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°Àè¥â¥ó¥¹¥¿¡¼¤¬´û¤Ë¤¤¤¿¾ì¹ç¥é¥ó¥À¥à¤Ê¶áÎ٤˰ÜÆ°¤µ¤»¤ë / When a monster is at a place where player will return,
+ * @return ¤Ê¤·
  */
 static void get_out_monster(void)
 {
@@ -736,20 +748,16 @@ static void get_out_monster(void)
        }
 }
 
-
-/*
- * Is this feature has special meaning (except floor_id) with c_ptr->special?
+/*!
+ * ¥Þ¥¹¹½Â¤ÂΤÎspecialÍ×ÁǤòÍøÍѤ¹¤ëÃÏ·Á¤«¤É¤¦¤«¤òȽÄꤹ¤ë¥Þ¥¯¥í / Is this feature has special meaning (except floor_id) with c_ptr->special?
  */
 #define feat_uses_special(F) (have_flag(f_info[(F)].flags, FF_SPECIAL))
 
 
-/*
- * Virtually teleport onto the stairs that is connecting between two
- * floors.
- *
- * Teleport level spell and trap doors will always lead the player to
- * the one of the floors connected by the one of the stairs in the
- * current floor.
+/*!
+ * @brief ¿·¥Õ¥í¥¢¤Ë°ÜÆ°¸µ¥Õ¥í¥¢¤Ë·Ò¤¬¤ë³¬ÃʤòÇÛÃÖ¤¹¤ë / Virtually teleport onto the stairs that is connecting between two floors.
+ * @param sf_ptr °ÜÆ°¸µ¤ÎÊݸ¥Õ¥í¥¢¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
  */
 static void locate_connected_stairs(saved_floor_type *sf_ptr)
 {
@@ -844,9 +852,10 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr)
        }
 }
 
-/*
- * Maintain quest monsters, mark next floor_id at stairs, save current
- * floor, and prepare to enter next floor.
+/*!
+ * @brief ¸½ºß¤Î¥Õ¥í¥¢¤òÎ¥¤ì¤ë¤Ëȼ¤Ã¤Æ¹Ô£ùÊݸ½èÍý
+ * / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
+ * @return ¤Ê¤·
  */
 void leave_floor(void)
 {
@@ -1083,10 +1092,13 @@ void leave_floor(void)
 }
 
 
-/*
- * Enter new floor.  If the floor is an old saved floor, it will be
- * restored from the temporal file.  If the floor is new one, new cave
- * will be generated.
+/*!
+ * @brief ¥Õ¥í¥¢¤ÎÀÚ¤êÂؤ¨½èÍý / Enter new floor.
+ * @return ¤Ê¤·
+ * @details
+ * If the floor is an old saved floor, it will be\n
+ * restored from the temporal file.  If the floor is new one, new cave\n
+ * will be generated.\n
  */
 void change_floor(void)
 {
@@ -1389,6 +1401,9 @@ void change_floor(void)
        /* Place preserved pet monsters */
        place_pet();
 
+       /* Reset travel target place */
+       forget_travel_flow();
+
        /* Hack -- maintain unique and artifacts */
        update_unique_artifact(new_floor_id);
 
@@ -1413,11 +1428,10 @@ void change_floor(void)
        change_floor_mode = 0L;
 }
 
-
-
-/*
- * Create stairs at or move previously created stairs into the player
- * location.
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Î¼ê¤Ë¤è¤ëǽưŪ¤Ê³¬ÃÊÀ¸À®½èÍý /
+ * Create stairs at or move previously created stairs into the player location.
+ * @return ¤Ê¤·
  */
 void stair_creation(void)
 {