#include "grid/feature.h"
#include "grid/grid.h"
#include "system/floor-type-definition.h"
+#include "system/grid-type-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/player-type-definition.h"
#include "target/projection-path-calculator.h"
#include "util/bit-flags-calculator.h"
if (!dy || !dx)
return d;
- while (TRUE) {
+ while (true) {
/* Approximate error */
err = (target - d * d) / (2 * d);
* @param x 方角を確認したX座標
* @return 方向ID
*/
-DIRECTION coords_to_dir(player_type *creature_ptr, POSITION y, POSITION x)
+DIRECTION coords_to_dir(PlayerType *player_ptr, POSITION y, POSITION x)
{
DIRECTION d[3][3] = { { 7, 4, 1 }, { 8, 5, 2 }, { 9, 6, 3 } };
POSITION dy, dx;
- dy = y - creature_ptr->y;
- dx = x - creature_ptr->x;
- if (ABS(dx) > 1 || ABS(dy) > 1)
+ dy = y - player_ptr->y;
+ dx = x - player_ptr->x;
+ if (std::abs(dx) > 1 || std::abs(dy) > 1)
return 0;
return d[dx + 1][dy + 1];
* "glowing" grid. This prevents the player from being able to "see" the\n
* walls of illuminated rooms from a corridor outside the room.\n
*/
-bool player_can_see_bold(player_type *creature_ptr, POSITION y, POSITION x)
+bool player_can_see_bold(PlayerType *player_ptr, POSITION y, POSITION x)
{
grid_type *g_ptr;
/* Blind players see nothing */
- if (creature_ptr->blind)
- return FALSE;
+ if (player_ptr->blind)
+ return false;
- g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
+ g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
/* Note that "torch-lite" yields "illumination" */
if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
- return TRUE;
+ return true;
/* Require line of sight to the grid */
- if (!player_has_los_bold(creature_ptr, y, x))
- return FALSE;
+ if (!player_has_los_bold(player_ptr, y, x))
+ return false;
/* Noctovision of Ninja */
- if (creature_ptr->see_nocto)
- return TRUE;
+ if (player_ptr->see_nocto)
+ return true;
/* Require "perma-lite" of the grid */
if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
- return FALSE;
+ return false;
/* Feature code (applying "mimic" field) */
/* Floors are simple */
- if (feat_supports_los(get_feat_mimic(g_ptr)))
- return TRUE;
+ if (feat_supports_los(g_ptr->get_feat_mimic()))
+ return true;
/* Check for "local" illumination */
- return check_local_illumination(creature_ptr, y, x);
+ return check_local_illumination(player_ptr, y, x);
}
/*
}
}
-/*
- * todo is_seen() の関数マクロをバラそうとしたがインクルード関係のコンパイルエラーで失敗
- * Is the monster seen by the player?
- * @param creature_ptr プレーヤーへの参照ポインタ
+/*!
+ * @brief Is the monster seen by the player?
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param m_ptr 個々のモンスターへの参照ポインタ
- * @return 個々のモンスターがプレーヤーが見えたらTRUE
+ * @return 個々のモンスターがプレイヤーが見えたらTRUE
+ * @todo is_seen() の関数マクロをバラそうとしたがインクルード関係のコンパイルエラーで失敗
*/
-bool is_seen(player_type *creature_ptr, monster_type *m_ptr)
+bool is_seen(PlayerType *player_ptr, monster_type *m_ptr)
{
bool is_inside_view = !ignore_unview;
- is_inside_view |= creature_ptr->phase_out;
+ is_inside_view |= player_ptr->phase_out;
is_inside_view
- |= player_can_see_bold(creature_ptr, m_ptr->fy, m_ptr->fx) && projectable(creature_ptr, creature_ptr->y, creature_ptr->x, m_ptr->fy, m_ptr->fx);
+ |= player_can_see_bold(player_ptr, m_ptr->fy, m_ptr->fx) && projectable(player_ptr, player_ptr->y, player_ptr->x, m_ptr->fy, m_ptr->fx);
return m_ptr->ml && is_inside_view;
}