• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisioneda7496c3cb405bff4b08c134876699c2a2282e3 (tree)
Time2019-06-17 00:10:56
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #39077 IDX型を各々正しい型へ置換.

Change Summary

Incremental Difference

--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -479,7 +479,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
479479 }
480480
481481 /* Free the "who" array */
482- C_KILL(who, current_floor_ptr->max_m_idx, IDX);
482+ C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
483483 }
484484 o_ptr->timeout = 100 + randint1(100);
485485 return;
--- a/src/core.c
+++ b/src/core.c
@@ -5612,7 +5612,7 @@ void play_game(bool new_game)
56125612 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
56135613 {
56145614 monster_type *m_ptr;
5615- IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5615+ MONRACE_IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
56165616 monster_race *r_ptr = &r_info[pet_r_idx];
56175617 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
56185618 (PM_FORCE_PET | PM_NO_KAGE));
--- a/src/dungeon-file.c
+++ b/src/dungeon-file.c
@@ -2983,7 +2983,7 @@ errr parse_r_info(char *buf, header *head)
29832983 r_ptr->extra = (BIT_FLAGS16)pad;
29842984 r_ptr->mexp = (EXP)exp;
29852985 r_ptr->next_exp = (EXP)nextexp;
2986- r_ptr->next_r_idx = (IDX)nextmon;
2986+ r_ptr->next_r_idx = (MONRACE_IDX)nextmon;
29872987 }
29882988
29892989 /* Process 'R' for "Reinforcement" (up to six lines) */
@@ -3610,7 +3610,7 @@ static errr parse_line_feature(char *buf)
36103610 if (zz[6][0] == '*')
36113611 {
36123612 letter[index].random |= RANDOM_ARTIFACT;
3613- if (zz[6][1]) letter[index].artifact = (IDX)atoi(zz[6] + 1);
3613+ if (zz[6][1]) letter[index].artifact = (ARTIFACT_IDX)atoi(zz[6] + 1);
36143614 }
36153615 else if (zz[6][0] == '!')
36163616 {
@@ -3621,7 +3621,7 @@ static errr parse_line_feature(char *buf)
36213621 }
36223622 else
36233623 {
3624- letter[index].artifact = (IDX)atoi(zz[6]);
3624+ letter[index].artifact = (ARTIFACT_IDX)atoi(zz[6]);
36253625 }
36263626 /* Fall through */
36273627 /* Ego-item */
@@ -3629,11 +3629,11 @@ static errr parse_line_feature(char *buf)
36293629 if (zz[5][0] == '*')
36303630 {
36313631 letter[index].random |= RANDOM_EGO;
3632- if (zz[5][1]) letter[index].ego = (IDX)atoi(zz[5] + 1);
3632+ if (zz[5][1]) letter[index].ego = (EGO_IDX)atoi(zz[5] + 1);
36333633 }
36343634 else
36353635 {
3636- letter[index].ego = (IDX)atoi(zz[5]);
3636+ letter[index].ego = (EGO_IDX)atoi(zz[5]);
36373637 }
36383638 /* Fall through */
36393639 /* Object */
@@ -3641,7 +3641,7 @@ static errr parse_line_feature(char *buf)
36413641 if (zz[4][0] == '*')
36423642 {
36433643 letter[index].random |= RANDOM_OBJECT;
3644- if (zz[4][1]) letter[index].object = (IDX)atoi(zz[4] + 1);
3644+ if (zz[4][1]) letter[index].object = (OBJECT_IDX)atoi(zz[4] + 1);
36453645 }
36463646 else if (zz[4][0] == '!')
36473647 {
@@ -4290,55 +4290,55 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
42904290 /* Maximum r_idx */
42914291 else if (zz[0][0] == 'R')
42924292 {
4293- max_r_idx = (IDX)atoi(zz[1]);
4293+ max_r_idx = (RACE_IDX)atoi(zz[1]);
42944294 }
42954295
42964296 /* Maximum k_idx */
42974297 else if (zz[0][0] == 'K')
42984298 {
4299- max_k_idx = (IDX)atoi(zz[1]);
4299+ max_k_idx = (KIND_OBJECT_IDX)atoi(zz[1]);
43004300 }
43014301
43024302 /* Maximum v_idx */
43034303 else if (zz[0][0] == 'V')
43044304 {
4305- max_v_idx = (IDX)atoi(zz[1]);
4305+ max_v_idx = (VAULT_IDX)atoi(zz[1]);
43064306 }
43074307
43084308 /* Maximum f_idx */
43094309 else if (zz[0][0] == 'F')
43104310 {
4311- max_f_idx = (IDX)atoi(zz[1]);
4311+ max_f_idx = (FEAT_IDX)atoi(zz[1]);
43124312 }
43134313
43144314 /* Maximum a_idx */
43154315 else if (zz[0][0] == 'A')
43164316 {
4317- max_a_idx = (IDX)atoi(zz[1]);
4317+ max_a_idx = (ARTIFACT_IDX)atoi(zz[1]);
43184318 }
43194319
43204320 /* Maximum e_idx */
43214321 else if (zz[0][0] == 'E')
43224322 {
4323- max_e_idx = (IDX)atoi(zz[1]);
4323+ max_e_idx = (EGO_IDX)atoi(zz[1]);
43244324 }
43254325
43264326 /* Maximum d_idx */
43274327 else if (zz[0][0] == 'D')
43284328 {
4329- max_d_idx = (IDX)atoi(zz[1]);
4329+ max_d_idx = (DUNGEON_IDX)atoi(zz[1]);
43304330 }
43314331
43324332 /* Maximum o_idx */
43334333 else if (zz[0][0] == 'O')
43344334 {
4335- current_floor_ptr->max_o_idx = (IDX)atoi(zz[1]);
4335+ current_floor_ptr->max_o_idx = (OBJECT_IDX)atoi(zz[1]);
43364336 }
43374337
43384338 /* Maximum m_idx */
43394339 else if (zz[0][0] == 'M')
43404340 {
4341- current_floor_ptr->max_m_idx = (IDX)atoi(zz[1]);
4341+ current_floor_ptr->max_m_idx = (MONSTER_IDX)atoi(zz[1]);
43424342 }
43434343
43444344 /* Wilderness size */
@@ -4346,10 +4346,10 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
43464346 {
43474347 /* Maximum wild_x_size */
43484348 if (zz[0][1] == 'X')
4349- current_world_ptr->max_wild_x = atoi(zz[1]);
4349+ current_world_ptr->max_wild_x = (POSITION)atoi(zz[1]);
43504350 /* Maximum wild_y_size */
43514351 if (zz[0][1] == 'Y')
4352- current_world_ptr->max_wild_y = atoi(zz[1]);
4352+ current_world_ptr->max_wild_y = (POSITION)atoi(zz[1]);
43534353 }
43544354
43554355 return (0);
--- a/src/floor-events.c
+++ b/src/floor-events.c
@@ -145,7 +145,7 @@ byte get_dungeon_feeling(void)
145145 {
146146 const int base = 10;
147147 int rating = 0;
148- IDX i;
148+ MONSTER_IDX i;
149149
150150 /* Hack -- no feeling in the town */
151151 if (!current_floor_ptr->dun_level) return 0;
--- a/src/monster.h
+++ b/src/monster.h
@@ -511,8 +511,8 @@ extern void monster_drop_carried_objects(monster_type *m_ptr);
511511 #define is_friendly(A) \
512512 (bool)(((A)->smart & SM_FRIENDLY) ? TRUE : FALSE)
513513
514-#define is_friendly_idx(IDX) \
515- (bool)((IDX) > 0 && is_friendly(&current_floor_ptr->m_list[(IDX)]))
514+#define is_friendly_idx(MONSTER_IDX) \
515+ (bool)((MONSTER_IDX) > 0 && is_friendly(&current_floor_ptr->m_list[(MONSTER_IDX)]))
516516
517517 #define is_pet(A) \
518518 (bool)(((A)->smart & SM_PET) ? TRUE : FALSE)
--- a/src/rumor.c
+++ b/src/rumor.c
@@ -65,7 +65,8 @@ void display_rumor(bool ex)
6565 {
6666 if (strcmp(zz[0], "ARTIFACT") == 0)
6767 {
68- IDX a_idx, k_idx;
68+ ARTIFACT_IDX a_idx;
69+ KIND_OBJECT_IDX k_idx;
6970 object_type forge;
7071 object_type *q_ptr = &forge;
7172 artifact_type *a_ptr;
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -1527,7 +1527,7 @@ static void do_cmd_wiz_create_feature(void)
15271527 grid_type *g_ptr;
15281528 feature_type *f_ptr;
15291529 char tmp_val[160];
1530- IDX tmp_feat, tmp_mimic;
1530+ FEAT_IDX tmp_feat, tmp_mimic;
15311531 POSITION y, x;
15321532
15331533 if (!tgt_pt(&x, &y)) return;
@@ -1541,7 +1541,7 @@ static void do_cmd_wiz_create_feature(void)
15411541 if (!get_string(_("地形: ", "Feature: "), tmp_val, 3)) return;
15421542
15431543 /* Extract */
1544- tmp_feat = (IDX)atoi(tmp_val);
1544+ tmp_feat = (FEAT_IDX)atoi(tmp_val);
15451545 if (tmp_feat < 0) tmp_feat = 0;
15461546 else if (tmp_feat >= max_f_idx) tmp_feat = max_f_idx - 1;
15471547
@@ -1552,7 +1552,7 @@ static void do_cmd_wiz_create_feature(void)
15521552 if (!get_string(_("地形 (mimic): ", "Feature (mimic): "), tmp_val, 3)) return;
15531553
15541554 /* Extract */
1555- tmp_mimic = (IDX)atoi(tmp_val);
1555+ tmp_mimic = (FEAT_IDX)atoi(tmp_val);
15561556 if (tmp_mimic < 0) tmp_mimic = 0;
15571557 else if (tmp_mimic >= max_f_idx) tmp_mimic = max_f_idx - 1;
15581558
Show on old repository browser