* Note that some files have their own header files
* (z-virt.h, z-util.h, z-form.h, term.h, random.h)
*/
-
+#include "geometry.h"
/*
* Automatically generated "variable" declarations
extern char player_base[32];
extern char savefile[1024];
extern char savefile_base[40];
-extern POSITION_IDX temp_n;
-extern POSITION temp_y[TEMP_MAX];
-extern POSITION temp_x[TEMP_MAX];
+extern pos_list tmp_pos;
extern s16b macro__num;
extern concptr *macro__pat;
extern concptr *macro__act;
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)
}
/* 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;
/*** Start Grid ***/
/* Enqueue that entry */
- temp_y[0] = y;
- temp_x[0] = x;
+ tmp_pos.y[0] = y;
+ tmp_pos.x[0] = x;
/* Now process the queue */
while (flow_head != flow_tail)
{
/* Extract the next entry */
- ty = temp_y[flow_head];
- tx = temp_x[flow_head];
+ ty = tmp_pos.y[flow_head];
+ tx = tmp_pos.x[flow_head];
/* Forget that entry */
if (++flow_head == TEMP_MAX) flow_head = 0;
fill_data.info1, fill_data.info2, fill_data.info3))
{
/* Enqueue that entry */
- temp_y[flow_tail] = (byte_hack)j;
- temp_x[flow_tail] = (byte_hack)i;
+ tmp_pos.y[flow_tail] = (byte_hack)j;
+ tmp_pos.x[flow_tail] = (byte_hack)i;
/* Advance the queue */
if (++flow_tail == TEMP_MAX) flow_tail = 0;
int i;
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- POSITION y = temp_y[i];
- POSITION x = temp_x[i];
+ POSITION y = tmp_pos.y[i];
+ POSITION x = tmp_pos.x[i];
grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
}
int i;
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- POSITION y = temp_y[i];
- POSITION x = temp_x[i];
+ POSITION y = tmp_pos.y[i];
+ POSITION x = tmp_pos.x[i];
int j;
grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
}
/*!
- * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 部屋内のy座標1点
* @param x 部屋内のx座標1点
* @param only_room 部屋内地形のみをチェック対象にするならば TRUE
}
/* Paranoia -- verify space */
- if (temp_n == TEMP_MAX) return;
+ if (tmp_pos.n == TEMP_MAX) return;
/* Mark the grid as "seen" */
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++;
}
/*!
}
/*!
- * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 指定Y座標
* @param x 指定X座標
* @return なし
/*!
- * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 指定Y座標
* @param x 指定X座標
* @return なし
cave_temp_lite_room_aux(y1, x1);
/* While grids are in the queue, add their neighbors */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- x = temp_x[i], y = temp_y[i];
+ x = tmp_pos.x[i], y = tmp_pos.y[i];
/* Walls get lit, but stop light */
if (!cave_pass_lite_bold(y, x)) continue;
cave_temp_unlite_room_aux(y1, x1);
/* Spread, breadth first */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- x = temp_x[i], y = temp_y[i];
+ x = tmp_pos.x[i], y = tmp_pos.y[i];
/* Walls get dark, but stop darkness */
if (!cave_pass_dark_bold(y, x)) continue;
*/
#include "angband.h"
+#include "geometry.h"
/*!
* コピーライト情報 /
char savefile[1024];
char savefile_base[40];
-POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "current_floor_ptr->grid_array.c")
-POSITION temp_y[TEMP_MAX];
-POSITION temp_x[TEMP_MAX];
+
+pos_list tmp_pos;
/*
int n_same = 0;
int i;
- for(i=0;i<temp_n;i++){
- grid_type* g_ptr = ¤t_floor_ptr->grid_array[temp_y[i]][temp_x[i]];
+ for(i=0;i<tmp_pos.n;i++){
+ grid_type* g_ptr = ¤t_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
if(is_pet(m_ptr))continue;//pet
break;
}
}
- if(line-y-1==max_lines && i!=temp_n){
+ if(line-y-1==max_lines && i!=tmp_pos.n){
Term_gotoxy(x, line);
Term_addstr(-1, TERM_WHITE, "-- and more --");
}else{
/* Scan the locations */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
/* Point 2 */
- x2 = temp_x[i];
- y2 = temp_y[i];
+ x2 = tmp_pos.x[i];
+ y2 = tmp_pos.y[i];
/* Directed distance */
x3 = (x2 - x1);
}
/* Reset "temp" array */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Scan the current panel */
for (y = min_hgt; y <= max_hgt; y++)
if ((mode & (TARGET_KILL)) && !target_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx])) continue;
/* Save the location */
- 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++;
}
}
}
/* Sort the positions */
- ang_sort(temp_x, temp_y, temp_n);
+ ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
- if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
+ if (p_ptr->riding && target_pet && (tmp_pos.n > 1) && (mode & (TARGET_KILL)))
{
POSITION tmp;
- tmp = temp_y[0];
- temp_y[0] = temp_y[1];
- temp_y[1] = tmp;
- tmp = temp_x[0];
- temp_x[0] = temp_x[1];
- temp_x[1] = tmp;
+ tmp = tmp_pos.y[0];
+ tmp_pos.y[0] = tmp_pos.y[1];
+ tmp_pos.y[1] = tmp;
+ tmp = tmp_pos.x[0];
+ tmp_pos.x[0] = tmp_pos.x[1];
+ tmp_pos.x[1] = tmp;
}
}
while (!done)
{
/* Interesting grids */
- if (flag && temp_n)
+ if (flag && tmp_pos.n)
{
- y = temp_y[m];
- x = temp_x[m];
+ y = tmp_pos.y[m];
+ x = tmp_pos.x[m];
/* Set forcus */
change_panel_xy(y, x);
case '*':
case '+':
{
- if (++m == temp_n)
+ if (++m == tmp_pos.n)
{
m = 0;
if (!expand_list) done = TRUE;
{
if (m-- == 0)
{
- m = temp_n - 1;
+ m = tmp_pos.n - 1;
if (!expand_list) done = TRUE;
}
break;
{
if(query == same_key)
{
- if (++m == temp_n)
+ if (++m == tmp_pos.n)
{
m = 0;
if (!expand_list) done = TRUE;
POSITION x2 = panel_col_min;
/* Find a new monster */
- i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
+ i = target_pick(tmp_pos.y[m], tmp_pos.x[m], ddy[d], ddx[d]);
/* Request to target past last interesting grid */
while (flag && (i < 0))
/* Note the change */
if (change_panel(ddy[d], ddx[d]))
{
- int v = temp_y[m];
- int u = temp_x[m];
+ int v = tmp_pos.y[m];
+ int u = tmp_pos.x[m];
/* Recalculate interesting grids */
target_set_prepare(mode);
bd = 999;
/* Pick a nearby monster */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- t = distance(y, x, temp_y[i], temp_x[i]);
+ t = distance(y, x, tmp_pos.y[i], tmp_pos.x[i]);
/* Pick closest */
if (t < bd)
}
/* Forget */
- temp_n = 0;
+ tmp_pos.n = 0;
/* Clear the top line */
prt("", 0, 0);
POSITION y, x;
/* Reset "temp" array */
- temp_n = 0;
+ tmp_pos.n = 0;
if (!expand_list) return;
if (!tgt_pt_accept(y, x)) continue;
/* Save the location */
- 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++;
}
}
ang_sort_swap = ang_sort_swap_distance;
/* Sort the positions */
- ang_sort(temp_x, temp_y, temp_n);
+ ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
}
/*
/* XAngband: Move cursor to stairs */
case '>':
case '<':
- if (expand_list && temp_n)
+ if (expand_list && tmp_pos.n)
{
int dx, dy;
int cx = (panel_col_min + panel_col_max) / 2;
n++;
/* Skip stairs which have defferent distance */
- for (; n < temp_n; ++ n)
+ for (; n < tmp_pos.n; ++ n)
{
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[temp_y[n]][temp_x[n]];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]];
if (cave_have_flag_grid(g_ptr, FF_STAIRS) &&
cave_have_flag_grid(g_ptr, ch == '>' ? FF_MORE : FF_LESS))
}
}
- if (n == temp_n) /* Loop out taget list */
+ if (n == tmp_pos.n) /* Loop out taget list */
{
n = 0;
y = p_ptr->y;
}
else /* move cursor to next stair and change panel */
{
- y = temp_y[n];
- x = temp_x[n];
+ y = tmp_pos.y[n];
+ x = tmp_pos.x[n];
dy = 2 * (y - cy) / hgt;
dx = 2 * (x - cx) / wid;