OSDN Git Service

[Refactor] #38997 add_river(), generate_hmap(), generate_fracave() にfloor_type *...
authordeskull <deskull@users.sourceforge.jp>
Sun, 6 Oct 2019 09:07:30 +0000 (18:07 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 6 Oct 2019 09:07:30 +0000 (18:07 +0900)
src/core.c
src/floor-generate.c
src/floor-streams.c
src/floor-streams.h
src/rooms-fractal.c
src/rooms-vault.c
src/rooms.c
src/rooms.h

index b5cd058..872843d 100644 (file)
@@ -4406,32 +4406,32 @@ static void process_fishing(void)
  * must come first just in case somebody manages to corrupt\n
  * the savefiles by clever use of menu commands or something.\n
  */
-static void process_player(void)
+static void process_player(player_type *creature_ptr)
 {
        MONSTER_IDX m_idx;
 
        /*** Apply energy ***/
 
-       if (p_ptr->hack_mutation)
+       if (creature_ptr->hack_mutation)
        {
                msg_print(_("何か変わった気がする!", "You feel different!"));
 
-               (void)gain_mutation(p_ptr, 0);
-               p_ptr->hack_mutation = FALSE;
+               (void)gain_mutation(creature_ptr, 0);
+               creature_ptr->hack_mutation = FALSE;
        }
 
-       if (p_ptr->invoking_midnight_curse)
+       if (creature_ptr->invoking_midnight_curse)
        {
                int count = 0;
                activate_ty_curse(FALSE, &count);
-               p_ptr->invoking_midnight_curse = FALSE;
+               creature_ptr->invoking_midnight_curse = FALSE;
        }
 
-       if (p_ptr->phase_out)
+       if (creature_ptr->phase_out)
        {
-               for(m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++)
+               for(m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
                {
-                       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+                       monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
                        if (!monster_is_valid(m_ptr)) continue;
 
@@ -4442,56 +4442,56 @@ static void process_player(void)
        }
 
        /* Give the player some energy */
-       else if (!(load && p_ptr->energy_need <= 0))
+       else if (!(load && creature_ptr->energy_need <= 0))
        {
-               p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
+               creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
        }
 
        /* No current_world_ptr->game_turn yet */
-       if (p_ptr->energy_need > 0) return;
+       if (creature_ptr->energy_need > 0) return;
        if (!command_rep) prt_time();
 
        /*** Check for interupts ***/
 
        /* Complete resting */
-       if (p_ptr->resting < 0)
+       if (creature_ptr->resting < 0)
        {
                /* Basic resting */
-               if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
+               if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
                {
                        /* Stop resting */
-                       if ((p_ptr->chp == p_ptr->mhp) &&
-                           (p_ptr->csp >= p_ptr->msp))
+                       if ((creature_ptr->chp == creature_ptr->mhp) &&
+                           (creature_ptr->csp >= creature_ptr->msp))
                        {
-                               set_action(p_ptr, ACTION_NONE);
+                               set_action(creature_ptr, ACTION_NONE);
                        }
                }
 
                /* Complete resting */
-               else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
+               else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
                {
                        /* Stop resting */
-                       if ((p_ptr->chp == p_ptr->mhp) &&
-                           (p_ptr->csp >= p_ptr->msp) &&
-                           !p_ptr->blind && !p_ptr->confused &&
-                           !p_ptr->poisoned && !p_ptr->afraid &&
-                           !p_ptr->stun && !p_ptr->cut &&
-                           !p_ptr->slow && !p_ptr->paralyzed &&
-                           !p_ptr->image && !p_ptr->word_recall &&
-                           !p_ptr->alter_reality)
+                       if ((creature_ptr->chp == creature_ptr->mhp) &&
+                           (creature_ptr->csp >= creature_ptr->msp) &&
+                           !creature_ptr->blind && !creature_ptr->confused &&
+                           !creature_ptr->poisoned && !creature_ptr->afraid &&
+                           !creature_ptr->stun && !creature_ptr->cut &&
+                           !creature_ptr->slow && !creature_ptr->paralyzed &&
+                           !creature_ptr->image && !creature_ptr->word_recall &&
+                           !creature_ptr->alter_reality)
                        {
-                               set_action(p_ptr, ACTION_NONE);
+                               set_action(creature_ptr, ACTION_NONE);
                        }
                }
        }
 
-       if (p_ptr->action == ACTION_FISH) process_fishing();
+       if (creature_ptr->action == ACTION_FISH) process_fishing();
 
        /* Handle "abort" */
        if (check_abort)
        {
                /* Check for "player abort" (semi-efficiently for resting) */
-               if (p_ptr->running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
+               if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
                {
                        /* Do not wait */
                        inkey_scan = TRUE;
@@ -4501,7 +4501,7 @@ static void process_player(void)
                        {
                                flush(); /* Flush input */
 
-                               disturb(p_ptr, FALSE, TRUE);
+                               disturb(creature_ptr, FALSE, TRUE);
 
                                /* Hack -- Show a Message */
                                msg_print(_("中断しました。", "Canceled."));
@@ -4509,9 +4509,9 @@ static void process_player(void)
                }
        }
 
-       if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
+       if (creature_ptr->riding && !creature_ptr->confused && !creature_ptr->blind)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                if (MON_CSLEEP(m_ptr))
@@ -4519,7 +4519,7 @@ static void process_player(void)
                        GAME_TEXT m_name[MAX_NLEN];
 
                        /* Recover fully */
-                       (void)set_monster_csleep(p_ptr->riding, 0);
+                       (void)set_monster_csleep(creature_ptr->riding, 0);
                        monster_desc(m_name, m_ptr, 0);
                        msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
                }
@@ -4527,8 +4527,8 @@ static void process_player(void)
                if (MON_STUNNED(m_ptr))
                {
                        /* Hack -- Recover from stun */
-                       if (set_monster_stunned(p_ptr->riding,
-                               (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
+                       if (set_monster_stunned(creature_ptr->riding,
+                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
@@ -4539,8 +4539,8 @@ static void process_player(void)
                if (MON_CONFUSED(m_ptr))
                {
                        /* Hack -- Recover from confusion */
-                       if (set_monster_confused(p_ptr->riding,
-                               (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
+                       if (set_monster_confused(creature_ptr->riding,
+                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
@@ -4551,8 +4551,8 @@ static void process_player(void)
                if (MON_MONFEAR(m_ptr))
                {
                        /* Hack -- Recover from fear */
-                       if(set_monster_monfear(p_ptr->riding,
-                               (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
+                       if(set_monster_monfear(creature_ptr->riding,
+                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
@@ -4566,51 +4566,51 @@ static void process_player(void)
        load = FALSE;
 
        /* Fast */
-       if (p_ptr->lightspeed)
+       if (creature_ptr->lightspeed)
        {
-               (void)set_lightspeed(p_ptr, p_ptr->lightspeed - 1, TRUE);
+               (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
        }
-       if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
+       if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
        {
                if(P_PTR_KI < 40) P_PTR_KI = 0;
                else P_PTR_KI -= 40;
-               p_ptr->update |= (PU_BONUS);
+               creature_ptr->update |= (PU_BONUS);
        }
-       if (p_ptr->action == ACTION_LEARN)
+       if (creature_ptr->action == ACTION_LEARN)
        {
                s32b cost = 0L;
-               u32b cost_frac = (p_ptr->msp + 30L) * 256L;
+               u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(cost, cost_frac, 16);
  
-               if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
+               if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
                {
                        /* Mana run out */
-                       p_ptr->csp = 0;
-                       p_ptr->csp_frac = 0;
-                       set_action(p_ptr, ACTION_NONE);
+                       creature_ptr->csp = 0;
+                       creature_ptr->csp_frac = 0;
+                       set_action(creature_ptr, ACTION_NONE);
                }
                else
                {
                        /* Reduce mana */
-                       s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
+                       s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
                }
-               p_ptr->redraw |= PR_MANA;
+               creature_ptr->redraw |= PR_MANA;
        }
 
-       if (p_ptr->special_defense & KATA_MASK)
+       if (creature_ptr->special_defense & KATA_MASK)
        {
-               if (p_ptr->special_defense & KATA_MUSOU)
+               if (creature_ptr->special_defense & KATA_MUSOU)
                {
-                       if (p_ptr->csp < 3)
+                       if (creature_ptr->csp < 3)
                        {
-                               set_action(p_ptr, ACTION_NONE);
+                               set_action(creature_ptr, ACTION_NONE);
                        }
                        else
                        {
-                               p_ptr->csp -= 2;
-                               p_ptr->redraw |= (PR_MANA);
+                               creature_ptr->csp -= 2;
+                               creature_ptr->redraw |= (PR_MANA);
                        }
                }
        }
@@ -4618,17 +4618,17 @@ static void process_player(void)
        /*** Handle actual user input ***/
 
        /* Repeat until out of energy */
-       while (p_ptr->energy_need <= 0)
+       while (creature_ptr->energy_need <= 0)
        {
-               p_ptr->window |= PW_PLAYER;
-               p_ptr->sutemi = FALSE;
-               p_ptr->counter = FALSE;
-               p_ptr->now_damaged = FALSE;
+               creature_ptr->window |= PW_PLAYER;
+               creature_ptr->sutemi = FALSE;
+               creature_ptr->counter = FALSE;
+               creature_ptr->now_damaged = FALSE;
 
                handle_stuff();
 
                /* Place the cursor on the player */
-               move_cursor_relative(p_ptr->y, p_ptr->x);
+               move_cursor_relative(creature_ptr->y, creature_ptr->x);
 
                /* Refresh (optional) */
                if (fresh_before) Term_fresh();
@@ -4640,49 +4640,49 @@ static void process_player(void)
                if (!command_new) command_see = FALSE;
 
                /* Assume free current_world_ptr->game_turn */
-               free_turn(p_ptr);
+               free_turn(creature_ptr);
 
-               if (p_ptr->phase_out)
+               if (creature_ptr->phase_out)
                {
                        /* Place the cursor on the player */
-                       move_cursor_relative(p_ptr->y, p_ptr->x);
+                       move_cursor_relative(creature_ptr->y, creature_ptr->x);
 
                        command_cmd = SPECIAL_KEY_BUILDING;
 
                        /* Process the command */
-                       process_command(p_ptr);
+                       process_command(creature_ptr);
                }
 
                /* Paralyzed or Knocked Out */
-               else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
+               else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
                {
-                       take_turn(p_ptr, 100);
+                       take_turn(creature_ptr, 100);
                }
 
                /* Resting */
-               else if (p_ptr->action == ACTION_REST)
+               else if (creature_ptr->action == ACTION_REST)
                {
                        /* Timed rest */
-                       if (p_ptr->resting > 0)
+                       if (creature_ptr->resting > 0)
                        {
                                /* Reduce rest count */
-                               p_ptr->resting--;
+                               creature_ptr->resting--;
 
-                               if (!p_ptr->resting) set_action(p_ptr, ACTION_NONE);
-                               p_ptr->redraw |= (PR_STATE);
+                               if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
+                               creature_ptr->redraw |= (PR_STATE);
                        }
 
-                       take_turn(p_ptr, 100);
+                       take_turn(creature_ptr, 100);
                }
 
                /* Fishing */
-               else if (p_ptr->action == ACTION_FISH)
+               else if (creature_ptr->action == ACTION_FISH)
                {
-                       take_turn(p_ptr, 100);
+                       take_turn(creature_ptr, 100);
                }
 
                /* Running */
-               else if (p_ptr->running)
+               else if (creature_ptr->running)
                {
                        /* Take a step */
                        run_step(0);
@@ -4703,7 +4703,7 @@ static void process_player(void)
                        /* Count this execution */
                        command_rep--;
 
-                       p_ptr->redraw |= (PR_STATE);
+                       creature_ptr->redraw |= (PR_STATE);
                        handle_stuff();
 
                        /* Hack -- Assume messages were seen */
@@ -4713,14 +4713,14 @@ static void process_player(void)
                        prt("", 0, 0);
 
                        /* Process the command */
-                       process_command(p_ptr);
+                       process_command(creature_ptr);
                }
 
                /* Normal command */
                else
                {
                        /* Place the cursor on the player */
-                       move_cursor_relative(p_ptr->y, p_ptr->x);
+                       move_cursor_relative(creature_ptr->y, creature_ptr->x);
 
                        can_save = TRUE;
                        /* Get a command (normal) */
@@ -4728,7 +4728,7 @@ static void process_player(void)
                        can_save = FALSE;
 
                        /* Process the command */
-                       process_command(p_ptr);
+                       process_command(creature_ptr);
                }
 
                /* Hack -- Pack Overflow */
@@ -4737,30 +4737,30 @@ static void process_player(void)
                /*** Clean up ***/
 
                /* Significant */
-               if (p_ptr->energy_use)
+               if (creature_ptr->energy_use)
                {
                        /* Use some energy */
-                       if (p_ptr->timewalk || p_ptr->energy_use > 400)
+                       if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
                        {
                                /* The Randomness is irrelevant */
-                               p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
+                               creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
                        }
                        else
                        {
                                /* There is some randomness of needed energy */
-                               p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
+                               creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
                        }
 
                        /* Hack -- constant hallucination */
-                       if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
+                       if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
 
                        /* Shimmer multi-hued monsters */
-                       for (m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++)
+                       for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
                        {
                                monster_type *m_ptr;
                                monster_race *r_ptr;
 
-                               m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+                               m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
                                if (!monster_is_valid(m_ptr)) continue;
 
                                /* Skip unseen monsters */
@@ -4785,10 +4785,10 @@ static void process_player(void)
                                repair_monsters = FALSE;
 
                                /* Rotate detection flags */
-                               for (m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++)
+                               for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
                                {
                                        monster_type *m_ptr;
-                                       m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+                                       m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
                                        if (!monster_is_valid(m_ptr)) continue;
 
                                        /* Nice monsters get mean */
@@ -4821,8 +4821,8 @@ static void process_player(void)
                                                        m_ptr->ml = FALSE;
                                                        update_monster(m_idx, FALSE);
 
-                                                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                                                       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                                                       if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
+                                                       if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
 
                                                        /* Redraw regardless */
                                                        lite_spot(m_ptr->fy, m_ptr->fx);
@@ -4830,55 +4830,55 @@ static void process_player(void)
                                        }
                                }
                        }
-                       if (p_ptr->pclass == CLASS_IMITATOR)
+                       if (creature_ptr->pclass == CLASS_IMITATOR)
                        {
                                int j;
-                               if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
+                               if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
                                {
-                                       p_ptr->mane_num--;
-                                       for (j = 0; j < p_ptr->mane_num; j++)
+                                       creature_ptr->mane_num--;
+                                       for (j = 0; j < creature_ptr->mane_num; j++)
                                        {
-                                               p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
-                                               p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
+                                               creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
+                                               creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
                                        }
                                }
-                               p_ptr->new_mane = FALSE;
-                               p_ptr->redraw |= (PR_IMITATION);
+                               creature_ptr->new_mane = FALSE;
+                               creature_ptr->redraw |= (PR_IMITATION);
                        }
-                       if (p_ptr->action == ACTION_LEARN)
+                       if (creature_ptr->action == ACTION_LEARN)
                        {
-                               p_ptr->new_mane = FALSE;
-                               p_ptr->redraw |= (PR_STATE);
+                               creature_ptr->new_mane = FALSE;
+                               creature_ptr->redraw |= (PR_STATE);
                        }
 
-                       if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
+                       if (creature_ptr->timewalk && (creature_ptr->energy_need > - 1000))
                        {
 
-                               p_ptr->redraw |= (PR_MAP);
-                               p_ptr->update |= (PU_MONSTERS);
-                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                               creature_ptr->redraw |= (PR_MAP);
+                               creature_ptr->update |= (PU_MONSTERS);
+                               creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                                msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
                                msg_print(NULL);
-                               p_ptr->timewalk = FALSE;
-                               p_ptr->energy_need = ENERGY_NEED();
+                               creature_ptr->timewalk = FALSE;
+                               creature_ptr->energy_need = ENERGY_NEED();
 
                                handle_stuff();
                        }
                }
 
                /* Hack -- notice death */
-               if (!p_ptr->playing || p_ptr->is_dead)
+               if (!creature_ptr->playing || creature_ptr->is_dead)
                {
-                       p_ptr->timewalk = FALSE;
+                       creature_ptr->timewalk = FALSE;
                        break;
                }
 
                /* Sniper */
-               if (p_ptr->energy_use && p_ptr->reset_concent) reset_concentration(p_ptr, TRUE);
+               if (creature_ptr->energy_use && creature_ptr->reset_concent) reset_concentration(creature_ptr, TRUE);
 
                /* Handle "leaving" */
-               if (p_ptr->leaving) break;
+               if (creature_ptr->leaving) break;
        }
 
        /* Update scent trail */
@@ -5074,7 +5074,7 @@ static void dungeon(bool load_game)
                if (p_ptr->current_floor_ptr->o_cnt + 32 < p_ptr->current_floor_ptr->o_max) compact_objects(0);
 
                /* Process the player */
-               process_player();
+               process_player(p_ptr);
                process_upkeep_with_speed();
 
                handle_stuff();
index de3fa24..6d2bdc3 100644 (file)
@@ -758,7 +758,7 @@ static bool cave_gen(dungeon_type* dungeon_ptr, floor_type *floor_ptr)
                                    ((dun->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER)) ||
                                     !dun->laketype)
                                {
-                                       add_river(feat1, feat2);
+                                       add_river(floor_ptr, feat1, feat2);
                                }
                        }
                }
index 0eaec0b..355d016 100644 (file)
@@ -166,7 +166,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2,
  * @param feat2 境界部地形ID
  * @return なし
  */
-void add_river(FEAT_IDX feat1, FEAT_IDX feat2)
+void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2)
 {
        POSITION y2, x2;
        POSITION y1 = 0, x1 = 0;
@@ -174,8 +174,8 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2)
 
 
        /* Hack -- Choose starting point */
-       y2 = randint1(p_ptr->current_floor_ptr->height / 2 - 2) + p_ptr->current_floor_ptr->height / 2;
-       x2 = randint1(p_ptr->current_floor_ptr->width / 2 - 2) + p_ptr->current_floor_ptr->width / 2;
+       y2 = randint1(floor_ptr->height / 2 - 2) + floor_ptr->height / 2;
+       x2 = randint1(floor_ptr->width / 2 - 2) + floor_ptr->width / 2;
 
        /* Hack -- Choose ending point somewhere on boundary */
        switch(randint1(4))
@@ -183,7 +183,7 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2)
                case 1:
                {
                        /* top boundary */
-                       x1 = randint1(p_ptr->current_floor_ptr->width-2)+1;
+                       x1 = randint1(floor_ptr->width-2)+1;
                        y1 = 1;
                        break;
                }
@@ -191,21 +191,21 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2)
                {
                        /* left boundary */
                        x1 = 1;
-                       y1 = randint1(p_ptr->current_floor_ptr->height-2)+1;
+                       y1 = randint1(floor_ptr->height-2)+1;
                        break;
                }
                case 3:
                {
                        /* right boundary */
-                       x1 = p_ptr->current_floor_ptr->width-1;
-                       y1 = randint1(p_ptr->current_floor_ptr->height-2)+1;
+                       x1 = floor_ptr->width-1;
+                       y1 = randint1(floor_ptr->height-2)+1;
                        break;
                }
                case 4:
                {
                        /* bottom boundary */
-                       x1 = randint1(p_ptr->current_floor_ptr->width-2)+1;
-                       y1 = p_ptr->current_floor_ptr->height-1;
+                       x1 = randint1(floor_ptr->width-2)+1;
+                       y1 = floor_ptr->height-1;
                        break;
                }
        }
index 9786a56..296e516 100644 (file)
@@ -14,7 +14,7 @@
 
 /* Externs */
 
-extern void add_river(FEAT_IDX feat1, FEAT_IDX feat2);
+extern void add_river(floor_type *floor_ptr, FEAT_IDX feat1, FEAT_IDX feat2);
 extern void build_streamer(FEAT_IDX feat, int chance);
 extern void place_trees(POSITION x, POSITION y);
 extern void destroy_level(void);
index 010e429..88fea80 100644 (file)
@@ -60,10 +60,10 @@ bool build_type9(void)
                        randint1(xsize / 4) + randint1(ysize / 4);
 
                /* make it */
-               generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
+               generate_hmap(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
 
                /* Convert to normal format + clean up */
-               done = generate_fracave(y0, x0, xsize, ysize, cutoff, light, room);
+               done = generate_fracave(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, cutoff, light, room);
        }
 
        return TRUE;
index d71ae91..3da9d85 100644 (file)
@@ -248,10 +248,10 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y
                        randint1(xsize / 4) + randint1(ysize / 4);
 
                /* make it */
-               generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
+               generate_hmap(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
 
                /* Convert to normal format+ clean up */
-               done = generate_fracave(y0, x0, xsize, ysize, cutoff, light, room);
+               done = generate_fracave(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, cutoff, light, room);
        }
 
        /* Set icky flag because is a vault */
@@ -324,7 +324,7 @@ static void coord_trans(POSITION *x, POSITION *y, POSITION xoffset, POSITION yof
 * @param transno 変換ID
 * @return なし
 */
-static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data,
+static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data,
        POSITION xoffset, POSITION yoffset, int transno)
 {
        POSITION dx, dy, x, y, i, j;
@@ -358,7 +358,7 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
 
                        /* Hack -- skip "non-grids" */
                        if (*t == ' ') continue;
-                       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+                       g_ptr = &floor_ptr->grid_array[y][x];
 
                        /* Lay down a floor */
                        place_floor_grid(g_ptr);
@@ -444,92 +444,92 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
 
                                /* Black market in a dungeon */
                        case 'S':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_black_market);
+                               set_cave_feat(floor_ptr, y, x, feat_black_market);
                                store_init(NO_TOWN, STORE_BLACK);
                                break;
 
                                /* The Pattern */
                        case 'p':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_start);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_start);
                                break;
 
                        case 'a':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_1);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_1);
                                break;
 
                        case 'b':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_2);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_2);
                                break;
 
                        case 'c':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_3);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_3);
                                break;
 
                        case 'd':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_4);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_4);
                                break;
 
                        case 'P':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_end);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_end);
                                break;
 
                        case 'B':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_exit);
+                               set_cave_feat(floor_ptr, y, x, feat_pattern_exit);
                                break;
 
                        case 'A':
                                /* Reward for Pattern walk */
-                               p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 12;
+                               floor_ptr->object_level = floor_ptr->base_level + 12;
                                place_object(y, x, AM_GOOD | AM_GREAT);
-                               p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
+                               floor_ptr->object_level = floor_ptr->base_level;
                                break;
 
                        case '~':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_water);
+                               set_cave_feat(floor_ptr, y, x, feat_shallow_water);
                                break;
 
                        case '=':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_water);
+                               set_cave_feat(floor_ptr, y, x, feat_deep_water);
                                break;
 
                        case 'v':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_lava);
