OSDN Git Service

#37287 #37353 (2.2.0.89) KIND_OBJECT_IDX型とMONSTER_NUMBER型を定義し、型の置換を継続中。 / KIND_OBJECT...
[hengband/hengband.git] / src / xtra2.c
index ec625bf..a223a79 100644 (file)
@@ -230,17 +230,17 @@ msg_format("レベル %d にようこそ。", p_ptr->lev);
  * Used to allocate proper treasure when "Creeping coins" die
  * XXX XXX XXX Note the use of actual "monster names"
  */
-static int get_coin_type(int r_idx)
+static int get_coin_type(MONRACE_IDX r_idx)
 {
        /* Analyze monsters */
        switch (r_idx)
        {
-       case MON_COPPER_COINS: return 2;
-       case MON_SILVER_COINS: return 5;
-       case MON_GOLD_COINS: return 10;
-       case MON_MITHRIL_COINS:
-       case MON_MITHRIL_GOLEM: return 16;
-       case MON_ADAMANT_COINS: return 17;
+               case MON_COPPER_COINS: return 2;
+               case MON_SILVER_COINS: return 5;
+               case MON_GOLD_COINS: return 10;
+               case MON_MITHRIL_COINS:
+               case MON_MITHRIL_GOLEM: return 16;
+               case MON_ADAMANT_COINS: return 17;
        }
 
        /* Assume nothing */
@@ -439,7 +439,7 @@ static int count_all_hostile_monsters(void)
        {
                for (y = 0; y < cur_hgt; ++ y)
                {
-                       int m_idx = cave[y][x].m_idx;
+                       MONSTER_IDX m_idx = cave[y][x].m_idx;
 
                        if (m_idx > 0 && is_hostile(&m_list[m_idx]))
                        {
@@ -459,7 +459,7 @@ static int count_all_hostile_monsters(void)
  */
 void check_quest_completion(monster_type *m_ptr)
 {
-       int y, x;
+       POSITION y, x;
 
        int quest_num;
 
@@ -624,7 +624,7 @@ void check_quest_completion(monster_type *m_ptr)
        /* Create a magical staircase */
        if (create_stairs)
        {
-               int ny, nx;
+               POSITION ny, nx;
 
                /* Stagger around */
                while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
@@ -737,7 +737,7 @@ cptr extract_note_dies(monster_race *r_ptr)
  * it drops all of its objects, which may disappear in crowded rooms.
  * </pre>
  */
-void monster_death(int m_idx, bool drop_item)
+void monster_death(MONSTER_IDX m_idx, bool drop_item)
 {
        int i, j, y, x;
 
@@ -794,9 +794,9 @@ void monster_death(int m_idx, bool drop_item)
                {
                        int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
                        int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
-                       int d_dice = r_ptr->blow[i].d_dice;
-                       int d_side = r_ptr->blow[i].d_side;
-                       int damage = damroll(d_dice, d_side);
+                       DICE_NUMBER d_dice = r_ptr->blow[i].d_dice;
+                       DICE_SID d_side = r_ptr->blow[i].d_side;
+                       HIT_POINT damage = damroll(d_dice, d_side);
 
                        project(m_idx, 3, y, x, damage, typ, flg, -1);
                        break;
@@ -989,7 +989,7 @@ void monster_death(int m_idx, bool drop_item)
                {
                        if (!one_in_(7))
                        {
-                               int wy = y, wx = x;
+                               POSITION wy = y, wx = x;
                                int attempts = 100;
                                bool pet = is_pet(m_ptr);
 
@@ -1278,7 +1278,7 @@ void monster_death(int m_idx, bool drop_item)
 
                if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
                {
-                       int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
+                       IDX k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
                                : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
 
                        if (d_info[dungeon_type].final_artifact)
@@ -1436,7 +1436,7 @@ void monster_death(int m_idx, bool drop_item)
  * "type" is not yet used and should be 0.
  * </pre>
  */
-int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
+HIT_POINT mon_damage_mod(monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear)
 {
        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
 
@@ -1577,7 +1577,7 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr)
  * to induce changes in the monster recall code.
  * </pre>
  */
-bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
+bool mon_take_hit(MONSTER_IDX m_idx, int dam, bool *fear, cptr note)
 {
        monster_type    *m_ptr = &m_list[m_idx];
        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
@@ -1841,7 +1841,7 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
                        chg_virtue (V_JUSTICE, -1);
                }
 
-               if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK))  && !(r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
+               if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK))  && !(r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
                {
                        if (one_in_(4)) chg_virtue(V_NATURE, -1);
                }
@@ -2530,7 +2530,7 @@ void ang_sort(vptr u, vptr v, int n)
  * Future versions may restrict the ability to target "trappers"
  * and "mimics", but the semantics is a little bit weird.
  */
-bool target_able(int m_idx)
+bool target_able(MONSTER_IDX m_idx)
 {
        monster_type *m_ptr = &m_list[m_idx];
 
@@ -2720,7 +2720,7 @@ static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
 /*
  * Hack -- help "select" a location (see below)
  */
-static s16b target_pick(int y1, int x1, int dy, int dx)
+static s16b target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx)
 {
        int i, v;
 
@@ -2904,7 +2904,7 @@ static void target_set_prepare(int mode)
 
        if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
        {
-               byte tmp;
+               POSITION tmp;
 
                tmp = temp_y[0];
                temp_y[0] = temp_y[1];
@@ -2914,7 +2914,8 @@ static void target_set_prepare(int mode)
                temp_x[1] = tmp;
        }
 }
-void target_set_prepare_look(){
+
+void target_set_prepare_look(void){
        target_set_prepare(TARGET_LOOK);
 }
 
@@ -3285,7 +3286,8 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        /* Continue scrolling list if requested */
                        while (1)
                        {
-                               int i, o_idx;
+                               int i;
+                               IDX o_idx;
 
                                /* Save screen */
                                screen_save();
@@ -3422,7 +3424,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
                {
                        /* Set the quest number temporary */
-                       int old_quest = p_ptr->inside_quest;
+                       IDX old_quest = p_ptr->inside_quest;
                        int j;
 
                        /* Clear the text */
@@ -3581,8 +3583,8 @@ static int target_set_aux(int y, int x, int mode, cptr info)
 bool target_set(int mode)
 {
        int             i, d, m, t, bd;
-       int             y = p_ptr->y;
-       int             x = p_ptr->x;
+       POSITION y = p_ptr->y;
+       POSITION x = p_ptr->x;
 
        bool    done = FALSE;
 
@@ -3592,6 +3594,8 @@ bool target_set(int mode)
 
        char    info[80];
 
+       char    same_key;
+
        cave_type               *c_ptr;
 
        int wid, hgt;
@@ -3606,6 +3610,14 @@ bool target_set(int mode)
        /* Cancel tracking */
        /* health_track(0); */
 
+       if (rogue_like_commands)
+       {
+               same_key = 'x';
+       }
+       else
+       {
+               same_key = 'l';
+       }
 
        /* Prepare the "temp" array */
        target_set_prepare(mode);
@@ -3748,14 +3760,24 @@ bool target_set(int mode)
 
                                default:
                                {
-                                       /* Extract the action (if any) */
-                                       d = get_keymap_dir(query);
+                                       if(query == same_key)
+                                       {
+                                               if (++m == temp_n)
+                                               {
+                                                       m = 0;
+                                                       if (!expand_list) done = TRUE;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               /* Extract the action (if any) */
+                                               d = get_keymap_dir(query);
 
-                                       if (!d) bell();
-                                       break;
+                                               if (!d) bell();
+                                               break;
+                                       }
                                }
                        }
-
                        /* Hack -- move around */
                        if (d)
                        {
@@ -4069,12 +4091,10 @@ bool target_set(int mode)
  *
  * Note that confusion over-rides any (explicit?) user choice.
  */
-bool get_aim_dir(int *dp)
+bool get_aim_dir(DIRECTION *dp)
 {
-       int             dir;
-
+       DIRECTION dir;
        char    command;
-
        cptr    p;
 
        /* Initialize */
@@ -4439,7 +4459,8 @@ void gain_level_reward(int chosen_reward)
        object_type forge;
        char        wrath_reason[32] = "";
        int         nasty_chance = 6;
-       int         dummy = 0, dummy2 = 0;
+       OBJECT_TYPE_VALUE dummy = 0;
+       OBJECT_SUBTYPE_VALUE dummy2 = 0;
        int         type, effect;
        cptr        reward = NULL;
        char o_name[MAX_NLEN];
@@ -5124,7 +5145,7 @@ msg_format("%sはあなたを無視した。",
  * XAngband: determine if a given location is "interesting"
  * based on target_set_accept function.
  */
-static bool tgt_pt_accept(int y, int x)
+static bool tgt_pt_accept(POSITION y, POSITION x)
 {
        cave_type *c_ptr;
 
@@ -5163,7 +5184,7 @@ static bool tgt_pt_accept(int y, int x)
  */
 static void tgt_pt_prepare(void)
 {
-       int y, x;
+       POSITION y, x;
 
        /* Reset "temp" array */
        temp_n = 0;
@@ -5196,10 +5217,11 @@ static void tgt_pt_prepare(void)
 /*
  * old -- from PsiAngband.
  */
-bool tgt_pt(int *x_ptr, int *y_ptr)
+bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
 {
        char ch = 0;
-       int d, x, y, n = 0;
+       int d, n = 0;
+       POSITION x, y;
        bool success = FALSE;
 
        int wid, hgt;
@@ -5511,7 +5533,7 @@ s16b gain_energy(void)
 /*
  * Return bow energy 
  */
-s16b bow_energy(int sval)
+s16b bow_energy(OBJECT_SUBTYPE_VALUE sval)
 {
        int energy = 100;
 
@@ -5568,7 +5590,7 @@ s16b bow_energy(int sval)
 /*
  * Return bow tmul
  */
-int bow_tmul(int sval)
+int bow_tmul(OBJECT_SUBTYPE_VALUE sval)
 {
        int tmul = 0;
 
@@ -5689,10 +5711,10 @@ int spell_exp_level(int spell_exp)
  * Display a rumor and apply its effects
  */
 
-int rumor_num(char *zz, int max_idx)
+IDX rumor_num(char *zz, IDX max_idx)
 {
        if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
-       return atoi(zz);
+       return (IDX)atoi(zz);
 }
 
 cptr rumor_bind_name(char *base, cptr fullname)
@@ -5741,7 +5763,7 @@ void display_rumor(bool ex)
                {
                        if (strcmp(zz[0], "ARTIFACT") == 0)
                        {
-                               int a_idx, k_idx;
+                               IDX a_idx, k_idx;
                                object_type forge;
                                object_type *q_ptr = &forge;
                                artifact_type *a_ptr;
@@ -5762,7 +5784,7 @@ void display_rumor(bool ex)
                        }
                        else if  (strcmp(zz[0], "MONSTER") == 0)
                        {
-                               int r_idx;
+                               MONRACE_IDX r_idx;
                                monster_race *r_ptr;
 
                                while(1)
@@ -5802,7 +5824,7 @@ void display_rumor(bool ex)
                        }
                        else if  (strcmp(zz[0], "TOWN") == 0)
                        {
-                               int t_idx;
+                               IDX t_idx;
                                s32b visit;
 
                                while(1)