#include "monster.h"
#include "quest.h"
#include "feature.h"
+#include "monster-status.h"
static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
static int match_autopick;
*/
void forget_lite(void)
{
- int i, x, y;
+ int i;
+ POSITION x, y;
/* None to forget */
if (!current_floor_ptr->lite_n) return;
{
int i;
POSITION x, y, min_x, max_x, min_y, max_y;
- int p = p_ptr->cur_lite;
+ POSITION p = p_ptr->cur_lite;
grid_type *g_ptr;
/*** Special case ***/
current_floor_ptr->grid_array[y][x].info |= (CAVE_TEMP);
/* Add it to the "seen" set */
- temp_y[temp_n] = y;
- temp_x[temp_n] = x;
- temp_n++;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.n++;
}
/* None left */
}
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- y = temp_y[i];
- x = temp_x[i];
+ y = tmp_pos.y[i];
+ x = tmp_pos.x[i];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
}
}
- /* We trust temp_n does not exceed TEMP_MAX */
+ /* We trust tmp_pos.n does not exceed TEMP_MAX */
/* New grid */
if (!(g_ptr->info & CAVE_MNDK))
{
/* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.n++;
}
/* Darkened grid */
}
}
- /* We trust temp_n does not exceed TEMP_MAX */
+ /* We trust tmp_pos.n does not exceed TEMP_MAX */
/* Save this square */
- temp_x[temp_n] = x;
- temp_y[temp_n] = y;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.n++;
/* Darken it */
g_ptr->info |= CAVE_MNDK;
}
/* Empty temp list of new squares to lite up */
- temp_n = 0;
+ tmp_pos.n = 0;
/* If a monster stops time, don't process */
if (!current_world_ptr->timewalk_m_idx)
{
m_ptr = ¤t_floor_ptr->m_list[i];
r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Is it too far away? */
if (m_ptr->cdis > dis_lim) continue;
}
/* Save end of list of new squares */
- end_temp = temp_n;
+ end_temp = tmp_pos.n;
/*
* Look at old set flags to see if there are any changes.
}
/* Add to end of temp array */
- temp_x[temp_n] = fx;
- temp_y[temp_n] = fy;
- temp_n++;
+ tmp_pos.x[tmp_pos.n] = fx;
+ tmp_pos.y[tmp_pos.n] = fy;
+ tmp_pos.n++;
}
/* Clear the lite array */
/* Copy the temp array into the lit array lighting the new squares. */
for (i = 0; i < end_temp; i++)
{
- fx = temp_x[i];
- fy = temp_y[i];
+ fx = tmp_pos.x[i];
+ fy = tmp_pos.y[i];
/* We trust this grid is in bounds */
}
/* Clear the temp flag for the old lit or darken grids */
- for (i = end_temp; i < temp_n; i++)
+ for (i = end_temp; i < tmp_pos.n; i++)
{
/* We trust this grid is in bounds */
- current_floor_ptr->grid_array[temp_y[i]][temp_x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
+ current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
}
- /* Finished with temp_n */
- temp_n = 0;
+ /* Finished with tmp_pos.n */
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
g_ptr->info |= (CAVE_TEMP);
/* Add it to the "seen" set */
- temp_y[temp_n] = y;
- temp_x[temp_n] = x;
- temp_n++;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.n++;
}
/* Start over with the "view" array */
}
/* Wipe the old grids, update as needed */
- for (n = 0; n < temp_n; n++)
+ for (n = 0; n < tmp_pos.n; n++)
{
- y = temp_y[n];
- x = temp_x[n];
+ y = tmp_pos.y[n];
+ x = tmp_pos.x[n];
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* No longer in the array */
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Mega-Hack -- Visual update later */
p_ptr->update |= (PU_DELAY_VIS);
int flow_tail = 0;
/* Paranoia -- make sure the array is empty */
- if (temp_n) return;
+ if (tmp_pos.n) return;
/* The last way-point is on the map */
if (running && in_bounds(flow_y, flow_x))
flow_x = p_ptr->x;
/* Add the player's grid to the queue */
- temp_y[0] = p_ptr->y;
- temp_x[0] = p_ptr->x;
+ tmp_pos.y[0] = p_ptr->y;
+ tmp_pos.x[0] = p_ptr->x;
/* Now process the queue */
while (flow_head != flow_tail)
int ty, tx;
/* Extract the next entry */
- ty = temp_y[flow_tail];
- tx = temp_x[flow_tail];
+ ty = tmp_pos.y[flow_tail];
+ tx = tmp_pos.x[flow_tail];
/* Forget that entry */
if (++flow_tail == TEMP_MAX) flow_tail = 0;
if (n == MONSTER_FLOW_DEPTH) continue;
/* Enqueue that entry */
- temp_y[flow_head] = y;
- temp_x[flow_head] = x;
+ tmp_pos.y[flow_head] = y;
+ tmp_pos.x[flow_head] = x;
/* Advance the queue */
if (++flow_head == TEMP_MAX) flow_head = 0;