+                               set_cave_feat(floor_ptr, y, x, feat_shallow_lava);
                                break;
 
                        case 'w':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_lava);
+                               set_cave_feat(floor_ptr, y, x, feat_deep_lava);
                                break;
 
                        case 'f':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_acid_puddle);
+                               set_cave_feat(floor_ptr, y, x, feat_shallow_acid_puddle);
                                break;
 
                        case 'F':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_acid_puddle);
+                               set_cave_feat(floor_ptr, y, x, feat_deep_acid_puddle);
                                break;
 
                        case 'g':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_poisonous_puddle);
+                               set_cave_feat(floor_ptr, y, x, feat_shallow_poisonous_puddle);
                                break;
 
                        case 'G':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_poisonous_puddle);
+                               set_cave_feat(floor_ptr, y, x, feat_deep_poisonous_puddle);
                                break;
 
                        case 'h':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_cold_zone);
+                               set_cave_feat(floor_ptr, y, x, feat_cold_zone);
                                break;
 
                        case 'H':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_heavy_cold_zone);
+                               set_cave_feat(floor_ptr, y, x, feat_heavy_cold_zone);
                                break;
 
                        case 'i':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_electrical_zone);
+                               set_cave_feat(floor_ptr, y, x, feat_electrical_zone);
                                break;
 
                        case 'I':
