OSDN Git Service

[Refactor] #37287 #37353 型の置換。 / Type replacement.
authorDeskull <deskull@users.sourceforge.jp>
Tue, 2 Oct 2018 12:38:46 +0000 (21:38 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Tue, 2 Oct 2018 12:38:46 +0000 (21:38 +0900)
src/chest.c
src/cmd2.c
src/externs.h
src/grid.c
src/object2.c
src/realm-nature.c

index e4135ea..c81f8b5 100644 (file)
@@ -95,14 +95,14 @@ void chest_death(bool scatter, int y, int x, s16b o_idx)
                                if (!cave_empty_bold(y, x)) continue;\r
 \r
                                /* Place the object there. */\r
-                               drop_near(q_ptr, -1, y, x);\r
+                               (void)drop_near(q_ptr, -1, y, x);\r
 \r
                                /* Done. */\r
                                break;\r
                        }\r
                }\r
                /* Normally, drop object near the chest. */\r
-               else drop_near(q_ptr, -1, y, x);\r
+               else (void)drop_near(q_ptr, -1, y, x);\r
        }\r
 \r
        /* Reset the object level */\r
index 80cdead..465386f 100644 (file)
@@ -2375,9 +2375,9 @@ void do_cmd_rest(void)
  * @details
  * Note that artifacts never break, see the "drop_near()" function.
  */
-static int breakage_chance(object_type *o_ptr)
+static PERCENTAGE breakage_chance(object_type *o_ptr)
 {
-       int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0);
+       PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev-1)/7 + 4: 0);
 
        /* Examine the snipe type */
        if (snipe_type)
@@ -2837,10 +2837,11 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
 void do_cmd_fire_aux(int item, object_type *j_ptr)
 {
        int dir;
-       int i, j, y, x, ny, nx, ty, tx, prev_y, prev_x;
+       int i, y, x, ny, nx, ty, tx, prev_y, prev_x;
        int tdam_base, tdis, thits, tmul;
        int bonus, chance;
        int cur_dis, visible;
+       PERCENTAGE j;
 
        object_type forge;
        object_type *q_ptr;
@@ -3499,11 +3500,12 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 {
        DIRECTION dir;
        OBJECT_IDX item;
-       int i, j, y, x, ty, tx, prev_y, prev_x;
+       int i, y, x, ty, tx, prev_y, prev_x;
        int ny[19], nx[19];
        int chance, tdam, tdis;
        int mul, div, dd, ds;
        int cur_dis, visible;
+       PERCENTAGE j;
 
        object_type forge;
        object_type *q_ptr;
index a0d9340..e28f0b6 100644 (file)
@@ -1008,7 +1008,7 @@ extern bool make_object(object_type *j_ptr, BIT_FLAGS mode);
 extern void place_object(POSITION y, POSITION x, BIT_FLAGS mode);
 extern bool make_gold(object_type *j_ptr);
 extern void place_gold(POSITION y, POSITION x);
-extern s16b drop_near(object_type *o_ptr, int chance, int y, int x);
+extern OBJECT_IDX drop_near(object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
 extern void acquirement(POSITION y1, POSITION x1, int num, bool great, bool special, bool known);
 extern void amusement(POSITION y1, POSITION x1, int num, bool known);
 extern void inven_item_charges(int item);
index 076a19d..001a3e2 100644 (file)
@@ -583,17 +583,9 @@ void vault_objects(int y, int x, int num)
                        }
 
 
-                       if (dummy >= SAFE_MAX_ATTEMPTS)
+                       if (dummy >= SAFE_MAX_ATTEMPTS && cheat_room)
                        {
-                               if (cheat_room)
-                               {
-#ifdef JP
-msg_print("警告!地下室のアイテムを配置できません!");
-#else
-                                       msg_print("Warning! Could not place vault object!");
-#endif
-
-                               }
+                               msg_print(_("警告!地下室のアイテムを配置できません!", "Warning! Could not place vault object!"));
                        }
 
 
index 051e735..b485248 100644 (file)
@@ -4940,10 +4940,8 @@ void place_object(POSITION y, POSITION x, BIT_FLAGS mode)
 bool make_gold(object_type *j_ptr)
 {
        int i;
-
        s32b base;
 
-
        /* Hack -- Pick a Treasure variety */
        i = ((randint1(object_level + 2) + 2) / 2) - 1;
 
@@ -4963,7 +4961,7 @@ bool make_gold(object_type *j_ptr)
        object_prep(j_ptr, OBJ_GOLD_LIST + i);
 
        /* Hack -- Base coin cost */
-       base = k_info[OBJ_GOLD_LIST+i].cost;
+       base = k_info[OBJ_GOLD_LIST + i].cost;
 
        /* Determine how much the treasure is "worth" */
        j_ptr->pval = (base + (8L * randint1(base)) + randint1(8));
@@ -4984,12 +4982,11 @@ bool make_gold(object_type *j_ptr)
  */
 void place_gold(POSITION y, POSITION x)
 {
-       s16b o_idx;
+       OBJECT_IDX o_idx;
 
        /* Acquire grid */
        cave_type *c_ptr = &cave[y][x];
 
-
        object_type forge;
        object_type *q_ptr;
 
@@ -5013,7 +5010,6 @@ void place_gold(POSITION y, POSITION x)
        /* Make some gold */
        if (!make_gold(q_ptr)) return;
 
-
        /* Make an object */
        o_idx = o_pop();
 
@@ -5054,7 +5050,7 @@ void place_gold(POSITION y, POSITION x)
  * @param chance ドロップの成功率(%)
  * @param y 配置したいフロアのY座標
  * @param x 配置したいフロアのX座標
- * @return 生成に成功したらTRUEを返す。
+ * @return 生成に成功したらオブジェクトのIDを返す。
  * @details
  * The initial location is assumed to be "in_bounds()".\n
  *\n
@@ -5069,18 +5065,17 @@ void place_gold(POSITION y, POSITION x)
  * the object can combine, stack, or be placed.  Artifacts will try very\n
  * hard to be placed, including "teleporting" to a useful grid if needed.\n
  */
-s16b drop_near(object_type *j_ptr, int chance, int y, int x)
+OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION x)
 {
        int i, k, d, s;
 
        int bs, bn;
-       int by, bx;
-       int dy, dx;
-       int ty, tx = 0;
+       POSITION by, bx;
+       POSITION dy, dx;
+       POSITION ty, tx = 0;
 
-       s16b o_idx = 0;
-
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        cave_type *c_ptr;
 
@@ -5105,11 +5100,8 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 #ifdef JP
                msg_format("%sは消えた。", o_name);
 #else
-               msg_format("The %s disappear%s.",
-                          o_name, (plural ? "" : "s"));
+               msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
 #endif
-
-
                /* Debug */
                if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
 
index 1360ff2..162203f 100644 (file)
@@ -93,7 +93,7 @@ cptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));\r
 \r
                                /* Drop the object from heaven */\r
-                               drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);\r
+                               (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);\r
                        }\r
                }\r
                break;\r