• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision254c828a384c1c2893b662950c9f081af09efe64 (tree)
Time2019-02-28 08:10:53
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38995 world_type 構造体を作成し、 max_wild_x/y を取り込む。 / Create world_type structure and move max_wild_x/y to world_type.

Change Summary

Incremental Difference

--- a/src/bldg.c
+++ b/src/bldg.c
@@ -3699,9 +3699,9 @@ bool tele_town(void)
36993699 break;
37003700 }
37013701
3702- for (y = 0; y < max_wild_y; y++)
3702+ for (y = 0; y < current_world_ptr->max_wild_y; y++)
37033703 {
3704- for (x = 0; x < max_wild_x; x++)
3704+ for (x = 0; x < current_world_ptr->max_wild_x; x++)
37053705 {
37063706 if(wilderness[y][x].town == (i-'a'+1))
37073707 {
--- a/src/cmd4.c
+++ b/src/cmd4.c
@@ -8083,7 +8083,7 @@ static void do_cmd_knowledge_home(void)
80838083 GAME_TEXT o_name[MAX_NLEN];
80848084 concptr paren = ")";
80858085
8086- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8086+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
80878087
80888088 /* Open a new file */
80898089 fff = my_fopen_temp(file_name, 1024);
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -5825,7 +5825,7 @@ void play_game(bool new_game)
58255825 highscore_fd = fd_open(buf, O_RDWR);
58265826
58275827 /* 町名消失バグ対策(#38205) Init the wilderness */
5828- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
5828+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
58295829
58305830 /* Handle score, show Top scores */
58315831 success = send_world_score(TRUE);
@@ -6012,7 +6012,7 @@ void play_game(bool new_game)
60126012 {
60136013 /* Init the wilderness */
60146014
6015- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6015+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
60166016
60176017 /* Init the town */
60186018 init_flags = INIT_ONLY_BUILDINGS;
--- a/src/externs.h
+++ b/src/externs.h
@@ -258,6 +258,7 @@ extern byte angband_color_table[256][4];
258258 extern const concptr angband_sound_name[SOUND_MAX];
259259 extern const concptr angband_music_basic_name[MUSIC_BASIC_MAX];
260260 extern floor_type *current_floor_ptr;
261+extern world_type *current_world_ptr;
261262 extern saved_floor_type saved_floors[MAX_SAVED_FLOORS];
262263 extern FLOOR_IDX max_floor_id;
263264 extern u32b saved_floor_file_sign;
@@ -336,8 +337,6 @@ extern FEAT_IDX max_f_idx;
336337 extern ARTIFACT_IDX max_a_idx;
337338 extern EGO_IDX max_e_idx;
338339 extern DUNGEON_IDX max_d_idx;
339-extern POSITION max_wild_x;
340-extern POSITION max_wild_y;
341340 extern quest_type *quest;
342341 extern char quest_text[10][80];
343342 extern int quest_text_line;
--- a/src/files.c
+++ b/src/files.c
@@ -4896,7 +4896,7 @@ static void dump_aux_home_museum(FILE *fff)
48964896 store_type *st_ptr;
48974897
48984898 /* Do we need it?? */
4899- /* process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x); */
4899+ /* process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); */
49004900
49014901 /* Print the home */
49024902 st_ptr = &town_info[1].store[STORE_HOME];
--- a/src/init1.c
+++ b/src/init1.c
@@ -4391,10 +4391,10 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
43914391 {
43924392 /* Maximum wild_x_size */
43934393 if (zz[0][1] == 'X')
4394- max_wild_x = atoi(zz[1]);
4394+ current_world_ptr->max_wild_x = atoi(zz[1]);
43954395 /* Maximum wild_y_size */
43964396 if (zz[0][1] == 'Y')
4397- max_wild_y = atoi(zz[1]);
4397+ current_world_ptr->max_wild_y = atoi(zz[1]);
43984398 }
43994399
44004400 return (0);
--- a/src/load.c
+++ b/src/load.c
@@ -3707,7 +3707,7 @@ static errr rd_savefile_new_aux(void)
37073707 rd_s32b(&wild_y_size);
37083708
37093709 /* Incompatible save files */
3710- if ((wild_x_size > max_wild_x) || (wild_y_size > max_wild_y))
3710+ if ((wild_x_size > current_world_ptr->max_wild_x) || (wild_y_size > current_world_ptr->max_wild_y))
37113711 {
37123712 note(format(_("荒野が大きすぎる(%u/%u)!", "Wilderness is too big (%u/%u)!"), wild_x_size, wild_y_size));
37133713 return (23);
--- a/src/save.c
+++ b/src/save.c
@@ -1411,13 +1411,13 @@ static bool wr_savefile_new(void)
14111411 wr_byte(p_ptr->wild_mode);
14121412 wr_byte(ambush_flag);
14131413
1414- wr_s32b(max_wild_x);
1415- wr_s32b(max_wild_y);
1414+ wr_s32b(current_world_ptr->max_wild_x);
1415+ wr_s32b(current_world_ptr->max_wild_y);
14161416
14171417 /* Dump the wilderness seeds */
1418- for (i = 0; i < max_wild_x; i++)
1418+ for (i = 0; i < current_world_ptr->max_wild_x; i++)
14191419 {
1420- for (j = 0; j < max_wild_y; j++)
1420+ for (j = 0; j < current_world_ptr->max_wild_y; j++)
14211421 {
14221422 wr_u32b(wilderness[j][i].seed);
14231423 }
--- a/src/types.h
+++ b/src/types.h
@@ -1895,3 +1895,10 @@ typedef struct {
18951895
18961896 } floor_type;
18971897
1898+typedef struct {
1899+ /*
1900+ * Maximum size of the wilderness
1901+ */
1902+ POSITION max_wild_x;
1903+ POSITION max_wild_y;
1904+} world_type;
--- a/src/variable.c
+++ b/src/variable.c
@@ -461,8 +461,6 @@ const concptr angband_music_basic_name[MUSIC_BASIC_MAX] =
461461 floor_type floor;
462462 floor_type *current_floor_ptr = &floor;
463463
464-
465-
466464 /*
467465 * The array of saved floors
468466 */
@@ -475,6 +473,10 @@ saved_floor_type saved_floors[MAX_SAVED_FLOORS];
475473 FLOOR_IDX max_floor_id;
476474
477475
476+world_type world;
477+world_type *current_world_ptr = &world;
478+
479+
478480 /*
479481 * Sign for current process used in temporal files.
480482 * Actually it is the start time of current process.
@@ -754,11 +756,7 @@ EGO_IDX max_e_idx;
754756 */
755757 DUNGEON_IDX max_d_idx;
756758
757-/*
758- * Maximum size of the wilderness
759- */
760-POSITION max_wild_x;
761-POSITION max_wild_y;
759+
762760
763761 /*
764762 * Quest info
--- a/src/wild.c
+++ b/src/wild.c
@@ -464,7 +464,7 @@ void wilderness_gen(void)
464464
465465 /* Init the wilderness */
466466
467- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
467+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
468468
469469 x = p_ptr->wilderness_x;
470470 y = p_ptr->wilderness_y;
@@ -703,11 +703,11 @@ void wilderness_gen_small(void)
703703 }
704704
705705 /* Init the wilderness */
706- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
706+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
707707
708708 /* Fill the map */
709- for (i = 0; i < max_wild_x; i++)
710- for (j = 0; j < max_wild_y; j++)
709+ for (i = 0; i < current_world_ptr->max_wild_x; i++)
710+ for (j = 0; j < current_world_ptr->max_wild_y; j++)
711711 {
712712 if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN))
713713 {
@@ -725,8 +725,8 @@ void wilderness_gen_small(void)
725725 current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK);
726726 }
727727
728- current_floor_ptr->height = (s16b) max_wild_y;
729- current_floor_ptr->width = (s16b) max_wild_x;
728+ current_floor_ptr->height = (s16b) current_world_ptr->max_wild_y;
729+ current_floor_ptr->width = (s16b) current_world_ptr->max_wild_x;
730730
731731 if (current_floor_ptr->height > MAX_HGT) current_floor_ptr->height = MAX_HGT;
732732 if (current_floor_ptr->width > MAX_WID) current_floor_ptr->width = MAX_WID;
@@ -872,9 +872,9 @@ errr parse_line_wilderness(char *buf, int ymin, int xmin, int ymax, int xmax, in
872872 p_ptr->wilderness_x = atoi(zz[1]);
873873
874874 if ((p_ptr->wilderness_x < 1) ||
875- (p_ptr->wilderness_x > max_wild_x) ||
875+ (p_ptr->wilderness_x > current_world_ptr->max_wild_x) ||
876876 (p_ptr->wilderness_y < 1) ||
877- (p_ptr->wilderness_y > max_wild_y))
877+ (p_ptr->wilderness_y > current_world_ptr->max_wild_y))
878878 {
879879 return (PARSE_ERROR_OUT_OF_BOUNDS);
880880 }
@@ -917,9 +917,9 @@ void seed_wilderness(void)
917917 POSITION x, y;
918918
919919 /* Init wilderness seeds */
920- for (x = 0; x < max_wild_x; x++)
920+ for (x = 0; x < current_world_ptr->max_wild_x; x++)
921921 {
922- for (y = 0; y < max_wild_y; y++)
922+ for (y = 0; y < current_world_ptr->max_wild_y; y++)
923923 {
924924 wilderness[y][x].seed = randint0(0x10000000);
925925 wilderness[y][x].entrance = 0;
@@ -944,12 +944,12 @@ errr init_wilderness(void)
944944 int i;
945945
946946 /* Allocate the wilderness (two-dimension array) */
947- C_MAKE(wilderness, max_wild_y, wilderness_type_ptr);
948- C_MAKE(wilderness[0], max_wild_x * max_wild_y, wilderness_type);
947+ C_MAKE(wilderness, current_world_ptr->max_wild_y, wilderness_type_ptr);
948+ C_MAKE(wilderness[0], current_world_ptr->max_wild_x * current_world_ptr->max_wild_y, wilderness_type);
949949
950950 /* Init the other pointers */
951- for (i = 1; i < max_wild_y; i++)
952- wilderness[i] = wilderness[0] + i * max_wild_x;
951+ for (i = 1; i < current_world_ptr->max_wild_y; i++)
952+ wilderness[i] = wilderness[0] + i * current_world_ptr->max_wild_x;
953953
954954 generate_encounter = FALSE;
955955
Show on old repository browser