-                               set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_heavy_electrical_zone);
+                               set_cave_feat(floor_ptr, y, x, feat_heavy_electrical_zone);
                                break;
 
                        }
@@ -570,42 +570,42 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
                        {
                                case '&':
                                {
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 5;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 5;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
                                        break;
                                }
 
                                /* Meaner monster */
                                case '@':
                                {
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 11;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 11;
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
                                        break;
                                }
 
                                /* Meaner monster, plus treasure */
                                case '9':
                                {
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 9;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 9;
                                        place_monster(y, x, PM_ALLOW_SLEEP);
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
-                                       p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 7;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level + 7;
                                        place_object(y, x, AM_GOOD);
-                                       p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level;
                                        break;
                                }
 
                                /* Nasty monster and treasure */
                                case '8':
                                {
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 40;
+                                       floor_ptr->monster_level = floor_ptr->base_level + 40;
                                        place_monster(y, x, PM_ALLOW_SLEEP);
-                                       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
-                                       p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 20;
+                                       floor_ptr->monster_level = floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level + 20;
                                        place_object(y, x, AM_GOOD | AM_GREAT);
-                                       p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
+                                       floor_ptr->object_level = floor_ptr->base_level;
                                        break;
                                }
 
@@ -614,15 +614,15 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm
                                {
                                        if (randint0(100) < 50)
                                        {
-                                               p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 3;
+                                               floor_ptr->monster_level = floor_ptr->base_level + 3;
                                                place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
-                                               p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
+                                               floor_ptr->monster_level = floor_ptr->base_level;
                                        }
                                        if (randint0(100) < 50)
                                        {
-                                               p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 7;
+                                               floor_ptr->object_level = floor_ptr->base_level + 7;
                                                place_object(y, x, 0L);
-                                               p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
+                                               floor_ptr->object_level = floor_ptr->base_level;
                                        }
                                        break;
                                }
@@ -708,7 +708,7 @@ bool build_type7(void)
        msg_format_wizard(CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(p_ptr->current_floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
@@ -794,7 +794,7 @@ bool build_type8(void)
        msg_format_wizard(CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(p_ptr->current_floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
@@ -987,7 +987,7 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT
                c2 = (c1 + c3) / 2;
 
                /* make it */
-               generate_hmap(y0, x0, xsize, ysize, grd, roug, c3);
+               generate_hmap(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, grd, roug, c3);
 
                /* Convert to normal format+ clean up */
                done = generate_lake(y0, x0, xsize, ysize, c1, c2, c3, type);
@@ -1308,7 +1308,7 @@ bool build_type17(void)
        msg_format_wizard(CHEAT_DUNGEON, _("特殊固定部屋(%s)を生成しました。", "Special Fix room (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(p_ptr->current_floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
index 6180223..71627ab 100644 (file)
@@ -595,7 +595,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val)
  *    small values are good for smooth walls.
  *  size=length of the side of the square p_ptr->current_floor_ptr->grid_array system.
  */
-void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff)
+void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff)
 {
        POSITION xhsize, yhsize, xsize, ysize, maxsize;
 
@@ -654,20 +654,20 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                for (j = 0; j <= ysize; j++)
                {
                        /* -1 is a flag for "not done yet" */
-                       p_ptr->current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1;
-                       /* Clear icky flag because may be redoing the p_ptr->current_floor_ptr->grid_array */
-                       p_ptr->current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY);
+                       floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1;
+                       /* Clear icky flag because may be redoing the floor_ptr->grid_array */
+                       floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY);
                }
        }
 
        /* Boundaries are walls */
-       p_ptr->current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize;
-       p_ptr->current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize;
-       p_ptr->current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize;
-       p_ptr->current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize;
+       floor_ptr->grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize;
+       floor_ptr->grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize;
+       floor_ptr->grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize;
+       floor_ptr->grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize;
 
        /* Set the middle square to be an open area. */
-       p_ptr->current_floor_ptr->grid_array[y0][x0].feat = 0;
+       floor_ptr->grid_array[y0][x0].feat = 0;
 
        /* Initialize the step sizes */
        xstep = xhstep = xsize * 256;
@@ -704,7 +704,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                jj = j / 256 + fill_data.ymin;
 
                                /* Test square */
-                               if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1)
+                               if (floor_ptr->grid_array[jj][ii].feat == -1)
                                {
                                        if (xhstep2 > grd)
                                        {
@@ -715,8 +715,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                        {
                                                /* Average of left and right points +random bit */
                                                store_height(ii, jj,
-                                                       (p_ptr->current_floor_ptr->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat
-                                                        + p_ptr->current_floor_ptr->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2
+                                                       (floor_ptr->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat
+                                                        + floor_ptr->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2
                                                         + (randint1(xstep2) - xhstep2) * roug / 16);
                                        }
                                }
@@ -734,7 +734,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                jj = j / 256 + fill_data.ymin;
 
                                /* Test square */
-                               if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1)
+                               if (floor_ptr->grid_array[jj][ii].feat == -1)
                                {
                                        if (xhstep2 > grd)
                                        {
@@ -745,8 +745,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                        {
                                                /* Average of up and down points +random bit */
                                                store_height(ii, jj,
-                                                       (p_ptr->current_floor_ptr->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat
-                                                       + p_ptr->current_floor_ptr->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2
+                                                       (floor_ptr->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat
+                                                       + floor_ptr->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2
                                                        + (randint1(ystep2) - yhstep2) * roug / 16);
                                        }
                                }
@@ -763,7 +763,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                jj = j / 256 + fill_data.ymin;
 
                                /* Test square */
-                               if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1)
+                               if (floor_ptr->grid_array[jj][ii].feat == -1)
                                {
                                        if (xhstep2 > grd)
                                        {
@@ -783,8 +783,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
                                                 * reduce the effect of the square grid on the shape of the fractal
                                                 */
                                                store_height(ii, jj,
-                                                       (p_ptr->current_floor_ptr->grid_array[ym][xm].feat + p_ptr->current_floor_ptr->grid_array[yp][xm].feat
-                                                       + p_ptr->current_floor_ptr->grid_array[ym][xp].feat + p_ptr->current_floor_ptr->grid_array[yp][xp].feat) / 4
+                                                       (floor_ptr->grid_array[ym][xm].feat + floor_ptr->grid_array[yp][xm].feat
+                                                       + floor_ptr->grid_array[ym][xp].feat + floor_ptr->grid_array[yp][xp].feat) / 4
                                                        + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
                                        }
                                }
@@ -951,7 +951,7 @@ static void cave_fill(POSITION y, POSITION x)
 }
 
 
-bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room)
+bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room)
 {
        POSITION x, y, xhsize, yhsize;
        int i;
@@ -962,7 +962,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
 
 
        /*
-        * select region connected to center of p_ptr->current_floor_ptr->grid_array system
+        * select region connected to center of floor_ptr->grid_array system
         * this gets rid of alot of isolated one-sqaures that
         * can make teleport traps instadeaths...
         */
@@ -995,7 +995,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
                        for (y = 0; y <= ysize; ++y)
                        {
                                place_extra_bold(y0 + y - yhsize, x0 + x - xhsize);
-                               p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
+                               floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
                        }
                }
                return FALSE;
@@ -1009,12 +1009,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
        for (i = 0; i <= xsize; ++i)
        {
                /* top boundary */
-               if ((p_ptr->current_floor_ptr->grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room))
+               if ((floor_ptr->grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room))
                {
                        /* Next to a 'filled' region? - set to be room walls */
                        place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize);
-                       if (light) p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW);
-                       p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM);
+                       if (light) floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW);
+                       floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM);
                        place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize);
                }
                else
