for (i = 0; i < 2; i++)
{
s32b tmp = randint0(60*60*60);
- int val;
+ base_status val;
/* Extract 5 + 1d3 + 1d4 + 1d5 */
val = 5 + 3;
/* Save that value */
sum += val;
- p_ptr->stat_cur[3*i] = p_ptr->stat_max[3*i] = (s16b)val;
+ p_ptr->stat_cur[3*i] = p_ptr->stat_max[3*i] = val;
/* Extract 5 + 1d3 + 1d4 + 1d5 */
val = 5 + 3;
/* Save that value */
sum += val;
- p_ptr->stat_cur[3*i+1] = p_ptr->stat_max[3*i+1] = (s16b)val;
+ p_ptr->stat_cur[3*i+1] = p_ptr->stat_max[3*i+1] = val;
/* Extract 5 + 1d3 + 1d4 + 1d5 */
val = 5 + 3;
/* Save that value */
sum += val;
- p_ptr->stat_cur[3*i+2] = p_ptr->stat_max[3*i+2] = (s16b)val;
+ p_ptr->stat_cur[3*i+2] = p_ptr->stat_max[3*i+2] = val;
}
/* Verify totals */
/* Acquire the stats */
for (i = 0; i < 6; i++)
{
- j = 18 + 60 + dice[i]*10;
+ base_status max_max = 18 + 60 + dice[i]*10;
/* Save that value */
- p_ptr->stat_max_max[i] = (s16b)j;
- if (p_ptr->stat_max[i] > j)
- p_ptr->stat_max[i] = (s16b)j;
- if (p_ptr->stat_cur[i] > j)
- p_ptr->stat_cur[i] = (s16b)j;
+ p_ptr->stat_max_max[i] = max_max;
+ if (p_ptr->stat_max[i] > max_max)
+ p_ptr->stat_max[i] = max_max;
+ if (p_ptr->stat_cur[i] > max_max)
+ p_ptr->stat_cur[i] = max_max;
}
p_ptr->knowledge &= ~(KNOW_STAT);
typedef int sint; /*!< sint型をintとして定義 / A signed, standard integer (at least 2 bytes) */
typedef unsigned int uint; /* uint型をintとして定義 / An unsigned, "standard" integer (often pre-defined) */
+
/* The largest possible signed integer (pre-defined) */
/* typedef long long; */
#endif
+typedef byte position; /*!< ゲーム中の座標型を定義 */
+typedef s16b hit_point; /*!< ゲーム中のHP/ダメージ型を定義 */
+typedef s16b base_status; /*!< ゲーム中の基礎能力値型を定義 */
+
/*** Pointers to all the basic types defined above ***/
}
/* Hurt it */
- m_ptr->hp -= dam;
+ m_ptr->hp -= (s16b)dam;
/* It is dead now... or is it? */
if (m_ptr->hp < 0)
* Note that this function is responsible for about one to five percent\n
* of the processor use in normal conditions...\n
*/
-static int mon_will_run(int m_idx)
+static bool mon_will_run(int m_idx)
{
monster_type *m_ptr = &m_list[m_idx];
if (m_lev + 4 <= p_lev) return (TRUE);
/* Examine player health */
- p_chp = p_ptr->chp;
- p_mhp = p_ptr->mhp;
+ p_chp = (u16b)p_ptr->chp;
+ p_mhp = (u16b)p_ptr->mhp;
/* Examine monster health */
m_chp = m_ptr->hp;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
- int i, d, oy, ox, ny, nx;
+ int i, d;
+ position oy, ox, ny, nx;
int mm[8];
(void)get_moves(m_idx, mm);
/* Restore the leash */
- p_ptr->pet_follow_distance = dis;
+ p_ptr->pet_follow_distance = (s16b)dis;
}
}
}
}
/* Hack -- Update the new location */
- c_ptr->m_idx = m_idx;
+ c_ptr->m_idx = (s16b)m_idx;
/* Move the monster */
m_ptr->fy = ny;
o_ptr->iy = o_ptr->ix = 0;
/* Memorize monster */
- o_ptr->held_m_idx = m_idx;
+ o_ptr->held_m_idx = (s16b)m_idx;
/* Build a stack */
o_ptr->next_o_idx = m_ptr->hold_o_idx;
/* Save global index */
- hack_m_idx = i;
+ hack_m_idx = (s16b)i;
/* Process the monster */
process_monster(i);
*/
static void mproc_add(int m_idx, int mproc_type)
{
- if (mproc_max[mproc_type] < max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = m_idx;
+ if (mproc_max[mproc_type] < max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx;
}
}
/* Use the value */
- m_ptr->mtimed[MTIMED_CSLEEP] = v;
+ m_ptr->mtimed[MTIMED_CSLEEP] = (s16b)v;
if (!notice) return FALSE;
}
/* Use the value */
- m_ptr->mtimed[MTIMED_FAST] = v;
+ m_ptr->mtimed[MTIMED_FAST] = (s16b)v;
if (!notice) return FALSE;
}
/* Use the value */
- m_ptr->mtimed[MTIMED_SLOW] = v;
+ m_ptr->mtimed[MTIMED_SLOW] = (s16b)v;
if (!notice) return FALSE;
}
/* Use the value */
- m_ptr->mtimed[MTIMED_STUNNED] = v;
+ m_ptr->mtimed[MTIMED_STUNNED] = (s16b)v;
return notice;
}
}
/* Use the value */
- m_ptr->mtimed[MTIMED_CONFUSED] = v;
+ m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)v;
return notice;
}
}
/* Use the value */
- m_ptr->mtimed[MTIMED_MONFEAR] = v;
+ m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)v;
if (!notice) return FALSE;
}
/* Use the value */
- m_ptr->mtimed[MTIMED_INVULNER] = v;
+ m_ptr->mtimed[MTIMED_INVULNER] = (s16b)v;
if (!notice) return FALSE;
ask = isupper(choice);
/* Lowercase */
- if (ask) choice = tolower(choice);
+ if (ask) choice = (char)tolower(choice);
/* Extract request */
i = (islower(choice) ? A2I(choice) : -1);
{
msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
cave[oy][ox].m_idx = 0;
- cave[ty][tx].m_idx = m_idx;
- m_ptr->fy = ty;
- m_ptr->fx = tx;
+ cave[ty][tx].m_idx = (s16b)m_idx;
+ m_ptr->fy = (byte_hack)ty;
+ m_ptr->fx = (byte_hack)tx;
update_mon(m_idx, TRUE);
lite_spot(oy, ox);
cave[target_row][target_col].m_idx = 0;
/* Update the new location */
- cave[ty][tx].m_idx = m_idx;
+ cave[ty][tx].m_idx = (s16b)m_idx;
/* Move the monster */
- m_ptr->fy = ty;
- m_ptr->fx = tx;
+ m_ptr->fy = (byte_hack)ty;
+ m_ptr->fx = (byte_hack)tx;
/* Wake the monster up */
(void)set_monster_csleep(m_idx, 0);
if (ironman_nightmare)
{
u32b hp = m_ptr->max_maxhp * 2L;
- m_ptr->max_maxhp = (s16b)MIN(30000, hp);
+ m_ptr->max_maxhp = (hit_point)MIN(30000, hp);
}
m_ptr->maxhp = (long)(m_ptr->maxhp * m_ptr->max_maxhp) / oldmaxhp;
{
u32b hp = m_ptr->max_maxhp * 2L;
- m_ptr->max_maxhp = (s16b)MIN(30000, hp);
+ m_ptr->max_maxhp = (hit_point)MIN(30000, hp);
}
m_ptr->maxhp = m_ptr->max_maxhp;
s16b ap_r_idx; /* Monster race appearance index */
byte sub_align; /* Sub-alignment for a neutral monster */
- byte fy; /* Y location on map */
- byte fx; /* X location on map */
+ position fy; /* Y location on map */
+ position fx; /* X location on map */
- s16b hp; /* Current Hit points */
- s16b maxhp; /* Max Hit points */
- s16b max_maxhp; /* Max Max Hit points */
+ hit_point hp; /* Current Hit points */
+ hit_point maxhp; /* Max Hit points */
+ hit_point max_maxhp; /* Max Max Hit points */
u32b dealt_damage; /* Sum of damages dealt by player */
s16b mtimed[MAX_MTIMED]; /* Timed status counter */
s16b max_plv; /* Max Player Level */
- s16b stat_max[6]; /* Current "maximal" stat values */
- s16b stat_max_max[6]; /* Maximal "maximal" stat values */
- s16b stat_cur[6]; /* Current "natural" stat values */
+ base_status stat_max[6]; /* Current "maximal" stat values */
+ base_status stat_max_max[6]; /* Maximal "maximal" stat values */
+ base_status stat_cur[6]; /* Current "natural" stat values */
s16b learned_spells;
s16b add_spells;