• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision24a2f02eca5e4b45296589db0f5408eb4eaa5967 (tree)
Time2019-02-27 00:42:27
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/chest.c
+++ b/src/chest.c
@@ -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 = base_level;
107+ object_level = current_floor->base_level;
108108
109109 /* No longer opening a chest */
110110 opening_chest = FALSE;
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -5269,7 +5269,7 @@ static void dungeon(bool load_game)
52695269 int quest_num = 0;
52705270
52715271 /* Set the base level */
5272- base_level = dun_level;
5272+ current_floor->base_level = dun_level;
52735273
52745274 /* Reset various flags */
52755275 is_loading_now = FALSE;
@@ -5418,10 +5418,10 @@ static void dungeon(bool load_game)
54185418 /*** Process this dungeon level ***/
54195419
54205420 /* Reset the monster generation level */
5421- monster_level = base_level;
5421+ monster_level = current_floor->base_level;
54225422
54235423 /* Reset the object generation level */
5424- object_level = base_level;
5424+ object_level = current_floor->base_level;
54255425
54265426 is_loading_now = TRUE;
54275427
--- a/src/externs.h
+++ b/src/externs.h
@@ -165,7 +165,6 @@ extern DEPTH dun_level;
165165 extern MONSTER_NUMBER num_repro;
166166 extern DEPTH object_level;
167167 extern DEPTH monster_level;
168-extern DEPTH base_level;
169168 extern bool invoking_midnight_curse;
170169 extern GAME_TURN turn;
171170 extern GAME_TURN turn_limit;
--- a/src/floor-generate.c
+++ b/src/floor-generate.c
@@ -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 = base_level;
940+ object_level = current_floor->base_level;
941941
942942 /* Put the Guardian */
943943 if (!alloc_guardian(TRUE)) return FALSE;
@@ -1195,10 +1195,10 @@ static void generate_fixed_floor(void)
11951195 }
11961196
11971197 /* Set the quest level */
1198- base_level = quest[p_ptr->inside_quest].level;
1199- dun_level = base_level;
1200- object_level = base_level;
1201- monster_level = base_level;
1198+ current_floor->base_level = quest[p_ptr->inside_quest].level;
1199+ dun_level = current_floor->base_level;
1200+ object_level = current_floor->base_level;
1201+ monster_level = current_floor->base_level;
12021202
12031203 if (record_stair) do_cmd_write_nikki(NIKKI_TO_QUEST, p_ptr->inside_quest, NULL);
12041204 get_mon_num_prep(get_monster_hook(), NULL);
@@ -1351,13 +1351,13 @@ void clear_cave(void)
13511351 p_ptr->x = p_ptr->y = 0;
13521352
13531353 /* Set the base level */
1354- base_level = dun_level;
1354+ current_floor->base_level = dun_level;
13551355
13561356 /* Reset the monster generation level */
1357- monster_level = base_level;
1357+ monster_level = current_floor->base_level;
13581358
13591359 /* Reset the object generation level */
1360- object_level = base_level;
1360+ object_level = current_floor->base_level;
13611361 }
13621362
13631363
--- a/src/grid.c
+++ b/src/grid.c
@@ -711,9 +711,9 @@ void vault_monsters(POSITION y1, POSITION x1, int num)
711711 if (!cave_empty_grid(g_ptr)) continue;
712712
713713 /* Place the monster (allow groups) */
714- monster_level = base_level + 2;
714+ monster_level = current_floor->base_level + 2;
715715 (void)place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
716- monster_level = base_level;
716+ monster_level = current_floor->base_level;
717717 }
718718 }
719719 }
--- a/src/init1.c
+++ b/src/init1.c
@@ -4006,11 +4006,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
40064006 /* Create a monster */
40074007 if (random & RANDOM_MONSTER)
40084008 {
4009- monster_level = base_level + monster_index;
4009+ monster_level = current_floor->base_level + monster_index;
40104010
40114011 place_monster(*y, *x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
40124012
4013- monster_level = base_level;
4013+ monster_level = current_floor->base_level;
40144014 }
40154015 else if (monster_index)
40164016 {
@@ -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 = base_level + object_index;
4061+ object_level = current_floor->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 = base_level;
4076+ object_level = current_floor->base_level;
40774077 }
40784078 else if (random & RANDOM_OBJECT)
40794079 {
4080- object_level = base_level + object_index;
4080+ object_level = current_floor->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 = base_level;
4090+ object_level = current_floor->base_level;
40914091 }
40924092 /* Random trap */
40934093 else if (random & RANDOM_TRAP)
@@ -4113,7 +4113,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
41134113 }
41144114
41154115 /* Apply magic (no messages, no artifacts) */
4116- apply_magic(o_ptr, base_level, AM_NO_FIXED_ART | AM_GOOD);
4116+ apply_magic(o_ptr, current_floor->base_level, AM_NO_FIXED_ART | AM_GOOD);
41174117
41184118 drop_here(o_ptr, *y, *x);
41194119 }
--- a/src/load.c
+++ b/src/load.c
@@ -2566,10 +2566,10 @@ static errr rd_dungeon_old(void)
25662566 }
25672567
25682568 /* Set the base level for old versions */
2569- base_level = dun_level;
2569+ current_floor->base_level = dun_level;
25702570
25712571 rd_s16b(&tmp16s);
2572- base_level = (DEPTH)tmp16s;
2572+ current_floor->base_level = (DEPTH)tmp16s;
25732573
25742574 rd_s16b(&tmp16s);
25752575 num_repro = (MONSTER_NUMBER)tmp16s;
@@ -2999,7 +2999,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
29992999
30003000 rd_s16b(&tmp16s);
30013001 dun_level = (DEPTH)tmp16s;
3002- base_level = dun_level;
3002+ current_floor->base_level = dun_level;
30033003 }
30043004 else
30053005 {
@@ -3029,7 +3029,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
30293029 }
30303030
30313031 rd_s16b(&tmp16s);
3032- base_level = (DEPTH)tmp16s;
3032+ current_floor->base_level = (DEPTH)tmp16s;
30333033 rd_s16b(&tmp16s);
30343034 num_repro = (MONSTER_NUMBER)tmp16s;
30353035
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -3092,7 +3092,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
30923092 }
30933093
30943094 /* Reset the object level */
3095- object_level = base_level;
3095+ object_level = current_floor->base_level;
30963096
30973097 /* Reset "coin" type */
30983098 coin_type = 0;
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -2857,11 +2857,11 @@ static IDX initial_r_appearance(MONRACE_IDX r_idx)
28572857 {
28582858 int attempts = 1000;
28592859 IDX ap_r_idx;
2860- DEPTH min = MIN(base_level-5, 50);
2860+ DEPTH min = MIN(current_floor->base_level-5, 50);
28612861
28622862 if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN)
28632863 {
2864- if (base_level == 0 || one_in_(5)) return MON_ALIEN_JURAL;
2864+ if (current_floor->base_level == 0 || one_in_(5)) return MON_ALIEN_JURAL;
28652865 }
28662866
28672867 if (!(r_info[r_idx].flags7 & RF7_TANUKI))
@@ -2871,7 +2871,7 @@ static IDX initial_r_appearance(MONRACE_IDX r_idx)
28712871
28722872 while (--attempts)
28732873 {
2874- ap_r_idx = get_mon_num(base_level + 10);
2874+ ap_r_idx = get_mon_num(current_floor->base_level + 10);
28752875 if (r_info[ap_r_idx].level >= min) return ap_r_idx;
28762876 }
28772877
--- 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 = base_level + 12;
464+ object_level = current_floor->base_level + 12;
465465 place_object(y, x, AM_GOOD | AM_GREAT);
466- object_level = base_level;
466+ object_level = current_floor->base_level;
467467 break;
468468
469469 case '~':
@@ -554,42 +554,42 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
554554 /* Monster */
555555 case '&':
556556 {
557- monster_level = base_level + 5;
557+ monster_level = current_floor->base_level + 5;
558558 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
559- monster_level = base_level;
559+ monster_level = current_floor->base_level;
560560 break;
561561 }
562562
563563 /* Meaner monster */
564564 case '@':
565565 {
566- monster_level = base_level + 11;
566+ monster_level = current_floor->base_level + 11;
567567 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
568- monster_level = base_level;
568+ monster_level = current_floor->base_level;
569569 break;
570570 }
571571
572572 /* Meaner monster, plus treasure */
573573 case '9':
574574 {
575- monster_level = base_level + 9;
575+ monster_level = current_floor->base_level + 9;
576576 place_monster(y, x, PM_ALLOW_SLEEP);
577- monster_level = base_level;
578- object_level = base_level + 7;
577+ monster_level = current_floor->base_level;
578+ object_level = current_floor->base_level + 7;
579579 place_object(y, x, AM_GOOD);
580- object_level = base_level;
580+ object_level = current_floor->base_level;
581581 break;
582582 }
583583
584584 /* Nasty monster and treasure */
585585 case '8':
586586 {
587- monster_level = base_level + 40;
587+ monster_level = current_floor->base_level + 40;
588588 place_monster(y, x, PM_ALLOW_SLEEP);
589- monster_level = base_level;
590- object_level = base_level + 20;
589+ monster_level = current_floor->base_level;
590+ object_level = current_floor->base_level + 20;
591591 place_object(y, x, AM_GOOD | AM_GREAT);
592- object_level = base_level;
592+ object_level = current_floor->base_level;
593593 break;
594594 }
595595
@@ -598,15 +598,15 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
598598 {
599599 if (randint0(100) < 50)
600600 {
601- monster_level = base_level + 3;
601+ monster_level = current_floor->base_level + 3;
602602 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
603- monster_level = base_level;
603+ monster_level = current_floor->base_level;
604604 }
605605 if (randint0(100) < 50)
606606 {
607- object_level = base_level + 7;
607+ object_level = current_floor->base_level + 7;
608608 place_object(y, x, 0L);
609- object_level = base_level;
609+ object_level = current_floor->base_level;
610610 }
611611 break;
612612 }
--- a/src/rooms.c
+++ b/src/rooms.c
@@ -1407,29 +1407,29 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14071407 if (value < 0)
14081408 {
14091409 /* Meanest monster + treasure */
1410- monster_level = base_level + 40;
1410+ monster_level = current_floor->base_level + 40;
14111411 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
1412- monster_level = base_level;
1413- object_level = base_level + 20;
1412+ monster_level = current_floor->base_level;
1413+ object_level = current_floor->base_level + 20;
14141414 place_object(y, x, AM_GOOD);
1415- object_level = base_level;
1415+ object_level = current_floor->base_level;
14161416 }
14171417 else if (value < 5)
14181418 {
14191419 /* Mean monster +treasure */
1420- monster_level = base_level + 20;
1420+ monster_level = current_floor->base_level + 20;
14211421 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
1422- monster_level = base_level;
1423- object_level = base_level + 10;
1422+ monster_level = current_floor->base_level;
1423+ object_level = current_floor->base_level + 10;
14241424 place_object(y, x, AM_GOOD);
1425- object_level = base_level;
1425+ object_level = current_floor->base_level;
14261426 }
14271427 else if (value < 10)
14281428 {
14291429 /* Monster */
1430- monster_level = base_level + 9;
1430+ monster_level = current_floor->base_level + 9;
14311431 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
1432- monster_level = base_level;
1432+ monster_level = current_floor->base_level;
14331433 }
14341434 else if (value < 17)
14351435 {
@@ -1457,9 +1457,9 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14571457 else if (value < 30)
14581458 {
14591459 /* Monster and trap */
1460- monster_level = base_level + 5;
1460+ monster_level = current_floor->base_level + 5;
14611461 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
1462- monster_level = base_level;
1462+ monster_level = current_floor->base_level;
14631463 place_trap(y, x);
14641464 }
14651465 else if (value < 40)
@@ -1467,15 +1467,15 @@ void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int diffi
14671467 /* Monster or object */
14681468 if (randint0(100) < 50)
14691469 {
1470- monster_level = base_level + 3;
1470+ monster_level = current_floor->base_level + 3;
14711471 place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
1472- monster_level = base_level;
1472+ monster_level = current_floor->base_level;
14731473 }
14741474 if (randint0(100) < 50)
14751475 {
1476- object_level = base_level + 7;
1476+ object_level = current_floor->base_level + 7;
14771477 place_object(y, x, 0L);
1478- object_level = base_level;
1478+ object_level = current_floor->base_level;
14791479 }
14801480 }
14811481 else if (value < 50)
--- a/src/save.c
+++ b/src/save.c
@@ -939,7 +939,7 @@ static void wr_saved_floor(saved_floor_type *sf_ptr)
939939 wr_s16b(sf_ptr->lower_floor_id);
940940 }
941941
942- wr_u16b((u16b)base_level);
942+ wr_u16b((u16b)current_floor->base_level);
943943 wr_u16b((s16b)num_repro);
944944 wr_u16b((u16b)p_ptr->y);
945945 wr_u16b((u16b)p_ptr->x);
--- a/src/types.h
+++ b/src/types.h
@@ -1876,4 +1876,5 @@ typedef struct {
18761876
18771877 typedef struct {
18781878 grid_type *grid_array[MAX_HGT];
1879+ DEPTH base_level;
18791880 } floor_type;
\ No newline at end of file
--- a/src/variable.c
+++ b/src/variable.c
@@ -113,11 +113,10 @@ GAME_TURN resting; /* Current counter for resting, if any */
113113
114114 POSITION cur_hgt; /* Current dungeon height */
115115 POSITION cur_wid; /* Current dungeon width */
116-DEPTH dun_level; /*!< 現在の実ダンジョン階層、base_levelの参照元となる / Current dungeon level */
116+DEPTH dun_level; /*!< 現在の実ダンジョン階層、current_floor->base_levelの参照元となる / Current dungeon level */
117117 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
118-DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
119-DEPTH object_level; /*!< アイテムの生成レベル、base_levelを起点に一時変更する時に参照 / Current object creation level */
120-DEPTH monster_level; /*!< モンスターの生成レベル、base_levelを起点に一時変更する時に参照 / Current monster creation level */
118+DEPTH object_level; /*!< アイテムの生成レベル、current_floor->base_levelを起点に一時変更する時に参照 / Current object creation level */
119+DEPTH monster_level; /*!< モンスターの生成レベル、current_floor->base_levelを起点に一時変更する時に参照 / Current monster creation level */
121120 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
122121
123122 GAME_TURN turn; /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
--- a/src/wild.c
+++ b/src/wild.c
@@ -325,16 +325,16 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner)
325325 p_ptr->town_num = wilderness[y][x].town;
326326
327327 /* Set the base level */
328- base_level = wilderness[y][x].level;
328+ current_floor->base_level = wilderness[y][x].level;
329329
330330 /* Set the dungeon level */
331331 dun_level = 0;
332332
333333 /* Set the monster generation level */
334- monster_level = base_level;
334+ monster_level = current_floor->base_level;
335335
336336 /* Set the object generation level */
337- object_level = base_level;
337+ object_level = current_floor->base_level;
338338
339339
340340 /* Create the town */
Show on old repository browser