@@ -1024,12 +1024,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
                }
 
                /* bottom boundary */
-               if ((p_ptr->current_floor_ptr->grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room))
+               if ((floor_ptr->grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room))
                {
                        /* Next to a 'filled' region? - set to be room walls */
                        place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize);
-                       if (light) p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW);
-                       p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM);
+                       if (light) floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW);
+                       floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM);
                        place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize);
                }
                else
@@ -1039,20 +1039,20 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
                }
 
                /* clear the icky flag-don't need it any more */
-               p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY);
-               p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY);
+               floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY);
+               floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY);
        }
 
        /* Do the left and right boundaries minus the corners (done above) */
        for (i = 1; i < ysize; ++i)
        {
                /* left boundary */
-               if ((p_ptr->current_floor_ptr->grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room)
+               if ((floor_ptr->grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room)
                {
                        /* room boundary */
                        place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize);
-                       if (light) p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW);
-                       p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM);
+                       if (light) floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW);
+                       floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM);
                        place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize);
                }
                else
@@ -1061,12 +1061,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
                        place_extra_bold(y0 + i - yhsize, x0 + 0 - xhsize);
                }
                /* right boundary */
-               if ((p_ptr->current_floor_ptr->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room)
+               if ((floor_ptr->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room)
                {
                        /* room boundary */
                        place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize);
-                       if (light) p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW);
-                       p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM);
+                       if (light) floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW);
+                       floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM);
                        place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize);
                }
                else
