OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / object1.c
index c56c0c5..5b2453c 100644 (file)
@@ -1317,12 +1317,12 @@ char index_to_label(int i)
  * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
  * @details Note that the label does NOT distinguish inven/equip.
  */
-s16b label_to_inven(int c)
+INVENTORY_IDX label_to_inven(int c)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Convert */
-       i = (islower(c) ? A2I(c) : -1);
+       i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
 
        /* Verify the index */
        if ((i < 0) || (i > INVEN_PACK)) return (-1);
@@ -1355,12 +1355,12 @@ static bool is_ring_slot(int i)
  * Convert a label into the index of a item in the "equip"
  * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
  */
-s16b label_to_equip(int c)
+INVENTORY_IDX label_to_equip(int c)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Convert */
-       i = (islower(c) ? A2I(c) : -1) + INVEN_RARM;
+       i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
 
        /* Verify the index */
        if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
@@ -1589,7 +1589,7 @@ cptr describe_use(int i)
  * @return 使用可能な魔法書ならばTRUEを返す。
  */
 
-bool check_book_realm(const byte book_tval, const byte book_sval)
+bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
 {
        if (book_tval < TV_LIFE_BOOK) return FALSE;
        if (p_ptr->pclass == CLASS_SORCERER)
@@ -1856,9 +1856,10 @@ void display_equip(void)
  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
  * and "x" is the "current" command_cmd code.\n
  */
-static bool get_tag(int *cp, char tag, int mode)
+static bool get_tag(COMMAND_CODE *cp, char tag, int mode)
 {
-       int i, start, end;
+       COMMAND_CODE i;
+       int start, end;
        cptr s;
 
        /* Extract index from mode */
@@ -1981,9 +1982,9 @@ static bool get_tag(int *cp, char tag, int mode)
  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
  * and "x" is the "current" command_cmd code.\n
  */
-static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
+static bool get_tag_floor(COMMAND_CODE *cp, char tag, int floor_list[], int floor_num)
 {
-       int i;
+       COMMAND_CODE i;
        cptr s;
 
        /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
@@ -2117,7 +2118,7 @@ static void prepare_label_string_floor(char *label, int floor_list[], int floor_
        /* Move each label */
        for (i = 0; i < 52; i++)
        {
-               int index;
+               COMMAND_CODE index;
                char c = alphabet_chars[i];
 
                /* Find a tag with this label */
@@ -2267,11 +2268,6 @@ int show_inven(int target_item)
                {
                        byte  a = object_attr(o_ptr);
                        char c = object_char(o_ptr);
-
-#ifdef AMIGA
-                       if (a & 0x80) a |= 0x40;
-#endif
-
                        Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
                        if (use_bigtile) cur_col++;
 
@@ -2450,11 +2446,6 @@ int show_equip(int target_item)
                {
                        byte a = object_attr(o_ptr);
                        char c = object_char(o_ptr);
-
-#ifdef AMIGA
-                       if (a & 0x80) a |= 0x40;
-#endif
-
                        Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
                        if (use_bigtile) cur_col++;
 
@@ -2638,7 +2629,7 @@ static bool get_item_allow(int item)
  * @param i 選択アイテムID
  * @return 正規のIDならばTRUEを返す。
  */
-static bool get_item_okay(int i)
+static bool get_item_okay(OBJECT_IDX i)
 {
        /* Illegal items */
        if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
@@ -2666,7 +2657,7 @@ bool can_get_item(void)
                if (item_tester_okay(&inventory[j]))
                        return TRUE;
 
-       floor_num = scan_floor(floor_list, py, px, 0x03);
+       floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
        if (floor_num)
                return TRUE;
 
@@ -2728,13 +2719,16 @@ bool can_get_item(void)
  * We always erase the prompt when we are done, leaving a blank line,\n
  * or a warning message, if appropriate, if no items are available.\n
  */
-bool get_item(int *cp, cptr pmt, cptr str, int mode)
+bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, int mode)
 {
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        char which = ' ';
 
-       int j, k, i1, i2, e1, e2;
+       int j;
+       OBJECT_IDX k;
+       OBJECT_IDX i1, i2;
+       OBJECT_IDX e1, e2;
 
        bool done, item;
 
@@ -2916,7 +2910,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        if (floor)
        {
                /* Scan all objects in the grid */
-               for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
+               for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
                {
                        object_type *o_ptr;
 
@@ -2994,7 +2988,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Repeat until done */
        while (!done)
        {
-               int get_item_label = 0;
+               COMMAND_CODE get_item_label = 0;
 
                /* Show choices */
                int ni = 0;
@@ -3295,7 +3289,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                if (allow_floor)
                                {
                                        /* Scan all objects in the grid */
-                                       for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
+                                       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
                                        {
                                                object_type *o_ptr;
 
@@ -3769,11 +3763,14 @@ int show_floor(int target_item, int y, int x, int *min_width)
  * @param mode オプションフラグ
  * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
  */
-bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
+bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, int mode)
 {
        char n1 = ' ', n2 = ' ', which = ' ';
 
-       int j, k, i1, i2, e1, e2;
+       int j;
+       COMMAND_CODE i1, i2;
+       COMMAND_CODE e1, e2;
+       COMMAND_CODE k;
 
        bool done, item;
 
@@ -3825,7 +3822,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        if (prev_tag && command_cmd)
                        {
                                /* Scan all objects in the grid */
-                               floor_num = scan_floor(floor_list, py, px, 0x03);
+                               floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
 
                                /* Look up the tag */
                                if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
@@ -3963,7 +3960,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        if (floor)
        {
                /* Scan all objects in the grid */
-               floor_num = scan_floor(floor_list, py, px, 0x03);
+               floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
        }
 
        /* Accept inventory */
@@ -4037,7 +4034,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Repeat until done */
        while (!done)
        {
-               int get_item_label = 0;
+               COMMAND_CODE get_item_label = 0;
 
                /* Show choices */
                int ni = 0;
@@ -4106,7 +4103,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        n2 = I2A(k - floor_top);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_floor(menu_line, py, px, &min_width);
+                       if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
                }
 
                /* Viewing inventory */
@@ -4536,8 +4533,9 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        case '\r':
                        case '+':
                        {
-                               int i, o_idx;
-                               cave_type *c_ptr = &cave[py][px];
+                               int i;
+                               IDX o_idx;
+                               cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
 
                                if (command_wrk != (USE_FLOOR)) break;
 
@@ -4559,7 +4557,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                o_list[i].next_o_idx = o_idx;
 
                                /* Re-scan floor list */ 
-                               floor_num = scan_floor(floor_list, py, px, 0x03);
+                               floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
 
                                /* Hack -- Fix screen */
                                if (command_see)
@@ -4870,7 +4868,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
 
                                /* Extract "query" setting */
                                ver = isupper(which);
-                               which = tolower(which);
+                               which = (char)tolower(which);
 
                                /* Convert letter to inventory index */
                                if (command_wrk == (USE_INVEN))
@@ -5037,10 +5035,8 @@ void py_pickup_floor(bool pickup)
        int can_pickup = 0;
 
        /* Scan the pile of objects */
-       for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
+       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
-               object_type *o_ptr;
-
                /* Access the object */
                o_ptr = &o_list[this_o_idx];
 
@@ -5058,14 +5054,13 @@ void py_pickup_floor(bool pickup)
                {
                        /* Message */
 #ifdef JP
-               msg_format(" $%ld の価値がある%sを見つけた。",
-                          (long)o_ptr->pval, o_name);
+                       msg_format(" $%ld の価値がある%sを見つけた。",
+                               (long)o_ptr->pval, o_name);
 #else
                        msg_format("You have found %ld gold pieces worth of %s.",
-                               (long) o_ptr->pval, o_name);
+                               (long)o_ptr->pval, o_name);
 #endif
 
-
                        /* Collect the gold */
                        p_ptr->au += o_ptr->pval;