• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision2e5b24b86bd7768d47c89561e87b2a43a05d7292 (tree)
Time2019-02-27 02:06:55
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38993 object_level を floor_type に取り込む。 / Move object_level to floor_type structure.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -2571,10 +2571,10 @@ bool make_artifact_special(object_type *o_ptr)
25712571
25722572 /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない /
25732573 * XXX XXX Enforce minimum "depth" (loosely) */
2574- if (a_ptr->level > object_level)
2574+ if (a_ptr->level > current_floor_ptr->object_level)
25752575 {
25762576 /* @note / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */
2577- int d = (a_ptr->level - object_level) * 2;
2577+ int d = (a_ptr->level - current_floor_ptr->object_level) * 2;
25782578 if (!one_in_(d)) continue;
25792579 }
25802580
@@ -2584,9 +2584,9 @@ bool make_artifact_special(object_type *o_ptr)
25842584 /*! @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。ベースアイテムの生成階層が足りない場合1/(不足階層*5) を満たさないと除外される。 /
25852585 * Find the base object. XXX XXX Enforce minimum "object" level (loosely). Acquire the "out-of-depth factor". Roll for out-of-depth creation. */
25862586 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
2587- if (k_info[k_idx].level > object_level)
2587+ if (k_info[k_idx].level > current_floor_ptr->object_level)
25882588 {
2589- int d = (k_info[k_idx].level - object_level) * 5;
2589+ int d = (k_info[k_idx].level - current_floor_ptr->object_level) * 5;
25902590 if (!one_in_(d)) continue;
25912591 }
25922592
--- a/src/bldg.c
+++ b/src/bldg.c
@@ -1870,7 +1870,7 @@ static bool kankin(void)
18701870
18711871 /* Prepare to make a prize */
18721872 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
1873- apply_magic(&forge, object_level, AM_NO_FIXED_ART);
1873+ apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART);
18741874
18751875 object_aware(&forge);
18761876 object_known(&forge);
--- a/src/chest.c
+++ b/src/chest.c
@@ -45,12 +45,12 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
4545 number = 5;
4646 small = FALSE;
4747 mode |= AM_GREAT;
48- object_level = o_ptr->xtra3;
48+ current_floor_ptr->object_level = o_ptr->xtra3;
4949 }
5050 else
5151 {
5252 /* Determine the "value" of the items */
53- object_level = ABS(o_ptr->pval) + 10;
53+ current_floor_ptr->object_level = ABS(o_ptr->pval) + 10;
5454 }
5555
5656 /* Zero pval means empty chest */
@@ -104,7 +104,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx)
104104 }
105105
106106 /* Reset the object level */
107- object_level = current_floor_ptr->base_level;
107+ current_floor_ptr->object_level = current_floor_ptr->base_level;
108108
109109 /* No longer opening a chest */
110110 opening_chest = FALSE;
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -5421,7 +5421,7 @@ static void dungeon(bool load_game)
54215421 monster_level = current_floor_ptr->base_level;
54225422
54235423 /* Reset the object generation level */
5424- object_level = current_floor_ptr->base_level;
5424+ current_floor_ptr->object_level = current_floor_ptr->base_level;
54255425
54265426 is_loading_now = TRUE;
54275427
--- a/src/externs.h
+++ b/src/externs.h
@@ -159,7 +159,6 @@ extern s16b command_new;
159159 extern bool msg_flag;
160160 extern s16b running;
161161 extern GAME_TURN resting;
162-extern DEPTH object_level;
163162 extern DEPTH monster_level;
164163 extern bool invoking_midnight_curse;
165164 extern GAME_TURN turn;
--- a/src/floor-generate.c
+++ b/src/floor-generate.c
@@ -926,7 +926,7 @@ static bool cave_gen(void)
926926 if (p_ptr->enter_dungeon && current_floor_ptr->dun_level > 1)
927927 {
928928 /* No stair scum! */
929- object_level = 1;
929+ current_floor_ptr->object_level = 1;
930930 }
931931
932932 /* Put some objects in rooms */
@@ -937,7 +937,7 @@ static bool cave_gen(void)
937937 alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
938938
939939 /* Set back to default */
940- object_level = current_floor_ptr->base_level;
940+ current_floor_ptr->object_level = current_floor_ptr->base_level;
941941
942942 /* Put the Guardian */
943943 if (!alloc_guardian(TRUE)) return FALSE;
@@ -1197,7 +1197,7 @@ static void generate_fixed_floor(void)
11971197 /* Set the quest level */
11981198 current_floor_ptr->base_level = quest[p_ptr->inside_quest].level;
11991199 current_floor_ptr->dun_level = current_floor_ptr->base_level;
1200- object_level = current_floor_ptr->base_level;
1200+ current_floor_ptr->object_level = current_floor_ptr->base_level;
12011201 monster_level = current_floor_ptr->base_level;
12021202
12031203 if (record_stair) do_cmd_write_nikki(NIKKI_TO_QUEST, p_ptr->inside_quest, NULL);
@@ -1357,7 +1357,7 @@ void clear_cave(void)
13571357 monster_level = current_floor_ptr->base_level;
13581358
13591359 /* Reset the object generation level */
1360- object_level = current_floor_ptr->base_level;
1360+ current_floor_ptr->object_level = current_floor_ptr->base_level;
13611361 }
13621362
13631363
--- a/src/gamevalue.h
+++ b/src/gamevalue.h
@@ -2,7 +2,7 @@
22 /*!
33 * @brief ベースアイテム生成階層が加算される確率
44 * @details
5-* There is a 1/10 (10%) chance of inflating the requested object_level
5+* There is a 1/10 (10%) chance of inflating the requested current_floor_ptr->object_level
66 * during the creation of an object (see "get_obj_num()" in "object.c").
77 * Lower values yield better objects more often.
88 */
--- a/src/init1.c
+++ b/src/init1.c
@@ -4058,7 +4058,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
40584058 /* Object (and possible trap) */
40594059 if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP))
40604060 {
4061- object_level = current_floor_ptr->base_level + object_index;
4061+ current_floor_ptr->object_level = current_floor_ptr->base_level + object_index;
40624062
40634063 /*
40644064 * Random trap and random treasure defined
@@ -4073,11 +4073,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
40734073 place_trap(*y, *x);
40744074 }
40754075
4076- object_level = current_floor_ptr->base_level;
4076+ current_floor_ptr->object_level = current_floor_ptr->base_level;
40774077 }
40784078 else if (random & RANDOM_OBJECT)
40794079 {
4080- object_level = current_floor_ptr->base_level + object_index;
4080+ current_floor_ptr->object_level = current_floor_ptr->base_level + object_index;
40814081
40824082 /* Create an out of deep object */
40834083 if (randint0(100) < 75)
@@ -4087,7 +4087,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
40874087 else
40884088 place_object(*y, *x, AM_GOOD | AM_GREAT);
40894089
4090- object_level = current_floor_ptr->base_level;
4090+ current_floor_ptr->object_level = current_floor_ptr->base_level;
40914091 }
40924092 /* Random trap */
40934093 else if (random & RANDOM_TRAP)
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -2615,7 +2615,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
26152615
26162616 /* Prepare to make a prize */
26172617 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
2618- apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
2618+ apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART);
26192619 (void)drop_near(q_ptr, -1, y, x);
26202620 }
26212621
@@ -2675,7 +2675,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
26752675 /* Prepare to make an object */
26762676 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
26772677
2678- apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
2678+ apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART);
26792679
26802680 q_ptr->pval = m_ptr->r_idx;
26812681 (void)drop_near(q_ptr, -1, y, x);
@@ -2722,7 +2722,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
27222722 /* Prepare to make a Blade of Chaos */
27232723 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
27242724
2725- apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
2725+ apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART | mo_mode);
27262726 (void)drop_near(q_ptr, -1, y, x);
27272727 }
27282728 break;
@@ -2874,7 +2874,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
28742874 /* Prepare to make a Can of Toys */
28752875 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
28762876
2877- apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
2877+ apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART);
28782878 (void)drop_near(q_ptr, -1, y, x);
28792879 }
28802880 break;
@@ -3034,7 +3034,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30343034 /* Prepare to make a reward */
30353035 object_prep(q_ptr, k_idx);
30363036
3037- apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
3037+ apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART | AM_GOOD);
30383038 (void)drop_near(q_ptr, -1, y, x);
30393039 }
30403040 msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[p_ptr->dungeon_idx].name);
@@ -3063,7 +3063,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30633063 coin_type = force_coin;
30643064
30653065 /* Average dungeon and monster levels */
3066- object_level = (current_floor_ptr->dun_level + r_ptr->level) / 2;
3066+ current_floor_ptr->object_level = (current_floor_ptr->dun_level + r_ptr->level) / 2;
30673067
30683068 /* Drop some objects */
30693069 for (j = 0; j < number; j++)
@@ -3092,7 +3092,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30923092 }
30933093
30943094 /* Reset the object level */
3095- object_level = current_floor_ptr->base_level;
3095+ current_floor_ptr->object_level = current_floor_ptr->base_level;
30963096
30973097 /* Reset "coin" type */
30983098 coin_type = 0;
--- a/src/object2.c
+++ b/src/object2.c
@@ -4637,7 +4637,7 @@ static bool kind_is_good(KIND_OBJECT_IDX k_idx)
46374637 * @return 生成に成功したらTRUEを返す。
46384638 * @details
46394639 * This routine plays nasty games to generate the "special artifacts".\n
4640- * This routine uses "object_level" for the "generation level".\n
4640+ * This routine uses "current_floor_ptr->object_level" for the "generation level".\n
46414641 * We assume that the given object has been "wiped".\n
46424642 */
46434643 bool make_object(object_type *j_ptr, BIT_FLAGS mode)
@@ -4650,7 +4650,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode)
46504650 prob = ((mode & AM_GOOD) ? 10 : 1000);
46514651
46524652 /* Base level for the object */
4653- base = ((mode & AM_GOOD) ? (object_level + 10) : object_level);
4653+ base = ((mode & AM_GOOD) ? (current_floor_ptr->object_level + 10) : current_floor_ptr->object_level);
46544654
46554655
46564656 /* Generate a special object, or a normal object */
@@ -4689,7 +4689,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode)
46894689 }
46904690
46914691 /* Apply magic (allow artifacts) */
4692- apply_magic(j_ptr, object_level, mode);
4692+ apply_magic(j_ptr, current_floor_ptr->object_level, mode);
46934693
46944694 /* Hack -- generate multiple spikes/missiles */
46954695 switch (j_ptr->tval)
@@ -4720,7 +4720,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode)
47204720 * @return 生成に成功したらTRUEを返す。
47214721 * @details
47224722 * This routine plays nasty games to generate the "special artifacts".\n
4723- * This routine uses "object_level" for the "generation level".\n
4723+ * This routine uses "current_floor_ptr->object_level" for the "generation level".\n
47244724 * This routine requires a clean floor grid destination.\n
47254725 */
47264726 void place_object(POSITION y, POSITION x, BIT_FLAGS mode)
@@ -4800,12 +4800,12 @@ bool make_gold(object_type *j_ptr)
48004800 s32b base;
48014801
48024802 /* Hack -- Pick a Treasure variety */
4803- i = ((randint1(object_level + 2) + 2) / 2) - 1;
4803+ i = ((randint1(current_floor_ptr->object_level + 2) + 2) / 2) - 1;
48044804
48054805 /* Apply "extra" magic */
48064806 if (one_in_(GREAT_OBJ))
48074807 {
4808- i += randint1(object_level + 1);
4808+ i += randint1(current_floor_ptr->object_level + 1);
48094809 }
48104810
48114811 /* Hack -- Creeping Coins only generate "themselves" */
--- a/src/rooms-vault.c
+++ b/src/rooms-vault.c
@@ -461,9 +461,9 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
461461
462462 case 'A':
463463 /* Reward for Pattern walk */
464- object_level = current_floor_ptr->base_level + 12;
464+ current_floor_ptr->object_level = current_floor_ptr->base_level + 12;
465465 place_object(y, x, AM_GOOD | AM_GREAT);
466- object_level = current_floor_ptr->base_level;
466+ current_floor_ptr->object_level = current_floor_ptr->base_level;
467467 break;
468468
469469 case '~':
@@ -575,9 +575,9 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
575575 monster_level = current_floor_ptr->base_level + 9;
576576 place_monster(y, x, PM_ALLOW_SLEEP);
577577 monster_level = current_floor_ptr->base_level;
578- object_level = current_floor_ptr->base_level + 7;
578+ current_floor_ptr->object_level = current_floor_ptr->base_level + 7;
579579 place_object(y, x, AM_GOOD);
580- object_level = current_floor_ptr->base_level;
580+ current_floor_ptr->object_level = current_floor_ptr->base_level;
581581 break;
582582 }
583583
@@ -587,9 +587,9 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
587587 monster_level = current_floor_ptr->base_level + 40;
588588 place_monster(y, x, PM_ALLOW_SLEEP);
589589 monster_level = current_floor_ptr->base_level;
590- object_level = current_floor_ptr->base_level + 20;
590+ current_floor_ptr->object_level = current_floor_ptr->base_level + 20;
591591 place_object(y, x, AM_GOOD | AM_GREAT);
592- object_level = current_floor_ptr->base_level;
592+ current_floor_ptr->object_level = current_floor_ptr->base_level;
593593 break;
594594 }
595595
@@ -604,9 +604,9 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
604604 }
605605 if (randint0(100) < 50)
606606 {
607- object_level = current_floor_ptr->base_level + 7;
607+ current_floor_ptr->object_level = current_floor_ptr->base_level + 7;
608608 place_object(y, x, 0L);
609- object_level = current_floor_ptr->base_level;
609+ current_floor_ptr->object_level = current_floor_ptr->base_level;
610610 }
611611 break;
612612 }
--- a/src/rooms.c
+++ b/src/rooms.c
@@ -1410,9 +1410,9 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14101410 monster_level = current_floor_ptr->base_level + 40;
14111411 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
14121412 monster_level = current_floor_ptr->base_level;
1413- object_level = current_floor_ptr->base_level + 20;
1413+ current_floor_ptr->object_level = current_floor_ptr->base_level + 20;
14141414 place_object(y, x, AM_GOOD);
1415- object_level = current_floor_ptr->base_level;
1415+ current_floor_ptr->object_level = current_floor_ptr->base_level;
14161416 }
14171417 else if (value < 5)
14181418 {
@@ -1420,9 +1420,9 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14201420 monster_level = current_floor_ptr->base_level + 20;
14211421 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
14221422 monster_level = current_floor_ptr->base_level;
1423- object_level = current_floor_ptr->base_level + 10;
1423+ current_floor_ptr->object_level = current_floor_ptr->base_level + 10;
14241424 place_object(y, x, AM_GOOD);
1425- object_level = current_floor_ptr->base_level;
1425+ current_floor_ptr->object_level = current_floor_ptr->base_level;
14261426 }
14271427 else if (value < 10)
14281428 {
@@ -1473,9 +1473,9 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14731473 }
14741474 if (randint0(100) < 50)
14751475 {
1476- object_level = current_floor_ptr->base_level + 7;
1476+ current_floor_ptr->object_level = current_floor_ptr->base_level + 7;
14771477 place_object(y, x, 0L);
1478- object_level = current_floor_ptr->base_level;
1478+ current_floor_ptr->object_level = current_floor_ptr->base_level;
14791479 }
14801480 }
14811481 else if (value < 50)
--- a/src/types.h
+++ b/src/types.h
@@ -1878,6 +1878,7 @@ typedef struct {
18781878 grid_type *grid_array[MAX_HGT];
18791879 DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */
18801880 DEPTH base_level;
1881+ DEPTH object_level; /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
18811882 POSITION width; /* Current dungeon width */
18821883 POSITION height; /* Current dungeon height */
18831884 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
--- a/src/variable.c
+++ b/src/variable.c
@@ -111,7 +111,6 @@ bool msg_flag; /* Used in msg_print() for "buffering" */
111111 s16b running; /* Current counter for running, if any */
112112 GAME_TURN resting; /* Current counter for resting, if any */
113113
114-DEPTH object_level; /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
115114 DEPTH monster_level; /*!< モンスターの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */
116115 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
117116
--- a/src/wild.c
+++ b/src/wild.c
@@ -334,7 +334,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner)
334334 monster_level = current_floor_ptr->base_level;
335335
336336 /* Set the object generation level */
337- object_level = current_floor_ptr->base_level;
337+ current_floor_ptr->object_level = current_floor_ptr->base_level;
338338
339339
340340 /* Create the town */
Show on old repository browser