@@ -1076,8 +1076,8 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
                }
 
                /* clear icky flag -done with it */
-               p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY);
-               p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY);
+               floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY);
+               floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY);
        }
 
 
@@ -1086,38 +1086,38 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
        {
                for (y = 1; y < ysize; ++y)
                {
-                       if (is_floor_bold(p_ptr->current_floor_ptr, y0 + y - yhsize, x0 + x - xhsize) &&
-                           (p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
+                       if (is_floor_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize) &&
+                           (floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
                        {
                                /* Clear the icky flag in the filled region */
-                               p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY;
+                               floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY;
 
                                /* Set appropriate flags */
-                               if (light) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW);
-                               if (room) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM);
+                               if (light) floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW);
+                               if (room) floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM);
                        }
-                       else if (is_outer_bold(p_ptr->current_floor_ptr, y0 + y - yhsize, x0 + x - xhsize) &&
-                                (p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
+                       else if (is_outer_bold(floor_ptr, y0 + y - yhsize, x0 + x - xhsize) &&
+                                (floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
                        {
                                /* Walls */
-                               p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY);
-                               if (light) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW);
+                               floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY);
+                               if (light) floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW);
                                if (room)
                                {
-                                       p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM);
+                                       floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM);
                                }
                                else
                                {
 
                                        place_extra_bold(y0 + y - yhsize, x0 + x - xhsize);
-                                       p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM);
+                                       floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM);
                                }
                        }
                        else
                        {
                                /* Clear the unconnected regions */
                                place_extra_bold(y0 + y - yhsize, x0 + x - xhsize);
-                               p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
+                               floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
                        }
                }
        }
