OSDN Git Service

#37287 #37353 (2.2.0.89) item_number型とaction_energy型を定義し、型の置換を継続中。 / Define typedef...
authorDeskull <desull@users.sourceforge.jp>
Mon, 18 Sep 2017 14:45:47 +0000 (23:45 +0900)
committerDeskull <desull@users.sourceforge.jp>
Mon, 18 Sep 2017 14:45:47 +0000 (23:45 +0900)
src/h-type.h
src/load.c
src/object2.c
src/types.h
src/xtra2.c

index 9d8b038..bb61f31 100644 (file)
@@ -109,7 +109,8 @@ typedef byte position;              /*!< ゲーム中の座標型を定義 */
 typedef s16b hit_point;                /*!< ゲーム中のHP/ダメージ型を定義 */
 typedef s16b hit_prob;         /*!< ゲーム中の命中修正値を定義 */
 typedef s16b base_status;      /*!< ゲーム中の基礎能力値型を定義 */
-
+typedef byte item_number;      /*!< ゲーム中のアイテム数型を定義 */
+typedef s16b action_energy;    /*!< ゲーム中の行動エネルギー型を定義 */
 
 
 /*** Pointers to all the basic types defined above ***/
index 0a6ee90..f46b1c0 100644 (file)
@@ -2727,7 +2727,7 @@ static errr rd_dungeon_old(void)
        /* Read the dungeon items */
        for (i = 1; i < limit; i++)
        {
-               int o_idx;
+               idx o_idx;
 
                object_type *o_ptr;
 
index b51a646..f215b4e 100644 (file)
@@ -5792,7 +5792,7 @@ void inven_item_increase(int item, int num)
        else if (num < 0) num = 0;
 
        /* Un-apply */
-       num -= o_ptr->number;
+       num -= (item_number)o_ptr->number;
 
        /* Change the number and weight */
        if (num)
@@ -5988,10 +5988,10 @@ void floor_item_increase(int item, int num)
        else if (num < 0) num = 0;
 
        /* Un-apply */
-       num -= o_ptr->number;
+       num -= (int)o_ptr->number;
 
        /* Change the number */
-       o_ptr->number += num;
+       o_ptr->number += (item_number)num;
 }
 
 
index b5840e8..16119f7 100644 (file)
@@ -530,7 +530,7 @@ struct object_type
 
        byte discount;          /* Discount (if any) */
 
-       byte number;            /* Number of items */
+       item_number number;     /* Number of items */
 
        s16b weight;            /* Item weight */
 
@@ -601,16 +601,16 @@ struct monster_type
        s16b mtimed[MAX_MTIMED];        /* Timed status counter */
 
        byte mspeed;            /* Monster "speed" */
-       s16b energy_need;       /* Monster "energy" */
+       action_energy energy_need;      /* Monster "energy" */
 
-       byte cdis;              /* Current dis from player */
+       position cdis;          /* Current dis from player */
 
        byte mflag;             /* Extra monster flags */
        byte mflag2;            /* Extra monster flags */
 
        bool ml;                /* Monster is "visible" */
 
-       s16b hold_o_idx;        /* Object being held (if any) */
+       idx hold_o_idx; /* Object being held (if any) */
 
        s16b target_y;          /* Can attack !los player */
        s16b target_x;          /* Can attack !los player */
index 9191fe4..a9c328f 100644 (file)
@@ -235,12 +235,12 @@ static int get_coin_type(int 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 */