@@ -1171,10 +1171,10 @@ void build_cavern(void)
                cutoff = xsize / 2;
 
                 /* make it */
-               generate_hmap(y0 + 1, x0 + 1, xsize, ysize, grd, roug, cutoff);
+               generate_hmap(p_ptr->current_floor_ptr, y0 + 1, x0 + 1, xsize, ysize, grd, roug, cutoff);
 
                /* Convert to normal format+ clean up */
-               done = generate_fracave(y0 + 1, x0 + 1, xsize, ysize, cutoff, light, FALSE);
+               done = generate_fracave(p_ptr->current_floor_ptr, y0 + 1, x0 + 1, xsize, ysize, cutoff, light, FALSE);
        }
 }
 
@@ -1366,7 +1366,7 @@ void build_lake(int type)
                c2 = (c1 + c3) / 2;
 
                /* make it */
-               generate_hmap(y0 + 1, x0 + 1, xsize, ysize, grd, roug, c3);
+               generate_hmap(p_ptr->current_floor_ptr, y0 + 1, x0 + 1, xsize, ysize, grd, roug, c3);
 
                /* Convert to normal format+ clean up */
                done = generate_lake(y0 + 1, x0 + 1, xsize, ysize, c1, c2, c3, type);
index e658d1b..71925a1 100644 (file)
@@ -96,8 +96,8 @@ extern void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSIT
 extern POSITION dist2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION h1, POSITION h2, POSITION h3, POSITION h4);
 extern void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int light);
 extern void generate_fill_perm_bold(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
-extern void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff);
-extern bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room);
+extern void generate_hmap(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff);
+extern bool generate_fracave(floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room);
 extern void fill_treasure(floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty);
 extern bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int c1, int c2, int c3, int type);
 extern void build_recursive_room(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int power);