return false;
if (act_ptr->timeout.constant >= 0) {
- o_ptr->timeout = (s16b)act_ptr->timeout.constant;
+ o_ptr->timeout = (int16_t)act_ptr->timeout.constant;
if (act_ptr->timeout.dice > 0)
o_ptr->timeout += randint1(act_ptr->timeout.dice);
if (!has_flag(f_info[old_feat].flags, FF_CLOSE))
return more;
- s16b closed_feat = feat_state(creature_ptr->current_floor_ptr, old_feat, FF_CLOSE);
+ int16_t closed_feat = feat_state(creature_ptr->current_floor_ptr, old_feat, FF_CLOSE);
if ((!g_ptr->o_idx_list.empty() || g_ptr->is_object()) && (closed_feat != old_feat) && !has_flag(f_info[closed_feat].flags, FF_DROP)) {
msg_print(_("何かがつっかえて閉まらない。", "Something prevents it from closing."));
return more;
if (!g_ptr->is_mark())
return false;
- s16b feat = g_ptr->get_feat_mimic();
+ int16_t feat = g_ptr->get_feat_mimic();
feature_type *f_ptr = &f_info[feat];
if (!player_can_enter(creature_ptr, feat, 0))
return !has_flag(f_ptr->flags, FF_DOOR);
}
}
- creature_ptr->vir_types[which] = (s16b)type;
+ creature_ptr->vir_types[which] = (int16_t)type;
}
/*!
void initialize_virtues(player_type *creature_ptr)
{
int i = 0, j = 0;
- s16b tmp_vir;
+ int16_t tmp_vir;
/* Reset */
for (i = 0; i < 8; i++) {
{
for (int i = 0; i < 8; i++)
if (creature_ptr->vir_types[i] == virtue_id) {
- creature_ptr->virtues[i] = (s16b)amount;
+ creature_ptr->virtues[i] = (int16_t)amount;
return;
}
}
#include "util/int-char-converter.h"
/*! オートローラの能力値的要求水準 / Autoroll limit */
-s16b stat_limit[6];
+int16_t stat_limit[6];
/*! オートローラの試行回数 / Autoroll round */
s32b auto_round;
}
for (int i = 0; i < A_MAX; i++)
- stat_limit[i] = (s16b)cval[i];
+ stat_limit[i] = (int16_t)cval[i];
return true;
}
break;
}
- chara_limit_ptr->agemin = (s16b)cval[0];
- chara_limit_ptr->agemax = (s16b)cval[1];
- chara_limit_ptr->htmin = (s16b)cval[2];
- chara_limit_ptr->htmax = (s16b)cval[3];
- chara_limit_ptr->wtmin = (s16b)cval[4];
- chara_limit_ptr->wtmax = (s16b)cval[5];
- chara_limit_ptr->scmin = (s16b)cval[6];
- chara_limit_ptr->scmax = (s16b)cval[7];
+ chara_limit_ptr->agemin = (int16_t)cval[0];
+ chara_limit_ptr->agemax = (int16_t)cval[1];
+ chara_limit_ptr->htmin = (int16_t)cval[2];
+ chara_limit_ptr->htmax = (int16_t)cval[3];
+ chara_limit_ptr->wtmin = (int16_t)cval[4];
+ chara_limit_ptr->wtmax = (int16_t)cval[5];
+ chara_limit_ptr->scmin = (int16_t)cval[6];
+ chara_limit_ptr->scmax = (int16_t)cval[7];
return true;
}
/*! オートローラの年齢、身長、体重、社会的地位の要求水準 */
typedef struct {
- s16b agemin, agemax;
- s16b htmin, htmax;
- s16b wtmin, wtmax;
- s16b scmin, scmax;
+ int16_t agemin, agemax;
+ int16_t htmin, htmax;
+ int16_t wtmin, wtmax;
+ int16_t scmin, scmax;
} chara_limit_type;
-extern s16b stat_limit[6];
+extern int16_t stat_limit[6];
extern s32b auto_round;
extern s32b auto_upper_round;
extern s32b autoroll_chance;
static void display_initial_options(player_type *creature_ptr)
{
u16b expfact = get_expfact(creature_ptr) - 100;
- s16b adj[A_MAX];
+ int16_t adj[A_MAX];
for (int i = 0; i < A_MAX; i++) {
adj[i] = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
}
get_extra(creature_ptr, true);
get_money(creature_ptr);
- creature_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
+ creature_ptr->chaos_patron = (int16_t)randint0(MAX_PATRON);
char c;
if (!display_auto_roller_result(creature_ptr, prev, &c))
else if (social_class < 1)
social_class = 1;
- creature_ptr->sc = (s16b)social_class;
+ creature_ptr->sc = (int16_t)social_class;
}
/*!
{
object_aware(creature_ptr, o_ptr);
object_known(o_ptr);
- s16b slot = store_item_to_inventory(creature_ptr, o_ptr);
+ int16_t slot = store_item_to_inventory(creature_ptr, o_ptr);
autopick_alter_item(creature_ptr, slot, false);
wield_all(creature_ptr);
}
REALM_IDX realm1{}; /* First magic realm */
REALM_IDX realm2{}; /* Second magic realm */
- s16b age{};
- s16b ht{};
- s16b wt{};
- s16b sc{};
+ int16_t age{};
+ int16_t ht{};
+ int16_t wt{};
+ int16_t sc{};
PRICE au{}; /*!< 初期の所持金 */
PATRON_IDX chaos_patron{};
- s16b vir_types[8]{};
+ int16_t vir_types[8]{};
char history[4][60]{};
msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
HIT_POINT k = damroll(dice_num, dice_side);
- k = critical_norm(attacker_ptr, n_weight, bonus, k, (s16b)bonus, HISSATSU_NONE);
+ k = critical_norm(attacker_ptr, n_weight, bonus, k, (int16_t)bonus, HISSATSU_NONE);
k += attacker_ptr->to_d_m;
if (k < 0)
k = 0;
break;
}
if (any_bits(mp_ptr->spell_xtra, extra_magic_gain_exp)) {
- s16b cur_exp = caster_ptr->spell_exp[(increment ? 32 : 0) + spell];
- s16b exp_gain = 0;
+ int16_t cur_exp = caster_ptr->spell_exp[(increment ? 32 : 0) + spell];
+ int16_t exp_gain = 0;
if (cur_exp < SPELL_EXP_BEGINNER)
exp_gain += 60;
* @param current 現在のセーブ頻度ターン値
* @return 次のセーブ頻度ターン値
*/
-static s16b toggle_frequency(s16b current)
+static int16_t toggle_frequency(int16_t current)
{
switch (current) {
case 0:
concptr *macro__act;
/* Number of active macros */
-s16b macro__num;
+int16_t macro__num;
/* Expand macros in "get_com" or not */
bool get_com_no_macros = false;
extern concptr *macro__pat;
extern concptr *macro__act;
-extern s16b macro__num;
+extern int16_t macro__num;
int macro_find_exact(concptr pat);
int macro_find_check(concptr pat);
col = TERM_RED;
} else {
strcat(dummy,
- format(" %-22.22s %2d/%2d %3d%%", k_info[k_idx].name.c_str(), (s16b)(creature_ptr->magic_num1[ctr + ext] / EATER_CHARGE),
+ format(" %-22.22s %2d/%2d %3d%%", k_info[k_idx].name.c_str(), (int16_t)(creature_ptr->magic_num1[ctr + ext] / EATER_CHARGE),
creature_ptr->magic_num2[ctr + ext], chance));
if (creature_ptr->magic_num1[ctr + ext] < EATER_CHARGE)
col = TERM_RED;
* @param mode オプションフラグ
* @return クリティカル修正が入ったダメージ値
*/
-HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, combat_options mode, bool impact)
+HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, int16_t meichuu, combat_options mode, bool impact)
{
/* Extract "blow" power */
int i = (weight + (meichuu * 3 + plus * 5) + attacker_ptr->skill_thn);
typedef struct player_attack_type player_attack_type;
typedef struct player_type player_type;
std::tuple<HIT_POINT, concptr, sound_type> apply_critical_norm_damage(int k, HIT_POINT base_dam);
-HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, combat_options mode, bool impact = false);
+HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, int16_t meichuu, combat_options mode, bool impact = false);
int calc_monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam);
void critical_attack(player_type *attacker_ptr, player_attack_type *pa_ptr);
* @param impact 強撃かどうか
* @return ダメージ期待値
*/
-HIT_POINT calc_expect_crit(player_type *shooter_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari, bool impact)
+HIT_POINT calc_expect_crit(player_type *shooter_ptr, WEIGHT weight, int plus, HIT_POINT dam, int16_t meichuu, bool dokubari, bool impact)
{
if (dokubari)
return dam;
int bow_tmul(OBJECT_SUBTYPE_VALUE sval);
HIT_POINT calc_crit_ratio_shot(player_type *shooter_ptr, HIT_POINT plus_ammo, HIT_POINT plus_bow);
HIT_POINT calc_expect_crit_shot(player_type *shooter_ptr, WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam);
-HIT_POINT calc_expect_crit(player_type *shooter_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari, bool impact);
+HIT_POINT calc_expect_crit(player_type *shooter_ptr, WEIGHT weight, int plus, HIT_POINT dam, int16_t meichuu, bool dokubari, bool impact);
void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, SPELL_IDX snipe_type);
if (creature_ptr->timewalk || creature_ptr->energy_use > 400) {
creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
} else {
- creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
+ creature_ptr->energy_need += (int16_t)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
}
if (creature_ptr->image)
if (!has_flag(f_ptr->flags, FF_SPIKE))
break;
- s16b old_mimic = g_ptr->mimic;
+ int16_t old_mimic = g_ptr->mimic;
feature_type *mimic_f_ptr = &f_info[g_ptr->get_feat_mimic()];
cave_alter_feat(caster_ptr, y, x, FF_SPIKE);
static void describe_spike_power(player_type *player_ptr, flavor_type *flavor_ptr)
{
int avgdam = player_ptr->mighty_throw ? (1 + 3) : 1;
- s16b energy_fire = 100 - player_ptr->lev;
+ int16_t energy_fire = 100 - player_ptr->lev;
avgdam += ((player_ptr->lev + 30) * (player_ptr->lev + 30) - 900) / 55;
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
for (KIND_OBJECT_IDX i = 0; i < k_idx_list_num; i++) {
object_kind *k1_ptr = &k_info[k_idx_list[i]];
object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
- s16b tmp = k1_ptr->flavor;
+ int16_t tmp = k1_ptr->flavor;
k1_ptr->flavor = k2_ptr->flavor;
k2_ptr->flavor = tmp;
}
- C_KILL(k_idx_list, max_k_idx, s16b);
+ C_KILL(k_idx_list, max_k_idx, int16_t);
}
/*!
* while new floor creation since dungeons may be re-created by\n
* auto-scum option.\n
*/
-static void update_unique_artifact(floor_type *floor_ptr, s16b cur_floor_id)
+static void update_unique_artifact(floor_type *floor_ptr, int16_t cur_floor_id)
{
for (int i = 1; i < floor_ptr->m_max; i++) {
monster_race *r_ptr;
typedef struct saved_floor_type {
FLOOR_IDX floor_id; /* No recycle until 65536 IDs are all used */
- s16b savefile_id; /* ID for savefile (from 0 to MAX_SAVED_FLOOR) */
+ int16_t savefile_id; /* ID for savefile (from 0 to MAX_SAVED_FLOOR) */
DEPTH dun_level;
s32b last_visit; /* Time count of last visit. 0 for new floor. */
u32b visit_mark; /* Older has always smaller mark. */
bool generate_encounter;
typedef struct border_type {
- s16b north[MAX_WID];
- s16b south[MAX_WID];
- s16b east[MAX_HGT];
- s16b west[MAX_HGT];
- s16b north_west;
- s16b north_east;
- s16b south_west;
- s16b south_east;
+ int16_t north[MAX_WID];
+ int16_t south[MAX_WID];
+ int16_t east[MAX_HGT];
+ int16_t west[MAX_HGT];
+ int16_t north_west;
+ int16_t north_east;
+ int16_t south_west;
+ int16_t south_east;
} border_type;
/*!
* @param feat_type 非一様確率を再現するための要素数100の配列
* @param prob 元の確率テーブル
*/
-static void set_floor_and_wall_aux(s16b feat_type[100], feat_prob prob[DUNGEON_FEAT_PROB_NUM])
+static void set_floor_and_wall_aux(int16_t feat_type[100], feat_prob prob[DUNGEON_FEAT_PROB_NUM])
{
int lim[DUNGEON_FEAT_PROB_NUM];
lim[0] = prob[0].percent;
}
/* The default table in terrain level generation. */
-static s16b terrain_table[MAX_WILDERNESS][MAX_FEAT_IN_TERRAIN];
+static int16_t terrain_table[MAX_WILDERNESS][MAX_FEAT_IN_TERRAIN];
/*!
* @brief 荒野フロア生成のサブルーチン
u32b state_backup[4];
Rand_state_backup(state_backup);
Rand_state_set(seed);
- int table_size = sizeof(terrain_table[0]) / sizeof(s16b);
+ int table_size = sizeof(terrain_table[0]) / sizeof(int16_t);
if (!corner)
for (POSITION y1 = 0; y1 < MAX_HGT; y1++)
for (POSITION x1 = 0; x1 < MAX_WID; x1++)
floor_ptr->grid_array[y1][x1].feat = table_size / 2;
- floor_ptr->grid_array[1][1].feat = (s16b)randint0(table_size);
- floor_ptr->grid_array[MAX_HGT - 2][1].feat = (s16b)randint0(table_size);
- floor_ptr->grid_array[1][MAX_WID - 2].feat = (s16b)randint0(table_size);
- floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = (s16b)randint0(table_size);
+ floor_ptr->grid_array[1][1].feat = (int16_t)randint0(table_size);
+ floor_ptr->grid_array[MAX_HGT - 2][1].feat = (int16_t)randint0(table_size);
+ floor_ptr->grid_array[1][MAX_WID - 2].feat = (int16_t)randint0(table_size);
+ floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = (int16_t)randint0(table_size);
if (corner) {
floor_ptr->grid_array[1][1].feat = terrain_table[terrain][floor_ptr->grid_array[1][1].feat];
floor_ptr->grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][floor_ptr->grid_array[MAX_HGT - 2][1].feat];
return;
}
- s16b north_west = floor_ptr->grid_array[1][1].feat;
- s16b south_west = floor_ptr->grid_array[MAX_HGT - 2][1].feat;
- s16b north_east = floor_ptr->grid_array[1][MAX_WID - 2].feat;
- s16b south_east = floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
+ int16_t north_west = floor_ptr->grid_array[1][1].feat;
+ int16_t south_west = floor_ptr->grid_array[MAX_HGT - 2][1].feat;
+ int16_t north_east = floor_ptr->grid_array[1][MAX_WID - 2].feat;
+ int16_t south_east = floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
FEAT_IDX roughness = 1; /* The roughness of the level. */
plasma_recursive(floor_ptr, 1, 1, MAX_WID - 2, MAX_HGT - 2, table_size - 1, roughness);
floor_ptr->grid_array[1][1].feat = north_west;
quest[i].status = QUEST_STATUS_FINISHED;
}
-static s16b conv_terrain2feat[MAX_WILDERNESS];
+static int16_t conv_terrain2feat[MAX_WILDERNESS];
/*!
* @brief 広域マップの生成(簡易処理版) /
for (int i = 0; i < current_world_ptr->max_wild_x; i++) {
for (int j = 0; j < current_world_ptr->max_wild_y; j++) {
if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN)) {
- floor_ptr->grid_array[j][i].feat = (s16b)feat_town;
- floor_ptr->grid_array[j][i].special = (s16b)wilderness[j][i].town;
+ floor_ptr->grid_array[j][i].feat = (int16_t)feat_town;
+ floor_ptr->grid_array[j][i].special = (int16_t)wilderness[j][i].town;
floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK);
continue;
}
}
}
- floor_ptr->height = (s16b)current_world_ptr->max_wild_y;
- floor_ptr->width = (s16b)current_world_ptr->max_wild_x;
+ floor_ptr->height = (int16_t)current_world_ptr->max_wild_y;
+ floor_ptr->width = (int16_t)current_world_ptr->max_wild_x;
if (floor_ptr->height > MAX_HGT)
floor_ptr->height = MAX_HGT;
w_letter[index].terrain = TERRAIN_EDGE;
if (num > 2)
- w_letter[index].level = (s16b)atoi(zz[2]);
+ w_letter[index].level = (int16_t)atoi(zz[2]);
else
w_letter[index].level = 0;
* @param feat_global 基本的な地形ID
* @param fmt 地勢内の地形数を参照するための独自フォーマット
*/
-static void init_terrain_table(int terrain, s16b feat_global, concptr fmt, ...)
+static void init_terrain_table(int terrain, int16_t feat_global, concptr fmt, ...)
{
va_list vp;
va_start(vp, fmt);
continue;
}
- FEAT_IDX feat = (s16b)va_arg(vp, int);
+ FEAT_IDX feat = (int16_t)va_arg(vp, int);
int num = va_arg(vp, int);
int lim = cur + num;
for (; (cur < lim) && (cur < MAX_FEAT_IN_TERRAIN); cur++)
byte delay_factor; /* Delay factor (0 to 9) */
bool autosave_l; /* Autosave before entering new levels */
bool autosave_t; /* Timed autosave */
-s16b autosave_freq; /* Autosave frequency */
+int16_t autosave_freq; /* Autosave frequency */
bool use_sound; /* The "sound" mode is enabled */
bool use_music; /* The "music" mode is enabled */
bool use_graphics; /* The "graphics" mode is enabled */
extern byte hitpoint_warn;
extern byte mana_warn;
extern byte delay_factor;
-extern s16b autosave_freq;
+extern int16_t autosave_freq;
extern bool autosave_t;
extern bool autosave_l;
extern bool use_sound;
case GB_OUTER_NOPERM: {
feature_type *f_ptr = &f_info[feat_wall_outer];
if (permanent_wall(f_ptr)) {
- g_ptr->feat = (s16b)feat_state(player_ptr->current_floor_ptr, feat_wall_outer, FF_UNPERM);
+ g_ptr->feat = (int16_t)feat_state(player_ptr->current_floor_ptr, feat_wall_outer, FF_UNPERM);
} else {
g_ptr->feat = feat_wall_outer;
}
case GB_SOLID_NOPERM: {
feature_type *f_ptr = &f_info[feat_wall_solid];
if ((g_ptr->info & CAVE_VAULT) && permanent_wall(f_ptr))
- g_ptr->feat = (s16b)feat_state(player_ptr->current_floor_ptr, feat_wall_solid, FF_UNPERM);
+ g_ptr->feat = (int16_t)feat_state(player_ptr->current_floor_ptr, feat_wall_solid, FF_UNPERM);
else
g_ptr->feat = feat_wall_solid;
g_ptr->info &= ~(CAVE_MASK);
BIT_FLAGS info;
FEAT_IDX feat;
FEAT_IDX mimic;
- s16b special;
+ int16_t special;
u16b occurrence;
};
#include "view/display-messages.h"
#include "world/world.h"
-static s16b normal_traps[MAX_NORMAL_TRAPS];
+static int16_t normal_traps[MAX_NORMAL_TRAPS];
/*!
* @brief 箱のトラップテーブル
/* Locked doors */
FEAT_IDX i;
for (i = 1; i < MAX_LJ_DOORS; i++) {
- s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
+ int16_t door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
if (door < 0)
break;
feat_door[DOOR_DOOR].locked[i - 1] = door;
/* Jammed doors */
for (i = 0; i < MAX_LJ_DOORS; i++) {
- s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
+ int16_t door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
if (door < 0)
break;
feat_door[DOOR_DOOR].jammed[i] = door;
/* Locked glass doors */
for (i = 1; i < MAX_LJ_DOORS; i++) {
- s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
+ int16_t door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
if (door < 0)
break;
feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
/* Jammed glass doors */
for (i = 0; i < MAX_LJ_DOORS; i++) {
- s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
+ int16_t door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
if (door < 0)
break;
feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
* Initialize quest array
* @return 地形ID
*/
-s16b f_tag_to_index_in_init(concptr str)
+int16_t f_tag_to_index_in_init(concptr str)
{
FEAT_IDX feat = f_tag_to_index(str);
errr parse_f_info(std::string_view buf, angband_header *head);
errr init_feat_variables(void);
FEAT_IDX f_tag_to_index(std::string_view str);
-s16b f_tag_to_index_in_init(concptr str);
+int16_t f_tag_to_index_in_init(concptr str);
void retouch_f_info(angband_header *head);
switch (num) {
case 9:
- letter[index].special = (s16b)atoi(zz[8]);
+ letter[index].special = (int16_t)atoi(zz[8]);
/* Fall through */
case 8:
if ((zz[7][0] == '*') && !zz[7][1]) {
ARTIFACT_IDX artifact; /* Artifact */
IDX trap; /* Trap */
BIT_FLAGS cave_info; /* Flags for CAVE_MARK, CAVE_GLOW, CAVE_ICKY, CAVE_ROOM */
- s16b special; /* Reserved for special terrain info */
+ int16_t special; /* Reserved for special terrain info */
int random; /* Number of the random effect */
} dungeon_grid;
* Note that this code must remove any location/stack information\n
* from the object once it is placed into the inventory.\n
*/
-s16b store_item_to_inventory(player_type *owner_ptr, object_type *o_ptr)
+int16_t store_item_to_inventory(player_type *owner_ptr, object_type *o_ptr)
{
INVENTORY_IDX i, j, k;
INVENTORY_IDX n = -1;
void drop_from_inventory(player_type *owner_type, INVENTORY_IDX item, ITEM_NUMBER amt);
void combine_pack(player_type *owner_ptr);
void reorder_pack(player_type *owner_ptr);
-s16b store_item_to_inventory(player_type *owner_ptr, object_type *o_ptr);
+int16_t store_item_to_inventory(player_type *owner_ptr, object_type *o_ptr);
bool check_store_item_to_inventory(player_type *owner_ptr, object_type *o_ptr);
INVENTORY_IDX inven_takeoff(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER amt);
if (!current_world_ptr->total_winner) {
fprintf(fff, _("\n [死ぬ直前のメッセージ]\n\n", "\n [Last Messages]\n\n"));
for (int i = MIN(message_num(), 30); i >= 0; i--) {
- fprintf(fff, "> %s\n", message_str((s16b)i));
+ fprintf(fff, "> %s\n", message_str((int16_t)i));
}
fputc('\n', fff);
/* No monsters is defeated */
if (norm_total < 1) {
fprintf(fff, _("まだ敵を倒していません。\n", "You have defeated no enemies yet.\n"));
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
return;
}
#else
fprintf(fff, "You have defeated %ld %s.\n", norm_total, norm_total == 1 ? "enemy" : "enemies");
#endif
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
return;
}
fprintf(fff, _(" %-40s (レベル%3d)%s\n", " %-40s (level %3d)%s\n"), r_ptr->name.c_str(), (int)r_ptr->level, buf);
}
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
}
/*!
bool use_menu;
-s16b command_cmd; /* Current "Angband Command" */
+int16_t command_cmd; /* Current "Angband Command" */
COMMAND_ARG command_arg; /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
COMMAND_NUM command_rep; /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */
DIRECTION command_dir; /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */
-s16b command_see; /* アイテム使用時等にリストを表示させるかどうか (ゲームオプションの他、様々なタイミングでONになったりOFFになったりする模様……) */
-s16b command_wrk; /* アイテムの使用許可状況 (ex. 装備品のみ、床上もOK等) */
+int16_t command_see; /* アイテム使用時等にリストを表示させるかどうか (ゲームオプションの他、様々なタイミングでONになったりOFFになったりする模様……) */
+int16_t command_wrk; /* アイテムの使用許可状況 (ex. 装備品のみ、床上もOK等) */
TERM_LEN command_gap = 999; /* アイテムの表示に使う (詳細未調査) */
-s16b command_new; /* Command chaining from inven/equip view */
+int16_t command_new; /* Command chaining from inven/equip view */
/*
* Hack -- special buffer to hold the action of the current keymap
*/
void request_command(player_type *player_ptr, int shopping)
{
- s16b cmd;
+ int16_t cmd;
int mode;
concptr act;
extern COMMAND_CODE command_cmd;
extern COMMAND_ARG command_arg;
-extern s16b command_rep;
+extern int16_t command_rep;
extern DIRECTION command_dir;
-extern s16b command_see;
+extern int16_t command_see;
extern TERM_LEN command_gap;
-extern s16b command_wrk;
-extern s16b command_new;
+extern int16_t command_wrk;
+extern int16_t command_new;
typedef struct player_type player_type;
void request_command(player_type *player_ptr, int shopping);
#include "term/term-color-types.h"
#include "world/world.h"
-s16b signal_count; /* Hack -- Count interupts */
+int16_t signal_count; /* Hack -- Count interupts */
#include <signal.h>
#pragma once
#include "system/angband.h"
-extern s16b signal_count;
+extern int16_t signal_count;
extern void signals_ignore_tstp(void);
extern void signals_handle_tstp(void);
* Hack -- We will always extract at least one token
* </pre>
*/
-s16b tokenize(char *buf, s16b num, char **tokens, BIT_FLAGS mode)
+int16_t tokenize(char *buf, int16_t num, char **tokens, BIT_FLAGS mode)
{
- s16b i = 0;
+ int16_t i = 0;
char *s = buf;
while (i < num - 1)
{
#define TOKENIZE_CHECKQUOTE 0x01 /* Special handling of single quotes */
-s16b tokenize(char *buf, s16b num, char **tokens, BIT_FLAGS mode);
+int16_t tokenize(char *buf, int16_t num, char **tokens, BIT_FLAGS mode);
fprintf(fff, " Total: %lu creature%s killed.\n", (unsigned long int)total, (total == 1 ? "" : "s"));
#endif
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
angband_fclose(fff);
(void)show_file(creature_ptr, true, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
fd_kill(file_name);
/*
* Display the monsters in a group.
*/
-static void display_monster_list(int col, int row, int per_page, s16b mon_idx[], int mon_cur, int mon_top, bool visual_only)
+static void display_monster_list(int col, int row, int per_page, int16_t mon_idx[], int mon_cur, int mon_top, bool visual_only)
{
int i;
for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++) {
ang_sort(creature_ptr, unique_list_ptr->who, &unique_list_ptr->why, unique_list_ptr->n, ang_sort_comp_hook, ang_sort_swap_hook);
display_uniques(unique_list_ptr, fff);
- C_KILL(unique_list_ptr->who, max_r_idx, s16b);
+ C_KILL(unique_list_ptr->who, max_r_idx, int16_t);
angband_fclose(fff);
concptr title_desc
= unique_list_ptr->is_alive ? _("まだ生きているユニーク・モンスター", "Alive Uniques") : _("もう撃破したユニーク・モンスター", "Dead Uniques");
rd_s16b(&previous_char.stat_max_max[i]);
for (int i = 0; i < PY_MAX_LEVEL; i++) {
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
previous_char.player_hp[i] = (HIT_POINT)tmp16s;
}
*/
void rd_dummy1(void)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
for (int i = 0; i < tmp16s; i++) {
- s16b tmp16s2;
+ int16_t tmp16s2;
rd_s16b(&tmp16s2);
}
}
if (h_older_than(1, 5, 0, 2))
return;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
for (int i = 0; i < tmp16s; i++) {
monster_type dummy_mon;
rd_s16b(&sf_ptr->floor_id);
rd_byte(&tmp8u);
- sf_ptr->savefile_id = (s16b)tmp8u;
+ sf_ptr->savefile_id = (int16_t)tmp8u;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
sf_ptr->dun_level = (DEPTH)tmp16s;
player_ptr->x = player_ptr->y = 0;
if (!sf_ptr) {
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
floor_ptr->dun_level = (DEPTH)tmp16s;
floor_ptr->base_level = floor_ptr->dun_level;
} else {
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
if (tmp16s != sf_ptr->floor_id)
return 171;
return 171;
}
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
floor_ptr->base_level = (DEPTH)tmp16s;
rd_s16b(&tmp16s);
if (h_older_than(1, 7, 0, 2)) {
byte tmp8u;
rd_byte(&tmp8u);
- ct_ptr->feat = (s16b)tmp8u;
+ ct_ptr->feat = (int16_t)tmp8u;
rd_byte(&tmp8u);
- ct_ptr->mimic = (s16b)tmp8u;
+ ct_ptr->mimic = (int16_t)tmp8u;
} else {
rd_s16b(&ct_ptr->feat);
rd_s16b(&ct_ptr->mimic);
} else
o_ptr->number = 1;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
o_ptr->weight = tmp16s;
* @brief ロードファイルポインタから符号つき16bit値を読み込んでポインタに渡す
* @param ip 読み込みポインタ
*/
-void rd_s16b(s16b *ip) { rd_u16b((u16b *)ip); }
+void rd_s16b(int16_t *ip) { rd_u16b((u16b *)ip); }
/*!
* @brief ロードファイルポインタから符号なし32bit値を読み込んでポインタに渡す
byte sf_get(void);
void rd_byte(byte *ip);
void rd_u16b(u16b *ip);
-void rd_s16b(s16b *ip);
+void rd_s16b(int16_t *ip);
void rd_u32b(u32b *ip);
void rd_s32b(s32b *ip);
void rd_string(char *str, int max);
rd_byte(&tmp8u);
o_ptr->number = (ITEM_NUMBER)tmp8u;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
o_ptr->weight = tmp16s;
else
o_ptr->xtra5 = damroll(r_info[o_ptr->pval].hdice, r_info[o_ptr->pval].hside);
if (ironman_nightmare) {
- o_ptr->xtra5 = (s16b)MIN(30000, o_ptr->xtra5 * 2L);
+ o_ptr->xtra5 = (int16_t)MIN(30000, o_ptr->xtra5 * 2L);
}
o_ptr->xtra4 = o_ptr->xtra5;
}
m_ptr->fx = (POSITION)tmp8u;
m_ptr->current_floor_ptr = player_ptr->current_floor_ptr;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
m_ptr->hp = tmp16s;
rd_s16b(&tmp16s);
if (h_older_than(0, 4, 2)) {
rd_byte(&tmp8u);
- m_ptr->energy_need = (s16b)tmp8u;
+ m_ptr->energy_need = (int16_t)tmp8u;
} else
rd_s16b(&m_ptr->energy_need);
m_ptr->mtimed[MTIMED_SLOW] = 0;
} else {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_FAST] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_FAST] = (int16_t)tmp8u;
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_SLOW] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_SLOW] = (int16_t)tmp8u;
}
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_STUNNED] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_STUNNED] = (int16_t)tmp8u;
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_CONFUSED] = (int16_t)tmp8u;
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_MONFEAR] = (int16_t)tmp8u;
if (h_older_than(0, 0, 10)) {
reset_target(m_ptr);
}
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_INVULNER] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_INVULNER] = (int16_t)tmp8u;
u32b tmp32u;
rd_u32b(&tmp32u);
*/
errr rd_dungeon_old(player_type *player_ptr)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
floor_type *floor_ptr = player_ptr->current_floor_ptr;
floor_ptr->dun_level = (DEPTH)tmp16s;
for (int i = count; i > 0; i--) {
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
- g_ptr->feat = (s16b)tmp8u;
+ g_ptr->feat = (int16_t)tmp8u;
if (++x >= xmax) {
x = 0;
if (++y >= ymax)
for (int i = count; i > 0; i--) {
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
- g_ptr->mimic = (s16b)tmp8u;
+ g_ptr->mimic = (int16_t)tmp8u;
if (++x >= xmax) {
x = 0;
if (++y >= ymax)
void set_hp_old(player_type *creature_ptr)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->mhp = tmp16s;
void set_mana_old(player_type *creature_ptr)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->msp = tmp16s;
void rd_zangband_dungeon()
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
max_dlv[DUNGEON_ANGBAND] = tmp16s;
}
void set_zangband_gambling_monsters(int i)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
mon_odds[i] = tmp16s;
}
}
for (int i = 0; i < tmp16u; i++) {
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->player_hp[i] = (HIT_POINT)tmp16s;
}
*/
void rd_lore(monster_race *r_ptr, MONRACE_IDX r_idx)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
r_ptr->r_sights = (MONSTER_NUMBER)tmp16s;
rd_byte(&tmp8u);
m_ptr->fx = (POSITION)tmp8u;
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
m_ptr->hp = (HIT_POINT)tmp16s;
rd_s16b(&tmp16s);
if (flags & SAVE_MON_FAST) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_FAST] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_FAST] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_FAST] = 0;
if (flags & SAVE_MON_SLOW) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_SLOW] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_SLOW] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_SLOW] = 0;
if (flags & SAVE_MON_STUNNED) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_STUNNED] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_STUNNED] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_STUNNED] = 0;
if (flags & SAVE_MON_CONFUSED) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_CONFUSED] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_CONFUSED] = 0;
if (flags & SAVE_MON_MONFEAR) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_MONFEAR] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_MONFEAR] = 0;
if (flags & SAVE_MON_INVULNER) {
rd_byte(&tmp8u);
- m_ptr->mtimed[MTIMED_INVULNER] = (s16b)tmp8u;
+ m_ptr->mtimed[MTIMED_INVULNER] = (int16_t)tmp8u;
} else
m_ptr->mtimed[MTIMED_INVULNER] = 0;
}
if (h_older_than(0, 2, 3)) {
- s16b tmp16s;
+ int16_t tmp16s;
const int OLD_MAX_MANE = 22;
for (int i = 0; i < OLD_MAX_MANE; i++) {
rd_s16b(&tmp16s);
}
for (int i = 0; i < MAX_MANE; i++) {
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->mane_spell[i] = static_cast<RF_ABILITY>(tmp16s);
rd_s16b(&tmp16s);
static void rd_phase_out(player_type *creature_ptr)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->current_floor_ptr->inside_arena = (bool)tmp16s;
rd_s16b(&creature_ptr->current_floor_ptr->inside_quest);
rd_byte(&creature_ptr->exit_bldg);
rd_byte(&tmp8u);
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
creature_ptr->oldpx = (POSITION)tmp16s;
rd_s16b(&tmp16s);
static void load_quest_completion(quest_type *q_ptr)
{
rd_s16b(&q_ptr->status);
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
q_ptr->level = tmp16s;
static void load_quest_details(player_type *creature_ptr, quest_type *q_ptr, int loading_quest_index)
{
- s16b tmp16s;
+ int16_t tmp16s;
rd_s16b(&tmp16s);
q_ptr->cur_num = (MONSTER_NUMBER)tmp16s;
rd_s16b(&tmp16s);
byte owner_idx;
byte tmp8u;
- s16b inven_num;
+ int16_t inven_num;
rd_s32b(&store_ptr->store_open);
rd_s16b(&store_ptr->insult_cur);
rd_byte(&owner_idx);
{
byte max = (byte)current_world_ptr->max_d_idx;
rd_byte(&max);
- s16b tmp16s;
+ int16_t tmp16s;
for (int i = 0; i < max; i++) {
rd_s16b(&tmp16s);
max_dlv[i] = tmp16s;
*/
void rd_alter_reality(player_type *creature_ptr)
{
- s16b tmp16s;
+ int16_t tmp16s;
if (h_older_than(0, 3, 8))
creature_ptr->recall_dungeon = DUNGEON_ANGBAND;
else {
*
* We save pointers to the tokens in "tokens", and return the number found.
*/
-s16b tokenize_whitespace(char *buf, s16b num, char **tokens)
+int16_t tokenize_whitespace(char *buf, int16_t num, char **tokens)
{
- s16b k = 0;
+ int16_t k = 0;
char *s = buf;
while (k < num) {
#include "system/h-type.h"
-s16b tokenize_whitespace(char *buf, s16b num, char **tokens);
+int16_t tokenize_whitespace(char *buf, int16_t num, char **tokens);
long mask;
- s16b ox, oy;
-
- s16b x, y;
- s16b w, h;
+ int16_t ox, oy;
+ int16_t x, y;
+ int16_t w, h;
u16b b;
byte byte1;
#endif
concptr name;
- s16b wid;
- s16b twid;
- s16b hgt;
- s16b asc;
+ int16_t wid;
+ int16_t twid;
+ int16_t hgt;
+ int16_t asc;
byte off;
C_MAKE(floor_ptr->o_list, current_world_ptr->max_o_idx, object_type);
C_MAKE(floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type);
for (int i = 0; i < MAX_MTIMED; i++)
- C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b);
+ C_MAKE(floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, int16_t);
C_MAKE(max_dlv, current_world_ptr->max_d_idx, DEPTH);
for (int i = 0; i < MAX_HGT; i++)
*/
errr init_object_alloc(void)
{
- s16b aux[MAX_DEPTH];
- (void)C_WIPE(aux, MAX_DEPTH, s16b);
+ int16_t aux[MAX_DEPTH];
+ (void)C_WIPE(aux, MAX_DEPTH, int16_t);
- s16b num[MAX_DEPTH];
- (void)C_WIPE(num, MAX_DEPTH, s16b);
+ int16_t num[MAX_DEPTH];
+ (void)C_WIPE(num, MAX_DEPTH, int16_t);
if (alloc_kind_table)
C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
byte gamma_table[256];
/* Table of ln(x/256) * 256 for x going from 0 -> 255 */
-static s16b gamma_helper[256] =
+static int16_t gamma_helper[256] =
{
0,-1420,-1242,-1138,-1065,-1007,-961,-921,-887,-857,-830,-806,-783,-762,-744,-726,
-710,-694,-679,-666,-652,-640,-628,-617,-606,-596,-586,-576,-567,-577,-549,-541,
/*
* Use get_string() because we may need more than
- * the s16b value returned by get_quantity().
+ * the int16_t value returned by get_quantity().
*/
if (!get_string(tmp_str, out_val, 32)) {
screen_load();
* @return ダメージ期待値
*/
static u32b calc_expect_dice(
- player_type *owner_ptr, u32b dam, int mult, int div, bool force, WEIGHT weight, int plus, s16b meichuu, bool dokubari, bool impact, int vorpal_mult, int vorpal_div)
+ player_type *owner_ptr, u32b dam, int mult, int div, bool force, WEIGHT weight, int plus, int16_t meichuu, bool dokubari, bool impact, int vorpal_mult, int vorpal_div)
{
dam = calc_slaydam(dam, mult, div, force);
dam = calc_expect_crit(owner_ptr, weight, plus, dam, meichuu, dokubari, impact);
/*
* Use get_string() because we may need more than
- * the s16b value returned by get_quantity().
+ * the int16_t value returned by get_quantity().
*/
if (!get_string(tmp_str, out_val, 32)) {
msg_print(NULL);
object_known(q_ptr);
apply_magic_to_object(creature_ptr, q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
q_ptr->discount = 99;
- s16b slot = store_item_to_inventory(creature_ptr, q_ptr);
+ int16_t slot = store_item_to_inventory(creature_ptr, q_ptr);
GAME_TEXT o_name[MAX_NLEN];
describe_flavor(creature_ptr, o_name, q_ptr, 0);
msg_format(_("%sを作った。", "You make some ammo."), o_name);
describe_flavor(creature_ptr, o_name, q_ptr, 0);
msg_format(_("%sを作った。", "You make some ammo."), o_name);
vary_item(creature_ptr, item, -1);
- s16b slot = store_item_to_inventory(creature_ptr, q_ptr);
+ int16_t slot = store_item_to_inventory(creature_ptr, q_ptr);
if (slot >= 0)
autopick_alter_item(creature_ptr, slot, false);
describe_flavor(creature_ptr, o_name, q_ptr, 0);
msg_format(_("%sを作った。", "You make some ammo."), o_name);
vary_item(creature_ptr, item, -1);
- s16b slot = store_item_to_inventory(creature_ptr, q_ptr);
+ int16_t slot = store_item_to_inventory(creature_ptr, q_ptr);
if (slot >= 0)
autopick_alter_item(creature_ptr, slot, false);
if ((monap_ptr->o_ptr->xtra4 <= 0) || object_is_fixed_artifact(monap_ptr->o_ptr))
return;
- monap_ptr->o_ptr->xtra4 -= (s16b)(250 + randint1(250));
+ monap_ptr->o_ptr->xtra4 -= (int16_t)(250 + randint1(250));
if (monap_ptr->o_ptr->xtra4 < 1)
monap_ptr->o_ptr->xtra4 = 1;
}
(void)msd->get_movable_grid();
- msd->target_ptr->pet_follow_distance = (s16b)dis;
+ msd->target_ptr->pet_follow_distance = (int16_t)dis;
return true;
}
(void)set_monster_fast(player_ptr, g_ptr->m_idx, 100);
if (!ironman_nightmare) {
- m_ptr->energy_need = ENERGY_NEED() - (s16b)randint0(100);
+ m_ptr->energy_need = ENERGY_NEED() - (int16_t)randint0(100);
} else {
- m_ptr->energy_need = ENERGY_NEED() - (s16b)randint0(100) * 2;
+ m_ptr->energy_need = ENERGY_NEED() - (int16_t)randint0(100) * 2;
}
if (any_bits(r_ptr->flags1, RF1_PREVENT_SUDDEN_MAGIC) && !ironman_nightmare) {
}
}
- m_ptr->mtimed[MTIMED_CSLEEP] = (s16b)v;
+ m_ptr->mtimed[MTIMED_CSLEEP] = (int16_t)v;
if (!notice)
return false;
}
}
- m_ptr->mtimed[MTIMED_FAST] = (s16b)v;
+ m_ptr->mtimed[MTIMED_FAST] = (int16_t)v;
if (!notice)
return false;
}
}
- m_ptr->mtimed[MTIMED_SLOW] = (s16b)v;
+ m_ptr->mtimed[MTIMED_SLOW] = (int16_t)v;
if (!notice)
return false;
}
}
- m_ptr->mtimed[MTIMED_STUNNED] = (s16b)v;
+ m_ptr->mtimed[MTIMED_STUNNED] = (int16_t)v;
return notice;
}
}
}
- m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)v;
+ m_ptr->mtimed[MTIMED_CONFUSED] = (int16_t)v;
return notice;
}
}
}
- m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)v;
+ m_ptr->mtimed[MTIMED_MONFEAR] = (int16_t)v;
if (!notice)
return false;
}
}
- m_ptr->mtimed[MTIMED_INVULNER] = (s16b)v;
+ m_ptr->mtimed[MTIMED_INVULNER] = (int16_t)v;
if (!notice)
return false;
*/
int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- s16b *cur_mproc_list = floor_ptr->mproc_list[mproc_type];
+ int16_t *cur_mproc_list = floor_ptr->mproc_list[mproc_type];
for (int i = floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--) {
if (cur_mproc_list[i] == m_idx) {
return i;
void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
if (floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) {
- floor_ptr->mproc_list[mproc_type][floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
+ floor_ptr->mproc_list[mproc_type][floor_ptr->mproc_max[mproc_type]++] = (int16_t)m_idx;
}
}
* @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
* @return 対応する装備部位ID
*/
-s16b wield_slot(player_type *owner_ptr, object_type *o_ptr)
+int16_t wield_slot(player_type *owner_ptr, object_type *o_ptr)
{
switch (o_ptr->tval) {
case TV_DIGGING:
typedef struct player_type player_type;
concptr activation_explanation(player_type *owner_ptr, object_type *o_ptr);
char index_to_label(int i);
-s16b wield_slot(player_type *owner_ptr, object_type *o_ptr);
+int16_t wield_slot(player_type *owner_ptr, object_type *o_ptr);
bool check_book_realm(player_type *owner_ptr, const tval_type book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
object_type *ref_item(player_type *owner_ptr, INVENTORY_IDX item);
TERM_COLOR object_attr(object_type *o_ptr);
* * 型による魅力修正値
* * 降鬼陣で加算(+5)
*/
-s16b PlayerCharisma::battleform_value()
+int16_t PlayerCharisma::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_WART_SKINで減算(-2)
* * 変異MUT3_SCALESで減算(-1)
*/
-s16b PlayerCharisma::mutation_value()
+int16_t PlayerCharisma::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.any()) {
if (this->owner_ptr->muta.has(MUTA::FLESH_ROT)) {
return result;
}
-s16b PlayerCharisma::set_exception_value(s16b value)
+int16_t PlayerCharisma::set_exception_value(int16_t value)
{
- s16b result = value;
+ int16_t result = value;
if (this->owner_ptr->muta.has(MUTA::ILL_NORM)) {
result = 0;
* * MUT3_ILL_NORMを保持しているときの例外処理。
* * 魅力現在値をレベル依存の値に修正する。
*/
-s16b PlayerCharisma::set_exception_use_status(s16b value)
+int16_t PlayerCharisma::set_exception_use_status(int16_t value)
{
if (this->owner_ptr->muta.has(MUTA::ILL_NORM)) {
/* 10 to 18/90 charisma, guaranteed, based on level */
protected:
void set_locals() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
- s16b set_exception_value(s16b value) override;
- s16b set_exception_use_status(s16b value) override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
+ int16_t set_exception_value(int16_t value) override;
+ int16_t set_exception_use_status(int16_t value) override;
};
* * 種族による耐久力修正値。
* * エントは別途レベル26,41,46到達ごとに加算(+1)
*/
-s16b PlayerConstitution::race_value()
+int16_t PlayerConstitution::race_value()
{
- s16b result = PlayerBasicStatistics::race_value();
+ int16_t result = PlayerBasicStatistics::race_value();
if (is_specific_player_race(this->owner_ptr, player_race_type::ENT)) {
if (this->owner_ptr->lev > 25)
* * 一時効果による耐久力修正値
* * 呪術の肉体強化で加算(+4)
*/
-s16b PlayerConstitution::time_effect_value()
+int16_t PlayerConstitution::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->realm1 == REALM_HEX) {
if (hex_spelling(this->owner_ptr, HEX_BUILDING)) {
* * 朱雀の構えで減算(-2)
* * ネオ・つよしスペシャル中で加算(+4)
*/
-s16b PlayerConstitution::battleform_value()
+int16_t PlayerConstitution::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_XTRA_FATで加算(+2)
* * 変異MUT3_FLESH_ROTで減算(-2)
*/
-s16b PlayerConstitution::mutation_value()
+int16_t PlayerConstitution::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.any()) {
if (this->owner_ptr->muta.has(MUTA::RESILIENT)) {
protected:
void set_locals() override;
- s16b race_value() override;
- s16b time_effect_value() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
+ int16_t race_value() override;
+ int16_t time_effect_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
};
* * 種族による器用さ修正値。
* * エントは別途レベル26,41,46到達ごとに減算(-1)
*/
-s16b PlayerDexterity::race_value()
+int16_t PlayerDexterity::race_value()
{
- s16b result = PlayerBasicStatistics::race_value();
+ int16_t result = PlayerBasicStatistics::race_value();
if (is_specific_player_race(this->owner_ptr, player_race_type::ENT)) {
if (this->owner_ptr->lev > 25)
* * 一時効果による器用さ修正値
* * 呪術の肉体強化で加算(+4)
*/
-s16b PlayerDexterity::time_effect_value()
+int16_t PlayerDexterity::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->realm1 == REALM_HEX) {
if (hex_spelling(this->owner_ptr, HEX_BUILDING)) {
* * 玄武の構えで減算(-2)
* * 朱雀の構えで加算(+2)
*/
-s16b PlayerDexterity::battleform_value()
+int16_t PlayerDexterity::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_LIMBERで加算(+3)
* * 変異MUT3_ARTHRITISで減算(-3)
*/
-s16b PlayerDexterity::mutation_value()
+int16_t PlayerDexterity::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.has(MUTA::IRON_SKIN)) {
result -= 1;
protected:
void set_locals() override;
- s16b race_value() override;
- s16b time_effect_value() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
+ int16_t race_value() override;
+ int16_t time_effect_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
};
* * 玄武の構えで減算(-1)
* * 朱雀の構えで加算(+1)
*/
-s16b PlayerIntelligence::battleform_value()
+int16_t PlayerIntelligence::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_HYPER_INTで加算(+4)
* * 変異MUT3_MORONICで減算(-4)
*/
-s16b PlayerIntelligence::mutation_value()
+int16_t PlayerIntelligence::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.any()) {
if (this->owner_ptr->muta.has(MUTA::HYPER_INT)) {
result += 4;
protected:
void set_locals() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
};
* * 種族による腕力修正値。
* * エントは別途レベル26,41,46到達ごとに加算(+1)
*/
-s16b PlayerStrength::race_value()
+int16_t PlayerStrength::race_value()
{
- s16b result = PlayerBasicStatistics::race_value();
+ int16_t result = PlayerBasicStatistics::race_value();
if (is_specific_player_race(this->owner_ptr, player_race_type::ENT)) {
if (this->owner_ptr->lev > 25)
* * 呪術の肉体強化で加算(+4)
* * ネオ・つよしスペシャル中で加算(+4)
*/
-s16b PlayerStrength::time_effect_value()
+int16_t PlayerStrength::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->realm1 == REALM_HEX) {
if (hex_spelling(this->owner_ptr, HEX_XTRA_MIGHT)) {
* * 白虎の構えで加算(+2)
* * 朱雀の構えで減算(-2)
*/
-s16b PlayerStrength::battleform_value()
+int16_t PlayerStrength::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_HYPER_STRで加算(+4)
* * 変異MUT3_PUNYで減算(-4)
*/
-s16b PlayerStrength::mutation_value()
+int16_t PlayerStrength::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.any()) {
if (this->owner_ptr->muta.has(MUTA::HYPER_STR)) {
protected:
void set_locals() override;
- s16b race_value() override;
- s16b time_effect_value() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
+ int16_t race_value() override;
+ int16_t time_effect_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
};
* * 玄武の構えで減算(-1)
* * 朱雀の構えで加算(+1)
*/
-s16b PlayerWisdom::battleform_value()
+int16_t PlayerWisdom::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KATA_KOUKIJIN)) {
result += 5;
* * 変異MUT3_HYPER_INTで加算(+4)
* * 変異MUT3_MORONICで減算(-4)
*/
-s16b PlayerWisdom::mutation_value()
+int16_t PlayerWisdom::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.any()) {
if (this->owner_ptr->muta.has(MUTA::HYPER_INT)) {
protected:
void set_locals() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
};
typedef struct monster_race monster_race;
typedef struct monster_type monster_type;
typedef struct player_attack_type {
- s16b hand{}; //!< 武器の持ち手
+ int16_t hand{}; //!< 武器の持ち手
grid_type *g_ptr; //!< ターゲットのいる地形情報
MONSTER_IDX m_idx{}; //!< モンスターID
monster_type *m_ptr{}; //!< モンスター情報(参照ポインタ)
* @brief プレイヤーの攻撃情報を初期化する(コンストラクタ以外の分)
*/
static player_attack_type *initialize_player_attack_type(
- player_attack_type *pa_ptr, player_type *attacker_ptr, POSITION y, POSITION x, s16b hand, combat_options mode, bool *fear, bool *mdeath)
+ player_attack_type *pa_ptr, player_type *attacker_ptr, POSITION y, POSITION x, int16_t hand, combat_options mode, bool *fear, bool *mdeath)
{
auto floor_ptr = attacker_ptr->current_floor_ptr;
auto g_ptr = &floor_ptr->grid_array[y][x];
* @details
* If no "weapon" is available, then "punch" the monster one time.
*/
-void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, combat_options mode)
+void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, int16_t hand, combat_options mode)
{
bool do_quake = false;
bool drain_msg = true;
#include "combat/combat-options-type.h"
typedef struct player_type player_type;
-void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, combat_options mode);
+void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, int16_t hand, combat_options mode);
void massacre(player_type *caster_ptr);
* @details
* * 各要素によるステータス修正値の合計
*/
-s16b PlayerBasicStatistics::modification_value()
+int16_t PlayerBasicStatistics::modification_value()
{
return PlayerStatusBase::get_value();
}
* @brief 基礎ステータスの実値
* @return status_typeに対応するステータスの実値を返す
*/
-s16b PlayerBasicStatistics::get_value()
+int16_t PlayerBasicStatistics::get_value()
{
this->set_locals();
return this->owner_ptr->stat_index[(int)this->ability_type];
* @details
* * 種族によるステータス修正値。
*/
-s16b PlayerBasicStatistics::race_value()
+int16_t PlayerBasicStatistics::race_value()
{
const player_race *tmp_rp_ptr;
if (this->owner_ptr->mimic_form)
* @details
* * 職業によるステータス修正値
*/
-s16b PlayerBasicStatistics::class_value()
+int16_t PlayerBasicStatistics::class_value()
{
const player_class *c_ptr = &class_info[this->owner_ptr->pclass];
return c_ptr->c_adj[this->ability_type];
* @details
* * 性格によるステータス修正値
*/
-s16b PlayerBasicStatistics::personality_value()
+int16_t PlayerBasicStatistics::personality_value()
{
const player_personality *a_ptr = &personality_info[this->owner_ptr->pseikaku];
return a_ptr->a_adj[this->ability_type];
int top = modify_stat_value(this->owner_ptr->stat_max[status], this->owner_ptr->stat_add[status]);
if (this->owner_ptr->stat_top[status] != top) {
- this->owner_ptr->stat_top[status] = (s16b)top;
+ this->owner_ptr->stat_top[status] = (int16_t)top;
set_bits(this->owner_ptr->redraw, PR_STATS);
set_bits(this->owner_ptr->window_flags, PW_PLAYER);
}
* * owner_ptrのステータス現在値を更新する際の例外処理
* * 派生クラスでoverrideして使用する。
*/
-s16b PlayerBasicStatistics::set_exception_use_status(s16b value)
+int16_t PlayerBasicStatistics::set_exception_use_status(int16_t value)
{
return value;
}
void PlayerBasicStatistics::update_use_status()
{
int status = (int)this->ability_type;
- s16b use = modify_stat_value(this->owner_ptr->stat_cur[status], this->owner_ptr->stat_add[status]);
+ int16_t use = modify_stat_value(this->owner_ptr->stat_cur[status], this->owner_ptr->stat_add[status]);
use = this->set_exception_use_status(use);
if (this->owner_ptr->stat_use[status] != use) {
- this->owner_ptr->stat_use[status] = (s16b)use;
+ this->owner_ptr->stat_use[status] = (int16_t)use;
set_bits(this->owner_ptr->redraw, PR_STATS);
set_bits(this->owner_ptr->window_flags, PW_PLAYER);
}
if (this->owner_ptr->stat_index[status] == index)
return;
- this->owner_ptr->stat_index[status] = (s16b)index;
+ this->owner_ptr->stat_index[status] = (int16_t)index;
if (status == A_CON) {
set_bits(this->owner_ptr->update, PU_HP);
} else if (status == A_INT) {
PlayerBasicStatistics() = delete;
void update_value();
- s16b modification_value();
- s16b get_value() override;
+ int16_t modification_value();
+ int16_t get_value() override;
protected:
player_ability_type ability_type;
- s16b race_value() override;
- s16b class_value() override;
- s16b personality_value() override;
+ int16_t race_value() override;
+ int16_t class_value() override;
+ int16_t personality_value() override;
void update_top_status();
void update_use_status();
void update_index_status();
- virtual s16b set_exception_use_status(s16b value);
+ virtual int16_t set_exception_use_status(int16_t value);
};
#include "player-ability/player-charisma.h"
* @details
* * 種族による加算
*/
-s16b PlayerInfravision::race_value()
+int16_t PlayerInfravision::race_value()
{
const player_race *tmp_rp_ptr;
* @details
* * 変異MUT3_INFRAVISによる加算(+3)
*/
-s16b PlayerInfravision::mutation_value()
+int16_t PlayerInfravision::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->muta.has(MUTA::INFRAVIS)) {
result += 3;
}
* @details
* * 魔法効果tim_infraによる加算(+3)
*/
-s16b PlayerInfravision::time_effect_value()
+int16_t PlayerInfravision::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->tim_infra) {
result += 3;
}
protected:
void set_locals() override;
- s16b race_value() override;
- s16b time_effect_value() override;
- s16b mutation_value() override;
+ int16_t race_value() override;
+ int16_t time_effect_value() override;
+ int16_t mutation_value() override;
};
* ** マーフォークがFF_WATER地形にいれば加算(+2+レベル/10)
* ** そうでなく浮遊を持っていないなら減算(-2)
*/
-s16b PlayerSpeed::race_value()
+int16_t PlayerSpeed::race_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (is_specific_player_race(this->owner_ptr, player_race_type::KLACKON) || is_specific_player_race(this->owner_ptr, player_race_type::SPRITE))
result += (this->owner_ptr->lev) / 10;
* ** 錬気術師で装備が重くなくクラッコン、妖精、いかさま以外なら加算(+レベル/10)
* ** 狂戦士なら加算(+3),レベル20/30/40/50ごとに+1
*/
-s16b PlayerSpeed::class_value()
+int16_t PlayerSpeed::class_value()
{
SPEED result = 0;
* @details
* ** いかさまでクラッコン/妖精以外なら加算(+5+レベル/10)
*/
-s16b PlayerSpeed::personality_value()
+int16_t PlayerSpeed::personality_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->pseikaku == PERSONALITY_MUNCHKIN && this->owner_ptr->prace != player_race_type::KLACKON && this->owner_ptr->prace != player_race_type::SPRITE) {
result += (this->owner_ptr->lev) / 10 + 5;
}
* ** 棘セット装備中ならば加算(+7)
* ** アイシングデス-トゥインクル装備中ならば加算(+7)
*/
-s16b PlayerSpeed::special_weapon_set_value()
+int16_t PlayerSpeed::special_weapon_set_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (has_melee_weapon(this->owner_ptr, INVEN_MAIN_HAND) && has_melee_weapon(this->owner_ptr, INVEN_SUB_HAND)) {
if ((this->owner_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_QUICKTHORN)
&& (this->owner_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_TINYTHORN)) {
* ** 装備品にTR_SPEEDがあれば加算(+pval+1
* ** セットで加速増減があるものを計算
*/
-s16b PlayerSpeed::equipments_value()
+int16_t PlayerSpeed::equipments_value()
{
- s16b result = PlayerStatusBase::equipments_value();
+ int16_t result = PlayerStatusBase::equipments_value();
result += this->special_weapon_set_value();
return result;
* ** 食い過ぎなら減算(-10)
* ** 光速移動中は+999(最終的に+99になる)
*/
-s16b PlayerSpeed::time_effect_value()
+int16_t PlayerSpeed::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (is_fast(this->owner_ptr)) {
result += 10;
* @details
* ** 朱雀の構えなら加算(+10)
*/
-s16b PlayerSpeed::battleform_value()
+int16_t PlayerSpeed::battleform_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (any_bits(this->owner_ptr->special_defense, KAMAE_SUZAKU))
result += 10;
return result;
* ** 変異MUT3_XTRA_LEGなら加算(+3)
* ** 変異MUT3_SHORT_LEGなら減算(-3)
*/
-s16b PlayerSpeed::mutation_value()
+int16_t PlayerSpeed::mutation_value()
{
SPEED result = 0;
* @details
* * 騎乗中ならばモンスターの加速に準拠、ただし騎乗技能値とモンスターレベルによるキャップ処理あり
*/
-s16b PlayerSpeed::riding_value()
+int16_t PlayerSpeed::riding_value()
{
monster_type *riding_m_ptr = &(this->owner_ptr)->current_floor_ptr->m_list[this->owner_ptr->riding];
SPEED speed = riding_m_ptr->mspeed;
}
if (riding_m_ptr->mspeed > 110) {
- result = (s16b)((speed - 110) * (this->owner_ptr->skill_exp[SKILL_RIDING] * 3 + this->owner_ptr->lev * 160L - 10000L) / (22000L));
+ result = (int16_t)((speed - 110) * (this->owner_ptr->skill_exp[SKILL_RIDING] * 3 + this->owner_ptr->lev * 160L - 10000L) / (22000L));
if (result < 0)
result = 0;
} else {
* @details
* * 所持品の重量による減速処理。乗馬時は別計算。
*/
-s16b PlayerSpeed::inventory_weight_value()
+int16_t PlayerSpeed::inventory_weight_value()
{
SPEED result = 0;
* @details
* * 探索中なら減算(-10)
*/
-s16b PlayerSpeed::action_value()
+int16_t PlayerSpeed::action_value()
{
SPEED result = 0;
if (this->owner_ptr->action == ACTION_SEARCH)
* * 非乗馬時 - ここまでの修正値合算をそのまま使用
* * 乗馬時 - 乗馬の速度と重量減衰のみを計算
*/
-s16b PlayerSpeed::set_exception_value(s16b value)
+int16_t PlayerSpeed::set_exception_value(int16_t value)
{
if (this->owner_ptr->riding) {
value = this->default_value;
protected:
void set_locals() override;
- s16b race_value() override;
- s16b class_value() override;
- s16b personality_value() override;
- s16b equipments_value() override;
- s16b time_effect_value() override;
- s16b battleform_value() override;
- s16b mutation_value() override;
- s16b riding_value() override;
- s16b inventory_weight_value() override;
- s16b action_value() override;
+ int16_t race_value() override;
+ int16_t class_value() override;
+ int16_t personality_value() override;
+ int16_t equipments_value() override;
+ int16_t time_effect_value() override;
+ int16_t battleform_value() override;
+ int16_t mutation_value() override;
+ int16_t riding_value() override;
+ int16_t inventory_weight_value() override;
+ int16_t action_value() override;
BIT_FLAGS equipments_flags(tr_type check_flag) override;
- s16b special_weapon_set_value();
- s16b set_exception_value(s16b value) override;
+ int16_t special_weapon_set_value();
+ int16_t set_exception_value(int16_t value) override;
};
* * 派生クラスからset_locals()をコールして初期値、上限、下限をセット。
* * 各要素毎に計算した値を初期値に単純に加算し、上限と下限で丸める。
*/
-s16b PlayerStatusBase::get_value()
+int16_t PlayerStatusBase::get_value()
{
this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
- s16b pow = this->default_value;
+ int16_t pow = this->default_value;
pow += this->action_value();
pow += this->battleform_value();
* @brief this->tr_flagを持つ装備品のpval合計値を返す
* @return 該当するfalgを持つ全装備のpvalの合計値
*/
-s16b PlayerStatusBase::equipments_value()
+int16_t PlayerStatusBase::equipments_value()
{
this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
- s16b result = 0;
+ int16_t result = 0;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr = &owner_ptr->inventory_list[i];
BIT_FLAGS flgs[TR_FLAG_SIZE];
return result;
}
-s16b PlayerStatusBase::race_value()
+int16_t PlayerStatusBase::race_value()
{
return 0;
}
-s16b PlayerStatusBase::class_value()
+int16_t PlayerStatusBase::class_value()
{
return 0;
}
-s16b PlayerStatusBase::class_base_value()
+int16_t PlayerStatusBase::class_base_value()
{
return 0;
}
-s16b PlayerStatusBase::personality_value()
+int16_t PlayerStatusBase::personality_value()
{
return 0;
}
-s16b PlayerStatusBase::time_effect_value()
+int16_t PlayerStatusBase::time_effect_value()
{
return 0;
}
-s16b PlayerStatusBase::battleform_value()
+int16_t PlayerStatusBase::battleform_value()
{
return 0;
}
-s16b PlayerStatusBase::mutation_value()
+int16_t PlayerStatusBase::mutation_value()
{
return 0;
}
-s16b PlayerStatusBase::riding_value()
+int16_t PlayerStatusBase::riding_value()
{
return 0;
}
-s16b PlayerStatusBase::inventory_weight_value()
+int16_t PlayerStatusBase::inventory_weight_value()
{
return 0;
}
-s16b PlayerStatusBase::action_value()
+int16_t PlayerStatusBase::action_value()
{
return 0;
}
* * 派生クラスで必要とされる例外処理でoverrideされる
* @return 直接変更された値。このままmin-max処理され最終的なvalueになる。
*/
-s16b PlayerStatusBase::set_exception_value(s16b value)
+int16_t PlayerStatusBase::set_exception_value(int16_t value)
{
return value;
}
PlayerStatusBase(player_type *owner_ptr);
PlayerStatusBase() = delete;
virtual ~PlayerStatusBase() = default;
- virtual s16b get_value();
+ virtual int16_t get_value();
virtual BIT_FLAGS get_all_flags();
virtual BIT_FLAGS get_good_flags();
virtual BIT_FLAGS get_bad_flags();
protected:
- s16b default_value;
- s16b min_value;
- s16b max_value;
+ int16_t default_value;
+ int16_t min_value;
+ int16_t max_value;
player_type *owner_ptr;
tr_type tr_flag;
tr_type tr_bad_flag;
virtual void set_locals();
- virtual s16b race_value();
- virtual s16b class_value();
- virtual s16b class_base_value();
- virtual s16b personality_value();
- virtual s16b equipments_value();
- virtual s16b time_effect_value();
- virtual s16b battleform_value();
- virtual s16b mutation_value();
- virtual s16b riding_value();
- virtual s16b inventory_weight_value();
- virtual s16b action_value();
- virtual s16b set_exception_value(s16b value);
+ virtual int16_t race_value();
+ virtual int16_t class_value();
+ virtual int16_t class_base_value();
+ virtual int16_t personality_value();
+ virtual int16_t equipments_value();
+ virtual int16_t time_effect_value();
+ virtual int16_t battleform_value();
+ virtual int16_t mutation_value();
+ virtual int16_t riding_value();
+ virtual int16_t inventory_weight_value();
+ virtual int16_t action_value();
+ virtual int16_t set_exception_value(int16_t value);
virtual BIT_FLAGS equipments_flags(tr_type check_flag);
virtual BIT_FLAGS equipments_bad_flags(tr_type check_flag);
};
* @details
* * 種族による加算
*/
-s16b PlayerStealth::race_value()
+int16_t PlayerStealth::race_value()
{
const player_race *tmp_rp_ptr;
* @details
* * 性格による加算
*/
-s16b PlayerStealth::personality_value()
+int16_t PlayerStealth::personality_value()
{
const player_personality *a_ptr = &personality_info[this->owner_ptr->pseikaku];
return a_ptr->a_stl;
* @details
* * 職業による加算
*/
-s16b PlayerStealth::class_base_value()
+int16_t PlayerStealth::class_base_value()
{
const player_class *c_ptr = &class_info[this->owner_ptr->pclass];
return c_ptr->c_stl + (c_ptr->x_stl * this->owner_ptr->lev / 10);
* * 忍者がheavy_armorならば減算(-レベル/10)
* * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
*/
-s16b PlayerStealth::class_value()
+int16_t PlayerStealth::class_value()
{
ACTION_SKILL_POWER result = 0;
* * 変異MUT3_XTRA_NOISで減算(-3)
* * 変異MUT3_MOTIONで加算(+1)
*/
-s16b PlayerStealth::mutation_value()
+int16_t PlayerStealth::mutation_value()
{
- s16b result = 0;
+ int16_t result = 0;
const auto &muta = this->owner_ptr->muta;
if (muta.has(MUTA::XTRA_NOIS)) {
result -= 3;
* * 狂戦士化で減算(-7)
* * 隠密の歌で加算(+999)
*/
-s16b PlayerStealth::time_effect_value()
+int16_t PlayerStealth::time_effect_value()
{
- s16b result = 0;
+ int16_t result = 0;
if (this->owner_ptr->realm1 == REALM_HEX) {
if (hex_spelling_any(this->owner_ptr))
result -= (1 + casting_hex_num(this->owner_ptr));
* @details
* * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
*/
-s16b PlayerStealth::set_exception_value(s16b value)
+int16_t PlayerStealth::set_exception_value(int16_t value)
{
if (this->is_aggravated_s_fairy()) {
value = MIN(value - 3, (value + 2) / 2);
protected:
void set_locals() override;
- s16b race_value() override;
- s16b class_value() override;
- s16b class_base_value() override;
- s16b personality_value() override;
- s16b time_effect_value() override;
- s16b mutation_value() override;
- s16b set_exception_value(s16b value) override;
+ int16_t race_value() override;
+ int16_t class_value() override;
+ int16_t class_base_value() override;
+ int16_t personality_value() override;
+ int16_t time_effect_value() override;
+ int16_t mutation_value() override;
+ int16_t set_exception_value(int16_t value) override;
bool is_aggravated_s_fairy();
};
#ifdef JP
concptr E_title; /* 英語職業 */
#endif
- s16b c_adj[6]; /* Class stat modifier */
-
- s16b c_dis; /* class disarming */
- s16b c_dev; /* class magic devices */
- s16b c_sav; /* class saving throws */
- s16b c_stl; /* class stealth */
- s16b c_srh; /* class searching ability */
- s16b c_fos; /* class searching frequency */
- s16b c_thn; /* class to hit (normal) */
- s16b c_thb; /* class to hit (bows) */
-
- s16b x_dis; /* extra disarming */
- s16b x_dev; /* extra magic devices */
- s16b x_sav; /* extra saving throws */
- s16b x_stl; /* extra stealth */
- s16b x_srh; /* extra searching ability */
- s16b x_fos; /* extra searching frequency */
- s16b x_thn; /* extra to hit (normal) */
- s16b x_thb; /* extra to hit (bows) */
-
- s16b c_mhp; /* Class hit-dice adjustment */
- s16b c_exp; /* Class experience factor */
+ int16_t c_adj[6]; /* Class stat modifier */
+
+ int16_t c_dis; /* class disarming */
+ int16_t c_dev; /* class magic devices */
+ int16_t c_sav; /* class saving throws */
+ int16_t c_stl; /* class stealth */
+ int16_t c_srh; /* class searching ability */
+ int16_t c_fos; /* class searching frequency */
+ int16_t c_thn; /* class to hit (normal) */
+ int16_t c_thb; /* class to hit (bows) */
+
+ int16_t x_dis; /* extra disarming */
+ int16_t x_dev; /* extra magic devices */
+ int16_t x_sav; /* extra saving throws */
+ int16_t x_stl; /* extra stealth */
+ int16_t x_srh; /* extra searching ability */
+ int16_t x_fos; /* extra searching frequency */
+ int16_t x_thn; /* extra to hit (normal) */
+ int16_t x_thb; /* extra to hit (bows) */
+
+ int16_t c_mhp; /* Class hit-dice adjustment */
+ int16_t c_exp; /* Class experience factor */
byte pet_upkeep_div; /* Pet upkeep divider */
concptr E_title; /* 英語性格 */
#endif
- s16b a_adj[6]; /* ersonality stat bonuses */
-
- s16b a_dis; /* personality disarming */
- s16b a_dev; /* personality magic devices */
- s16b a_sav; /* personality saving throw */
- s16b a_stl; /* personality stealth */
- s16b a_srh; /* personality search ability */
- s16b a_fos; /* personality search frequency */
- s16b a_thn; /* personality combat (normal) */
- s16b a_thb; /* personality combat (shooting) */
-
- s16b a_mhp; /* Race hit-dice modifier */
+ int16_t a_adj[6]; /* ersonality stat bonuses */
+
+ int16_t a_dis; /* personality disarming */
+ int16_t a_dev; /* personality magic devices */
+ int16_t a_sav; /* personality saving throw */
+ int16_t a_stl; /* personality stealth */
+ int16_t a_srh; /* personality search ability */
+ int16_t a_fos; /* personality search frequency */
+ int16_t a_thn; /* personality combat (normal) */
+ int16_t a_thb; /* personality combat (shooting) */
+
+ int16_t a_mhp; /* Race hit-dice modifier */
byte no; /* の */
byte sex; /* seibetu seigen */
concptr E_title{}; //!< 英語種族名
#endif
concptr symbol{}; //!< 種族シンボル(救援召喚) / Race symbols
- s16b r_adj[A_MAX]{}; //!< 能力値ボーナス / Racial stat bonuses
-
- s16b r_dis{}; //!< 解除 / disarming
- s16b r_dev{}; //!< 魔道具使用 /magic devices
- s16b r_sav{}; //!< 魔法防御 / saving throw
- s16b r_stl{}; //!< 隠密 / stealth
- s16b r_srh{}; //!< 探索 / search ability
- s16b r_fos{}; //!< 知覚 / search frequency
- s16b r_thn{}; //!< 打撃修正(命中) / combat (normal)
- s16b r_thb{}; //!< 射撃修正(命中) / combat (shooting)
+ int16_t r_adj[A_MAX]{}; //!< 能力値ボーナス / Racial stat bonuses
+
+ int16_t r_dis{}; //!< 解除 / disarming
+ int16_t r_dev{}; //!< 魔道具使用 /magic devices
+ int16_t r_sav{}; //!< 魔法防御 / saving throw
+ int16_t r_stl{}; //!< 隠密 / stealth
+ int16_t r_srh{}; //!< 探索 / search ability
+ int16_t r_fos{}; //!< 知覚 / search frequency
+ int16_t r_thn{}; //!< 打撃修正(命中) / combat (normal)
+ int16_t r_thb{}; //!< 射撃修正(命中) / combat (shooting)
byte r_mhp{}; //!< ヒットダイス / Race hit-dice modifier
byte r_exp{}; //!< 経験値修正 /Race experience factor
static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr);
static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr);
static bool is_heavy_wield(player_type *creature_ptr, int i);
-static s16b calc_num_blow(player_type *creature_ptr, int i);
-static s16b calc_to_magic_chance(player_type *creature_ptr);
+static int16_t calc_num_blow(player_type *creature_ptr, int i);
+static int16_t calc_to_magic_chance(player_type *creature_ptr);
static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr);
static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_real_value);
-static s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot);
+static int16_t calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot);
static bool is_riding_two_hands(player_type *creature_ptr);
-static s16b calc_riding_bow_penalty(player_type *creature_ptr);
+static int16_t calc_riding_bow_penalty(player_type *creature_ptr);
static void put_equipment_warning(player_type *creature_ptr);
-static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
-static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
+static int16_t calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
+static int16_t calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
-static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_real_value);
+static int16_t calc_to_hit_bow(player_type *creature_ptr, bool is_real_value);
-static s16b calc_to_damage_misc(player_type *creature_ptr);
-static s16b calc_to_hit_misc(player_type *creature_ptr);
+static int16_t calc_to_damage_misc(player_type *creature_ptr);
+static int16_t calc_to_hit_misc(player_type *creature_ptr);
static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot);
static player_hand main_attack_hand(player_type *creature_ptr);
BIT_FLAGS old_esp_unique = creature_ptr->esp_unique;
BIT_FLAGS old_see_inv = creature_ptr->see_inv;
BIT_FLAGS old_mighty_throw = creature_ptr->mighty_throw;
- s16b old_speed = creature_ptr->pspeed;
+ int16_t old_speed = creature_ptr->pspeed;
ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
if (k > 32)
k = 32;
if ((creature_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) {
- creature_ptr->new_spells = (s16b)k;
+ creature_ptr->new_spells = (int16_t)k;
}
}
* @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
* @return 射撃倍率の値(100で1.00倍)
*/
-s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
+int16_t calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
{
int extra_shots = 0;
BIT_FLAGS flgs[TR_FLAG_SIZE];
int num = 0;
if (o_ptr->k_idx == 0)
- return (s16b)num;
+ return (int16_t)num;
num = 100;
num += (extra_shots * 100);
if (is_heavy_shoot(creature_ptr, o_ptr))
- return (s16b)num;
+ return (int16_t)num;
tval_type tval_ammo = static_cast<tval_type>(bow_tval_ammo(o_ptr));
if ((creature_ptr->pclass == CLASS_RANGER) && (tval_ammo == TV_ARROW)) {
num += (creature_ptr->lev * 4);
}
- return (s16b)num;
+ return (int16_t)num;
}
/*!
return has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i) && (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10);
}
-static s16b calc_num_blow(player_type *creature_ptr, int i)
+static int16_t calc_num_blow(player_type *creature_ptr, int i)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- s16b num_blow = 1;
+ int16_t num_blow = 1;
o_ptr = &creature_ptr->inventory_list[INVEN_MAIN_HAND + i];
object_flags(creature_ptr, o_ptr, flgs);
num_blow = blows_table[str_index][dex_index];
if (num_blow > num)
- num_blow = (s16b)num;
+ num_blow = (int16_t)num;
- num_blow += (s16b)creature_ptr->extra_blows[i];
+ num_blow += (int16_t)creature_ptr->extra_blows[i];
if (creature_ptr->pclass == CLASS_WARRIOR)
num_blow += (creature_ptr->lev / 40);
else if (creature_ptr->pclass == CLASS_BERSERKER)
* * 性格チャージマンなら加算(+5)
* * 装備品にTRC::HARD_SPELLがあるなら加算(軽い呪いなら+3/重い呪いなら+10)
*/
-static s16b calc_to_magic_chance(player_type *creature_ptr)
+static int16_t calc_to_magic_chance(player_type *creature_ptr)
{
- s16b chance = 0;
+ int16_t chance = 0;
if (creature_ptr->pseikaku == PERSONALITY_LAZY)
chance += 10;
* * 武蔵セットによる免除
* * 竿状武器による増加
*/
-s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
+int16_t calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
{
int penalty = 0;
BIT_FLAGS flags[TR_FLAG_SIZE];
if (creature_ptr->inventory_list[slot].tval == TV_POLEARM)
penalty += 10;
}
- return (s16b)penalty;
+ return (int16_t)penalty;
}
static bool is_riding_two_hands(player_type *creature_ptr)
return false;
}
-static s16b calc_riding_bow_penalty(player_type *creature_ptr)
+static int16_t calc_riding_bow_penalty(player_type *creature_ptr)
{
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
if (!creature_ptr->riding)
return 0;
- s16b penalty = 0;
+ int16_t penalty = 0;
if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
if (creature_ptr->tval_ammo != TV_ARROW)
}
}
-static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
+static int16_t calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
{
object_type *o_ptr = &creature_ptr->inventory_list[slot];
BIT_FLAGS flgs[TR_FLAG_SIZE];
if (slot == INVEN_SUB_HAND)
calc_hand = PLAYER_HAND_SUB;
- s16b damage = 0;
+ int16_t damage = 0;
damage += ((int)(adj_str_td[creature_ptr->stat_index[A_STR]]) - 128);
if (is_shero(creature_ptr)) {
case MELEE_TYPE_BAREHAND_TWO: /* fall through */
case MELEE_TYPE_WEAPON_TWOHAND:
if (calc_hand == main_attack_hand(creature_ptr))
- damage += (s16b)bonus_to_d;
+ damage += (int16_t)bonus_to_d;
break;
case MELEE_TYPE_BAREHAND_MAIN: /* fall through */
case MELEE_TYPE_WEAPON_MAIN:
if ((calc_hand == PLAYER_HAND_MAIN) && (i != INVEN_SUB_RING))
- damage += (s16b)bonus_to_d;
+ damage += (int16_t)bonus_to_d;
break;
case MELEE_TYPE_BAREHAND_SUB: /* fall through */
case MELEE_TYPE_WEAPON_SUB:
if ((calc_hand == PLAYER_HAND_SUB) && (i != INVEN_MAIN_RING))
- damage += (s16b)bonus_to_d;
+ damage += (int16_t)bonus_to_d;
break;
case MELEE_TYPE_WEAPON_DOUBLE:
if (calc_hand == PLAYER_HAND_MAIN) {
if (i == INVEN_MAIN_RING) {
- damage += (s16b)bonus_to_d;
+ damage += (int16_t)bonus_to_d;
} else if (i != INVEN_SUB_RING) {
damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
}
}
if (calc_hand == PLAYER_HAND_SUB) {
if (i == INVEN_SUB_RING) {
- damage += (s16b)bonus_to_d;
+ damage += (int16_t)bonus_to_d;
} else if (i != INVEN_MAIN_RING) {
damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
}
* @details
* 'slot' MUST be INVEN_MAIN_HAND or INVEM_SUB_HAND.
*/
-static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
+static int16_t calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
{
- s16b hit = 0;
+ int16_t hit = 0;
/* Base bonuses */
hit += ((int)(adj_dex_th[creature_ptr->stat_index[A_DEX]]) - 128);
if (penalty < 30)
penalty = 30;
}
- hit -= (s16b)penalty;
+ hit -= (int16_t)penalty;
}
/* Class penalties */
case MELEE_TYPE_BAREHAND_TWO: /* fall through */
case MELEE_TYPE_WEAPON_TWOHAND:
if (calc_hand == main_attack_hand(creature_ptr))
- hit += (s16b)bonus_to_h;
+ hit += (int16_t)bonus_to_h;
break;
case MELEE_TYPE_BAREHAND_MAIN: /* fall through */
case MELEE_TYPE_WEAPON_MAIN:
if ((calc_hand == PLAYER_HAND_MAIN) && (i != INVEN_SUB_RING))
- hit += (s16b)bonus_to_h;
+ hit += (int16_t)bonus_to_h;
break;
case MELEE_TYPE_BAREHAND_SUB: /* fall through */
case MELEE_TYPE_WEAPON_SUB:
if ((calc_hand == PLAYER_HAND_SUB) && (i != INVEN_MAIN_RING))
- hit += (s16b)bonus_to_h;
+ hit += (int16_t)bonus_to_h;
break;
case MELEE_TYPE_WEAPON_DOUBLE:
if (calc_hand == PLAYER_HAND_MAIN) {
if (i == INVEN_MAIN_RING) {
- hit += (s16b)bonus_to_h;
+ hit += (int16_t)bonus_to_h;
} else if (i != INVEN_SUB_RING) {
hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
}
}
if (calc_hand == PLAYER_HAND_SUB) {
if (i == INVEN_SUB_RING) {
- hit += (s16b)bonus_to_h;
+ hit += (int16_t)bonus_to_h;
} else if (i != INVEN_MAIN_RING) {
hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
}
return hit;
}
-static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_real_value)
+static int16_t calc_to_hit_bow(player_type *creature_ptr, bool is_real_value)
{
- s16b pow = 0;
+ int16_t pow = 0;
pow += ((int)(adj_dex_th[creature_ptr->stat_index[A_DEX]]) - 128);
pow += ((int)(adj_str_th[creature_ptr->stat_index[A_STR]]) - 128);
}
if (is_real_value || object_is_known(o_ptr))
- pow += (s16b)bonus_to_h;
+ pow += (int16_t)bonus_to_h;
}
pow -= calc_riding_bow_penalty(creature_ptr);
return pow;
}
-static s16b calc_to_damage_misc(player_type *creature_ptr)
+static int16_t calc_to_damage_misc(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- s16b to_dam = 0;
+ int16_t to_dam = 0;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (o_ptr->to_d > 0)
bonus_to_d = (o_ptr->to_d + 1) / 2;
}
- to_dam += (s16b)bonus_to_d;
+ to_dam += (int16_t)bonus_to_d;
}
if (is_shero(creature_ptr)) {
return to_dam;
}
-static s16b calc_to_hit_misc(player_type *creature_ptr)
+static int16_t calc_to_hit_misc(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- s16b to_hit = 0;
+ int16_t to_hit = 0;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (o_ptr->to_h > 0)
bonus_to_h = (o_ptr->to_h + 1) / 2;
}
- to_hit += (s16b)bonus_to_h;
+ to_hit += (int16_t)bonus_to_h;
}
if (is_blessed(creature_ptr)) {
* Or even: 18/13, 18/03, 18, 17, ..., 3
* </pre>
*/
-s16b modify_stat_value(int value, int amount)
+int16_t modify_stat_value(int value, int amount)
{
if (amount > 0) {
for (int i = 0; i < amount; i++) {
}
}
- return (s16b)value;
+ return (int16_t)value;
}
/*!
WEIGHT calc_bow_weight_limit(player_type *creature_ptr);
WEIGHT calc_inventory_weight(player_type *creature_ptr);
-s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr);
+int16_t calc_num_fire(player_type *creature_ptr, object_type *o_ptr);
WEIGHT calc_weight_limit(player_type *creature_ptr);
void update_creature(player_type *creature_ptr);
bool player_has_no_spellbooks(player_type *creature_ptr);
void check_experience(player_type *creature_ptr);
void wreck_the_pattern(player_type *creature_ptr);
void cnv_stat(int val, char *out_val);
-s16b modify_stat_value(int value, int amount);
+int16_t modify_stat_value(int value, int amount);
long calc_score(player_type *creature_ptr);
bool is_blessed(player_type *creature_ptr);
}
}
- 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;
+ floor_ptr->grid_array[fill_data.ymin][fill_data.xmin].feat = (int16_t)maxsize;
+ floor_ptr->grid_array[fill_data.ymax][fill_data.xmin].feat = (int16_t)maxsize;
+ floor_ptr->grid_array[fill_data.ymin][fill_data.xmax].feat = (int16_t)maxsize;
+ floor_ptr->grid_array[fill_data.ymax][fill_data.xmax].feat = (int16_t)maxsize;
floor_ptr->grid_array[y0][x0].feat = 0;
POSITION xstep = xsize * 256;
POSITION xhstep = xsize * 256;
int rooms_built = 0;
int area_size = 100 * (floor_ptr->height * floor_ptr->width) / (MAX_HGT * MAX_WID);
int level_index = MIN(10, div_round(floor_ptr->dun_level, 10));
- s16b room_num[ROOM_T_MAX];
+ int16_t room_num[ROOM_T_MAX];
int dun_rooms = DUN_ROOMS_MAX * area_size / 100;
room_info_type *room_info_ptr = room_info_normal;
for (int i = 0; i < ROOM_T_MAX; i++) {
/* Room type information */
typedef struct room_info_type {
- s16b prob[ROOM_T_MAX]; /* Allocation information. */
+ int16_t prob[ROOM_T_MAX]; /* Allocation information. */
byte min_level; /* Minimum level on which room can appear. */
} room_info_type;
if (r_ptr->flags3 & RF3_GOOD)
align.sub_align |= SUB_ALIGN_GOOD;
- nest_mon_info[i].r_idx = (s16b)r_idx;
+ nest_mon_info[i].r_idx = (int16_t)r_idx;
nest_mon_info[i].used = false;
}
bool light;
grid_type *g_ptr;
- s16b trap;
+ int16_t trap;
/* Pick a room size */
y1 = randint1(4);
{
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!sf_ptr) {
- wr_s16b((s16b)floor_ptr->dun_level);
+ wr_s16b((int16_t)floor_ptr->dun_level);
} else {
wr_s16b(sf_ptr->floor_id);
wr_byte((byte)sf_ptr->savefile_id);
- wr_s16b((s16b)sf_ptr->dun_level);
+ wr_s16b((int16_t)sf_ptr->dun_level);
wr_s32b(sf_ptr->last_visit);
wr_u32b(sf_ptr->visit_mark);
wr_s16b(sf_ptr->upper_floor_id);
}
wr_u16b((u16b)floor_ptr->base_level);
- wr_u16b((s16b)player_ptr->current_floor_ptr->num_repro);
+ wr_u16b((int16_t)player_ptr->current_floor_ptr->num_repro);
wr_u16b((u16b)player_ptr->y);
wr_u16b((u16b)player_ptr->x);
wr_u16b((u16b)floor_ptr->height);
saved_floor_type *sf_ptr = &saved_floors[i];
wr_s16b(sf_ptr->floor_id);
wr_byte((byte)sf_ptr->savefile_id);
- wr_s16b((s16b)sf_ptr->dun_level);
+ wr_s16b((int16_t)sf_ptr->dun_level);
wr_s32b(sf_ptr->last_visit);
wr_u32b(sf_ptr->visit_mark);
wr_s16b(sf_ptr->upper_floor_id);
wr_s16b(previous_char.stat_max_max[i]);
for (int i = 0; i < PY_MAX_LEVEL; i++)
- wr_s16b((s16b)previous_char.player_hp[i]);
+ wr_s16b((int16_t)previous_char.player_hp[i]);
wr_s16b(previous_char.chaos_patron);
for (int i = 0; i < 8; i++)
static void write_item_info(object_type *o_ptr, const BIT_FLAGS flags)
{
- wr_s16b((s16b)o_ptr->weight);
+ wr_s16b((int16_t)o_ptr->weight);
if (flags & SAVE_ITEM_NAME1)
wr_s16b(o_ptr->name1);
wr_s16b(o_ptr->to_h);
if (flags & SAVE_ITEM_TO_D)
- wr_s16b((s16b)o_ptr->to_d);
+ wr_s16b((int16_t)o_ptr->to_d);
if (flags & SAVE_ITEM_TO_A)
wr_s16b(o_ptr->to_a);
}
if (flags & SAVE_MON_TARGET_Y)
- wr_s16b((s16b)m_ptr->target_y);
+ wr_s16b((int16_t)m_ptr->target_y);
if (flags & SAVE_MON_TARGET_X)
- wr_s16b((s16b)m_ptr->target_x);
+ wr_s16b((int16_t)m_ptr->target_x);
if (flags & SAVE_MON_INVULNER) {
tmp8u = (byte)m_ptr->mtimed[MTIMED_INVULNER];
wr_s16b(m_ptr->r_idx);
wr_byte((byte)m_ptr->fy);
wr_byte((byte)m_ptr->fx);
- wr_s16b((s16b)m_ptr->hp);
- wr_s16b((s16b)m_ptr->maxhp);
- wr_s16b((s16b)m_ptr->max_maxhp);
+ wr_s16b((int16_t)m_ptr->hp);
+ wr_s16b((int16_t)m_ptr->maxhp);
+ wr_s16b((int16_t)m_ptr->max_maxhp);
wr_u32b(m_ptr->dealt_damage);
if (flags & SAVE_MON_AP_R_IDX)
void wr_lore(MONRACE_IDX r_idx)
{
monster_race *r_ptr = &r_info[r_idx];
- wr_s16b((s16b)r_ptr->r_sights);
- wr_s16b((s16b)r_ptr->r_deaths);
- wr_s16b((s16b)r_ptr->r_pkills);
- wr_s16b((s16b)r_ptr->r_akills);
- wr_s16b((s16b)r_ptr->r_tkills);
+ wr_s16b((int16_t)r_ptr->r_sights);
+ wr_s16b((int16_t)r_ptr->r_deaths);
+ wr_s16b((int16_t)r_ptr->r_pkills);
+ wr_s16b((int16_t)r_ptr->r_akills);
+ wr_s16b((int16_t)r_ptr->r_tkills);
wr_byte(r_ptr->r_wake);
wr_byte(r_ptr->r_ignore);
wr_s32b(creature_ptr->old_race2);
wr_s16b(creature_ptr->old_realm);
for (int i = 0; i < MAX_MANE; i++) {
- wr_s16b((s16b)creature_ptr->mane_spell[i]);
- wr_s16b((s16b)creature_ptr->mane_dam[i]);
+ wr_s16b((int16_t)creature_ptr->mane_spell[i]);
+ wr_s16b((int16_t)creature_ptr->mane_dam[i]);
}
wr_s16b(creature_ptr->mane_num);
wr_byte(creature_ptr->exit_bldg);
wr_byte(0); /* Unused */
- wr_s16b((s16b)creature_ptr->oldpx);
- wr_s16b((s16b)creature_ptr->oldpy);
+ wr_s16b((int16_t)creature_ptr->oldpx);
+ wr_s16b((int16_t)creature_ptr->oldpy);
wr_s16b(0);
wr_s32b(creature_ptr->mhp);
byte tmp8u = (byte)current_world_ptr->max_d_idx;
wr_byte(tmp8u);
for (int i = 0; i < tmp8u; i++)
- wr_s16b((s16b)max_dlv[i]);
+ wr_s16b((int16_t)max_dlv[i]);
wr_s16b(0);
wr_s16b(0);
* @brief 符号あり16ビットをファイルに書き込む
* @param v 書き込む符号あり16bit値
*/
-void wr_s16b(s16b v) { wr_u16b((u16b)v); }
+void wr_s16b(int16_t v) { wr_u16b((u16b)v); }
/*!
* @brief 符号なし32ビットをファイルに書き込む
void wr_byte(byte v);
void wr_u16b(u16b v);
-void wr_s16b(s16b v);
+void wr_s16b(int16_t v);
void wr_u32b(u32b v);
void wr_s32b(s32b v);
void wr_string(concptr str);
for (int i = 0; i < max_q_idx; i++) {
quest_type *const q_ptr = &quest[i];
wr_s16b(q_ptr->status);
- wr_s16b((s16b)q_ptr->level);
+ wr_s16b((int16_t)q_ptr->level);
wr_byte((byte)q_ptr->complev);
wr_u32b(q_ptr->comptime);
if (!is_quest_running)
continue;
- wr_s16b((s16b)q_ptr->cur_num);
- wr_s16b((s16b)q_ptr->max_num);
+ wr_s16b((int16_t)q_ptr->cur_num);
+ wr_s16b((int16_t)q_ptr->max_num);
wr_s16b(q_ptr->type);
wr_s16b(q_ptr->r_idx);
wr_s16b(q_ptr->k_idx);
tmp16u = PY_MAX_LEVEL;
wr_u16b(tmp16u);
for (int i = 0; i < tmp16u; i++)
- wr_s16b((s16b)player_ptr->player_hp[i]);
+ wr_s16b((int16_t)player_ptr->player_hp[i]);
wr_u32b(player_ptr->spell_learned1);
wr_u32b(player_ptr->spell_learned2);
{
PLAYER_LEVEL plev = caster_ptr->lev;
- caster_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
+ caster_ptr->energy_need += (int16_t)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
if (!cave_player_teleportable_bold(caster_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, caster_ptr->y, caster_ptr->x) > plev / 2 + 10)
|| (!randint0(plev / 10 + 10))) {
- caster_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
+ caster_ptr->energy_need += (int16_t)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
teleport_player(caster_ptr, (plev + 2) * 2, TELEPORT_PASSIVE);
return false;
}
void do_poly_wounds(player_type *creature_ptr)
{
- s16b wounds = creature_ptr->cut;
- s16b hit_p = (creature_ptr->mhp - creature_ptr->chp);
- s16b change = damroll(creature_ptr->lev, 5);
+ int16_t wounds = creature_ptr->cut;
+ int16_t hit_p = (creature_ptr->mhp - creature_ptr->chp);
+ int16_t change = damroll(creature_ptr->lev, 5);
bool Nasty_effect = one_in_(5);
if (!(wounds || hit_p || Nasty_effect))
return;
byte type{}; //!< Store type
byte owner{}; //!< Owner index
byte extra{}; //!< Unused for now
- s16b insult_cur{}; //!< Insult counter
- s16b good_buy{}; //!< Number of "good" buys (3.0.0で廃止)
- s16b bad_buy{}; //!< Number of "bad" buys (3.0.0で廃止)
+ int16_t insult_cur{}; //!< Insult counter
+ int16_t good_buy{}; //!< Number of "good" buys (3.0.0で廃止)
+ int16_t bad_buy{}; //!< Number of "bad" buys (3.0.0で廃止)
s32b store_open{}; //!< Closed until this turn
s32b last_visit{}; //!< Last visited on this turn
store_k_idx regular{}; //!< Table -- Legal regular item kinds
store_k_idx table{}; //!< Table -- Legal item kinds
- s16b stock_num{}; //!< Stock -- Number of entries
- s16b stock_size{}; //!< Stock -- Total Size of Array
+ int16_t stock_num{}; //!< Stock -- Number of entries
+ int16_t stock_size{}; //!< Stock -- Total Size of Array
object_type *stock{}; //!< Stock -- Actual stock items
};
int store_bottom = 0;
int xtra_stock = 0;
const owner_type *ot_ptr = NULL;
-s16b old_town_num = 0;
-s16b inner_town_num = 0;
+int16_t old_town_num = 0;
+int16_t inner_town_num = 0;
/* We store the current "store feat" here so everyone can access it */
int cur_store_feat;
* @param store_idx 店舗ID
* @return 店舗の最大スロット数
*/
-s16b store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
+int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
{
switch (store_idx) {
case STORE_HOME:
extern int store_bottom;
extern int xtra_stock;
extern const owner_type *ot_ptr;
-extern s16b old_town_num;
-extern s16b inner_town_num;
+extern int16_t old_town_num;
+extern int16_t inner_town_num;
extern int cur_store_feat;
extern bool allow_inc;
typedef struct player_type player_type;
-s16b store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup = true);
+int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup = true);
void store_shuffle(player_type *player_ptr, int which);
void store_maintenance(player_type *player_ptr, int town_num, int store_num, int chance);
void store_init(int town_num, int store_num);
#include "system/alloc-entries.h"
/* The size of "alloc_race_table" (at most max_r_idx) */
-s16b alloc_race_size;
+int16_t alloc_race_size;
/* The entries in the "race allocator table" */
alloc_entry *alloc_race_table;
/* The size of "alloc_kind_table" (at most max_k_idx * 4) */
-s16b alloc_kind_size;
+int16_t alloc_kind_size;
/* The entries in the "kind allocator table" */
alloc_entry *alloc_kind_table;
#include "system/angband.h"
#include "system/alloc-entry-definition.h"
-extern s16b alloc_race_size;
+extern int16_t alloc_race_size;
extern alloc_entry *alloc_race_table;
-extern s16b alloc_kind_size;
+extern int16_t alloc_kind_size;
extern alloc_entry *alloc_kind_table;
MONSTER_IDX m_max; /* Number of allocated monsters */
MONSTER_IDX m_cnt; /* Number of live monsters */
- s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
- s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
+ int16_t *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
+ int16_t mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
POSITION_IDX lite_n; //!< Array of grids lit by player lite
POSITION lite_y[LITE_MAX];
* 具体的な使用一覧はクエスト行き階段の移行先クエストID、
* 各ダンジョン入口の移行先ダンジョンID、
*/
- s16b special{};
+ int16_t special{};
FEAT_IDX mimic{}; /* Feature to mimic */
typedef int errr;
#define MAX_UCHAR 255 /*!< Maximum value storable in a "byte" (hard-coded) */
-#define MAX_SHORT 32767 /*!< Maximum value storable in a "s16b" (hard-coded) */
+#define MAX_SHORT 32767 /*!< Maximum value storable in a "int16_t" (hard-coded) */
#define MAX_NLEN 160 /*!< Maximum length of object's name */
#define MAX_MONSTER_NAME 160 /*!< モンスター名称の最大バイト数 / Max characters of monster's name */
/* Note that "signed char" is not always "defined" */
-/* So always use "s16b" to hold small signed values */
+/* So always use "int16_t" to hold small signed values */
/* A signed byte of memory */
/* typedef signed char syte; */
typedef unsigned char byte; /*!< byte型をunsighned charとして定義 / Note that unsigned values can cause math problems / An unsigned byte of memory */
static_assert(sizeof(int) == 4);
// static_assert(sizeof(long) == 8); // 将来のための予約.
-typedef int16_t s16b;
typedef uint16_t u16b;
typedef int32_t s32b;
typedef uint32_t u32b;
-typedef s16b IDX; /*!< ゲーム中のID型を定義 */
+typedef int16_t IDX; /*!< ゲーム中のID型を定義 */
-typedef s16b TOWN_IDX; /*!< ゲーム中の町ID型を定義 */
-typedef s16b FEAT_IDX; /*!< ゲーム中の地形ID型を定義 */
-typedef s16b FLOOR_IDX; /*!< ゲーム中のフロアID型を定義 */
+typedef int16_t TOWN_IDX; /*!< ゲーム中の町ID型を定義 */
+typedef int16_t FEAT_IDX; /*!< ゲーム中の地形ID型を定義 */
+typedef int16_t FLOOR_IDX; /*!< ゲーム中のフロアID型を定義 */
typedef byte SEX_IDX; /*!< ゲーム中のプレイヤー性別ID型を定義 */
-typedef s16b MIMIC_RACE_IDX; /*!< ゲーム中のプレイヤー変身種族ID型を定義 */
-typedef s16b PATRON_IDX; /*!< ゲーム中のプレイヤーパトロンID型を定義 */
+typedef int16_t MIMIC_RACE_IDX; /*!< ゲーム中のプレイヤー変身種族ID型を定義 */
+typedef int16_t PATRON_IDX; /*!< ゲーム中のプレイヤーパトロンID型を定義 */
typedef s32b ACTION_IDX; /*!< プレイヤーが現在取っている常時行動のID定義 */
-typedef s16b BACT_IDX; /*!< 町の施設処理のID定義 */
-typedef s16b BACT_RESTRICT_IDX; /*!< 町の施設処理の規制処理ID定義 */
-
-typedef s16b MONRACE_IDX; /*!< @todo monster_race_typeに差し替えて消滅させる ゲーム中のモンスター種族ID型を定義 */
-typedef s16b MONSTER_IDX; /*!< @todo monster_race_typeに差し替えて消滅させる ゲーム中のモンスター個体ID型を定義 */
-typedef s16b DUNGEON_IDX; /*!< ゲーム中のダンジョンID型を定義 */
-typedef s16b REALM_IDX; /*!< ゲーム中の魔法領域ID型を定義 */
-typedef s16b ARTIFACT_IDX; /*!< ゲーム中のアーティファクトID型を定義 */
-typedef s16b EGO_IDX; /*!< アイテムエゴのID型を定義 */
-typedef s16b ACTIVATION_IDX; /*!< アイテムの発動効果ID型を定義 */
-typedef s16b QUEST_IDX; /*!< ゲーム中のクエストID型を定義 */
+typedef int16_t BACT_IDX; /*!< 町の施設処理のID定義 */
+typedef int16_t BACT_RESTRICT_IDX; /*!< 町の施設処理の規制処理ID定義 */
+
+typedef int16_t MONRACE_IDX; /*!< @todo monster_race_typeに差し替えて消滅させる ゲーム中のモンスター種族ID型を定義 */
+typedef int16_t MONSTER_IDX; /*!< @todo monster_race_typeに差し替えて消滅させる ゲーム中のモンスター個体ID型を定義 */
+typedef int16_t DUNGEON_IDX; /*!< ゲーム中のダンジョンID型を定義 */
+typedef int16_t REALM_IDX; /*!< ゲーム中の魔法領域ID型を定義 */
+typedef int16_t ARTIFACT_IDX; /*!< ゲーム中のアーティファクトID型を定義 */
+typedef int16_t EGO_IDX; /*!< アイテムエゴのID型を定義 */
+typedef int16_t ACTIVATION_IDX; /*!< アイテムの発動効果ID型を定義 */
+typedef int16_t QUEST_IDX; /*!< ゲーム中のクエストID型を定義 */
typedef byte ROOM_IDX; /*!< 部屋のID型を定義 */
-typedef s16b INVENTORY_IDX; /*!< ゲーム中の所持品ID型を定義 */
-typedef s16b OBJECT_IDX; /*!< ゲーム中のアイテムID型を定義 */
+typedef int16_t INVENTORY_IDX; /*!< ゲーム中の所持品ID型を定義 */
+typedef int16_t OBJECT_IDX; /*!< ゲーム中のアイテムID型を定義 */
typedef s32b ESSENCE_IDX; /*!< 鍛冶エッセンスのID型 */
-typedef s16b KIND_OBJECT_IDX; /*!< ゲーム中のベースアイテムID型を定義 */
-typedef s16b VAULT_IDX; /*!< 固定部屋のID型を定義 */
+typedef int16_t KIND_OBJECT_IDX; /*!< ゲーム中のベースアイテムID型を定義 */
+typedef int16_t VAULT_IDX; /*!< 固定部屋のID型を定義 */
typedef int MUTATION_IDX; /*!< 突然変異のID型を定義 */
typedef s32b POSITION; /*!< ゲーム中の座標型を定義 */
-typedef s16b POSITION_IDX; /*!< ゲーム中の座標リストID型 */
+typedef int16_t POSITION_IDX; /*!< ゲーム中の座標リストID型 */
typedef byte FEAT_SUBTYPE; /*!< 地形情報の副値 (トラップ種別/パターン種別/店舗種別)*/
*/
typedef s32b MANA_POINT; /*!< ゲーム中のMP型を定義 */
-typedef s16b HIT_PROB; /*!< ゲーム中の装備命中修正値を定義 */
-typedef s16b BASE_STATUS; /*!< ゲーム中の基礎能力値型を定義 */
+typedef int16_t HIT_PROB; /*!< ゲーム中の装備命中修正値を定義 */
+typedef int16_t BASE_STATUS; /*!< ゲーム中の基礎能力値型を定義 */
typedef s32b MONSTER_NUMBER; /*!< ゲーム中のモンスター数型を定義 */
typedef s32b ITEM_NUMBER; /*!< ゲーム中のアイテム数型を定義 */
-typedef s16b ACTION_ENERGY; /*!< ゲーム中の行動エネルギー型を定義 */
-typedef s16b ARMOUR_CLASS; /*!< ゲーム中の行動アーマークラス型を定義 */
-typedef s16b TIME_EFFECT; /*!< ゲーム中の時限期間の型を定義 */
+typedef int16_t ACTION_ENERGY; /*!< ゲーム中の行動エネルギー型を定義 */
+typedef int16_t ARMOUR_CLASS; /*!< ゲーム中の行動アーマークラス型を定義 */
+typedef int16_t TIME_EFFECT; /*!< ゲーム中の時限期間の型を定義 */
typedef byte DISCOUNT_RATE; /*!< ゲーム中の値引き率の型を定義 */
-typedef s16b SPEED; /*!< ゲーム中の加速値の型定義 */
+typedef int16_t SPEED; /*!< ゲーム中の加速値の型定義 */
/*!
- * @var typedef s16b ENEGRY
+ * @var typedef int16_t ENEGRY
* @brief 行動エネルギーの型定義
* @details
* ENERGYはプレイヤーとモンスターの行動順を定める行動エネルギーを示す型定義である。
*/
-typedef s16b ENERGY; /*!< ゲーム中の行動エネルギーの型定義 */
+typedef int16_t ENERGY; /*!< ゲーム中の行動エネルギーの型定義 */
-typedef s16b SLEEP_DEGREE; /*!< モンスターの睡眠度の型定義 */
+typedef int16_t SLEEP_DEGREE; /*!< モンスターの睡眠度の型定義 */
-typedef s16b PLAYER_LEVEL; /*!< ゲーム中のプレイヤーレベルの型を定義 */
+typedef int16_t PLAYER_LEVEL; /*!< ゲーム中のプレイヤーレベルの型を定義 */
typedef int DIRECTION; /*!< ゲーム中の方角の型定義 */
typedef s32b EXP; /*!< ゲーム中の主経験値の型定義 */
-typedef s16b SUB_EXP; /*!< ゲーム中の副経験値の型定義 */
+typedef int16_t SUB_EXP; /*!< ゲーム中の副経験値の型定義 */
typedef s32b OBJECT_SUBTYPE_VALUE; /*!< ゲーム中のアイテム副分類の型定義 */
-typedef s16b PARAMETER_VALUE; /*!< ゲーム中のアイテム能力値の型定義 */
+typedef int16_t PARAMETER_VALUE; /*!< ゲーム中のアイテム能力値の型定義 */
typedef s32b WEIGHT; /*!< ゲーム中の重量の型定義(ポンド) */
typedef int DICE_NUMBER; /*!< ゲーム中のダイス数の型定義 */
typedef int DICE_SID; /*!< ゲーム中のダイス面の型定義 */
typedef s32b PRICE; /*!< ゲーム中の金額価値の型定義 */
-typedef s16b FEED; /*!< ゲーム中の滋養度の型定義 */
+typedef int16_t FEED; /*!< ゲーム中の滋養度の型定義 */
typedef u32b STR_OFFSET; /*!< テキストオフセットの型定義 */
typedef u32b REAL_TIME; /*!< 実時刻の型定義 */
typedef s32b PERCENTAGE; /*!< ゲーム中のパーセント表記の型定義(/100倍) */
-typedef s16b MULTIPLY; /*!< ゲーム中の倍率の型定義(/10倍) */
+typedef int16_t MULTIPLY; /*!< ゲーム中の倍率の型定義(/10倍) */
typedef u32b BIT_FLAGS; /*!< 32ビットのフラグ配列の型定義 */
typedef u16b BIT_FLAGS16; /*!< 16ビットのフラグ配列の型定義 */
typedef byte BIT_FLAGS8; /*!< 8ビットのフラグ配列の型定義 */
-typedef s16b XTRA16; /*!< 汎用変数16ビットの型定義 */
+typedef int16_t XTRA16; /*!< 汎用変数16ビットの型定義 */
typedef byte XTRA8; /*!< 汎用変数8ビットの型定義 */
-typedef s16b COMMAND_CODE; /*!< コマンド内容の型定義 */
-typedef s16b COMMAND_ARG; /*!< コマンド引数の型定義 */
-typedef s16b COMMAND_NUM; /*!< コマンド数の型定義 */
+typedef int16_t COMMAND_CODE; /*!< コマンド内容の型定義 */
+typedef int16_t COMMAND_ARG; /*!< コマンド引数の型定義 */
+typedef int16_t COMMAND_NUM; /*!< コマンド数の型定義 */
typedef int TERM_LEN; /*!< コンソール表示座標の型定義 */
typedef byte TERM_COLOR; /*!< テキスト表示色の型定義 */
typedef char SYMBOL_CODE; /*!< キャラの文字の型定義 */
typedef s32b SPELL_IDX; /*!< 各魔法領域/職業能力ごとの呪文ID型定義 */
-typedef s16b PROB; /*!< 確率の重みの型定義 */
+typedef int16_t PROB; /*!< 確率の重みの型定義 */
typedef byte FEAT_POWER; /*!< 地形強度の型定義 */
typedef int QUANTITY; /*!< インターフェース上の指定個数 */
typedef int EFFECT_ID; /*!< 効果属性ID */
-typedef s16b QUEST_TYPE; /*!< クエストの種別ID */
-typedef s16b QUEST_STATUS; /*!< クエストの状態ID */
+typedef int16_t QUEST_TYPE; /*!< クエストの種別ID */
+typedef int16_t QUEST_STATUS; /*!< クエストの状態ID */
-typedef s16b ACTION_SKILL_POWER; /*!< 行動技能値 */
+typedef int16_t ACTION_SKILL_POWER; /*!< 行動技能値 */
typedef int PET_COMMAND_IDX; /*!< ペットへの指示ID */
typedef byte FF_FLAGS_IDX; /*!< 地形特性ID */
-typedef s16b FEAT_PRIORITY; /*!< 地形の縮小表示優先順位 */
+typedef int16_t FEAT_PRIORITY; /*!< 地形の縮小表示優先順位 */
enum process_result {
PROCESS_FALSE = 0,
* characters (such as Amberite Paladins)
*/
- s16b age{}; /* Characters age */
- s16b ht{}; /* Height */
- s16b wt{}; /* Weight */
- s16b sc{}; /* Social Class */
+ int16_t age{}; /* Characters age */
+ int16_t ht{}; /* Height */
+ int16_t wt{}; /* Weight */
+ int16_t sc{}; /* Social Class */
PRICE au{}; /* Current Gold */
PLAYER_LEVEL lev{}; /* Level */
TOWN_IDX town_num{}; /* Current town number */
- s16b arena_number{}; /* monster number in on_defeat_arena_monster -KMW- */
+ int16_t arena_number{}; /* monster number in on_defeat_arena_monster -KMW- */
bool phase_out{}; /*!< フェイズアウト状態(闘技場観戦状態などに利用、NPCの処理の対象にならず自身もほとんどの行動ができない) */
DUNGEON_IDX dungeon_idx{}; /* current dungeon index */
MANA_POINT csp{}; /* Cur mana pts */
u32b csp_frac{}; /* Cur mana frac (times 2^16) */
- s16b max_plv{}; /* Max Player Level */
+ int16_t max_plv{}; /* Max Player Level */
BASE_STATUS stat_max[A_MAX]{}; /* Current "maximal" stat values */
BASE_STATUS stat_max_max[A_MAX]{}; /* Maximal "maximal" stat values */
BASE_STATUS stat_cur[A_MAX]{}; /* Current "natural" stat values */
- s16b learned_spells{};
- s16b add_spells{};
+ int16_t learned_spells{};
+ int16_t add_spells{};
u32b count{};
EnumClassFlagGroup<MUTA> muta{}; /*!< 突然変異 / mutations */
- s16b virtues[8]{};
- s16b vir_types[8]{};
+ int16_t virtues[8]{};
+ int16_t vir_types[8]{};
TIME_EFFECT word_recall{}; /* Word of recall counter */
TIME_EFFECT alter_reality{}; /* Alter reality counter */
RF_ABILITY mane_spell[MAX_MANE]{};
HIT_POINT mane_dam[MAX_MANE]{};
- s16b mane_num{};
+ int16_t mane_num{};
bool new_mane{};
#define CONCENT_RADAR_THRESHOLD 2
#define CONCENT_TELE_THRESHOLD 5
- s16b concent{}; /* Sniper's concentration level */
+ int16_t concent{}; /* Sniper's concentration level */
HIT_POINT player_hp[PY_MAX_LEVEL]{};
char died_from[MAX_MONSTER_NAME]{}; /* What killed the player */
player_race_type start_race{}; /* Race at birth */
BIT_FLAGS old_race1{}; /* Record of race changes */
BIT_FLAGS old_race2{}; /* Record of race changes */
- s16b old_realm{}; /* Record of realm changes */
+ int16_t old_realm{}; /* Record of realm changes */
- s16b pet_follow_distance{}; /* Length of the imaginary "leash" for pets */
+ int16_t pet_follow_distance{}; /* Length of the imaginary "leash" for pets */
BIT_FLAGS16 pet_extra_flags{}; /* Various flags for controling pets */
MONSTER_IDX today_mon{}; //!< 日替わり賞金首を知っていればそのモンスターID、知らなければ 0
s32b feeling_turn{}; /* The turn of the last dungeon feeling */
object_type *inventory_list{}; /* The player's inventory */
- s16b inven_cnt{}; /* Number of items in inventory */
- s16b equip_cnt{}; /* Number of items in equipment */
+ int16_t inven_cnt{}; /* Number of items in inventory */
+ int16_t equip_cnt{}; /* Number of items in equipment */
/*** Temporary fields ***/
KIND_OBJECT_IDX object_kind_idx{}; /* Object kind trackee */
- s16b new_spells{}; /* Number of spells available */
- s16b old_spells{};
+ int16_t new_spells{}; /* Number of spells available */
+ int16_t old_spells{};
- s16b old_food_aux{}; /* Old value of food */
+ int16_t old_food_aux{}; /* Old value of food */
bool old_cumber_armor{};
bool old_cumber_glove{};
BIT_FLAGS update{}; /* Pending Updates */
BIT_FLAGS redraw{}; /* Normal Redraws */
BIT_FLAGS window_flags{}; /* Window Redraws */
- s16b stat_use[A_MAX]{}; /* Current modified stats */
- s16b stat_top[A_MAX]{}; /* Maximal modified stats */
+ int16_t stat_use[A_MAX]{}; /* Current modified stats */
+ int16_t stat_top[A_MAX]{}; /* Maximal modified stats */
bool sutemi{};
bool counter{};
/*** Extracted fields ***/
- s16b running{}; /* Current counter for running, if any */
+ int16_t running{}; /* Current counter for running, if any */
bool suppress_multi_reward{}; /*!< 複数レベルアップ時のパトロンからの報酬多重受け取りを防止 */
- s16b stat_add[A_MAX]{}; /* Modifiers to stat values */
- s16b stat_index[A_MAX]{}; /* Indexes into stat tables */
+ int16_t stat_add[A_MAX]{}; /* Modifiers to stat values */
+ int16_t stat_index[A_MAX]{}; /* Indexes into stat tables */
bool hack_mutation{};
bool is_fired{};
ARMOUR_CLASS dis_to_a{}; /*!< 判明している現在の表記上の装備AC修正値 / Known bonus to ac */
ARMOUR_CLASS dis_ac{}; /*!< 判明している現在の表記上の装備AC基礎値 / Known base ac */
- s16b to_h[2]{}; /* Bonus to hit (wield) */
- s16b to_h_b{}; /* Bonus to hit (bow) */
- s16b to_h_m{}; /* Bonus to hit (misc) */
- s16b to_d[2]{}; /* Bonus to dam (wield) */
- s16b to_d_m{}; /* Bonus to dam (misc) */
+ int16_t to_h[2]{}; /* Bonus to hit (wield) */
+ int16_t to_h_b{}; /* Bonus to hit (bow) */
+ int16_t to_h_m{}; /* Bonus to hit (misc) */
+ int16_t to_d[2]{}; /* Bonus to dam (wield) */
+ int16_t to_d_m{}; /* Bonus to dam (misc) */
ARMOUR_CLASS to_a{}; /* Bonus to ac */
- s16b to_m_chance{}; /* Minusses to cast chance */
+ int16_t to_m_chance{}; /* Minusses to cast chance */
bool no_flowed{};
ACTION_SKILL_POWER skill_tht{}; /*!< 行動技能値:投射命中能力 / Skill: To hit (throwing) */
ACTION_SKILL_POWER skill_dig{}; /*!< 行動技能値:掘削 / Skill: Digging */
- s16b num_blow[2]{}; /* Number of blows */
- s16b num_fire{}; /* Number of shots */
+ int16_t num_blow[2]{}; /* Number of blows */
+ int16_t num_fire{}; /* Number of shots */
byte tval_xtra{}; /* (Unused)Correct xtra tval */
byte tval_ammo{}; /* Correct ammo tval */
- s16b pspeed{}; /*!< 現在の速度 / Current speed */
+ int16_t pspeed{}; /*!< 現在の速度 / Current speed */
ENERGY energy_use{}; /*!< 直近のターンに消費したエネルギー / Energy use this turn */
#include "locale/english.h"
#endif
-static const s16b CONTINUOUS_DESCRIPTION = 256;
+static const int16_t CONTINUOUS_DESCRIPTION = 256;
bool show_gold_on_floor = false;
return CONTINUOUS_DESCRIPTION;
}
-static bool within_char_util(s16b input)
+static bool within_char_util(int16_t input)
{
return (input > -127) && (input < 128);
}
-static s16b describe_grid(player_type *subject_ptr, eg_type *eg_ptr)
+static int16_t describe_grid(player_type *subject_ptr, eg_type *eg_ptr)
{
if ((eg_ptr->g_ptr->m_idx == 0) || !subject_ptr->current_floor_ptr->m_list[eg_ptr->g_ptr->m_idx].ml)
return CONTINUOUS_DESCRIPTION;
return CONTINUOUS_DESCRIPTION;
}
-static s16b describe_footing(player_type *subject_ptr, eg_type *eg_ptr)
+static int16_t describe_footing(player_type *subject_ptr, eg_type *eg_ptr)
{
if (eg_ptr->floor_num != 1)
return CONTINUOUS_DESCRIPTION;
return eg_ptr->query;
}
-static s16b describe_footing_items(eg_type *eg_ptr)
+static int16_t describe_footing_items(eg_type *eg_ptr)
{
if (!eg_ptr->boring)
return CONTINUOUS_DESCRIPTION;
}
}
-static s16b loop_describing_grid(player_type *subject_ptr, eg_type *eg_ptr)
+static int16_t loop_describing_grid(player_type *subject_ptr, eg_type *eg_ptr)
{
if (eg_ptr->floor_num == 0)
return CONTINUOUS_DESCRIPTION;
int min_width = 0;
while (true) {
- s16b footing_description = describe_footing(subject_ptr, eg_ptr);
+ int16_t footing_description = describe_footing(subject_ptr, eg_ptr);
if (within_char_util(footing_description))
return (char)footing_description;
- s16b footing_descriptions = describe_footing_items(eg_ptr);
+ int16_t footing_descriptions = describe_footing_items(eg_ptr);
if (within_char_util(footing_descriptions))
return (char)footing_descriptions;
}
}
-static s16b describe_footing_sight(player_type *subject_ptr, eg_type *eg_ptr, object_type *o_ptr)
+static int16_t describe_footing_sight(player_type *subject_ptr, eg_type *eg_ptr, object_type *o_ptr)
{
if ((o_ptr->marked & OM_FOUND) == 0)
return CONTINUOUS_DESCRIPTION;
return CONTINUOUS_DESCRIPTION;
}
-static s16b sweep_footing_items(player_type *subject_ptr, eg_type *eg_ptr)
+static int16_t sweep_footing_items(player_type *subject_ptr, eg_type *eg_ptr)
{
for (const auto this_o_idx : eg_ptr->g_ptr->o_idx_list) {
object_type *o_ptr;
o_ptr = &subject_ptr->current_floor_ptr->o_list[this_o_idx];
- s16b ret = describe_footing_sight(subject_ptr, eg_ptr, o_ptr);
+ int16_t ret = describe_footing_sight(subject_ptr, eg_ptr, o_ptr);
if (within_char_util(ret))
return (char)ret;
}
break;
}
- s16b description_grid = describe_grid(subject_ptr, eg_ptr);
+ int16_t description_grid = describe_grid(subject_ptr, eg_ptr);
if (within_char_util(description_grid))
return (char)description_grid;
- s16b loop_description = loop_describing_grid(subject_ptr, eg_ptr);
+ int16_t loop_description = loop_describing_grid(subject_ptr, eg_ptr);
if (within_char_util(loop_description))
return (char)loop_description;
- s16b footing_items_description = sweep_footing_items(subject_ptr, eg_ptr);
+ int16_t footing_items_description = sweep_footing_items(subject_ptr, eg_ptr);
if (within_char_util(footing_items_description))
return (char)footing_items_description;
/*
* The normal distribution table for the "randnor()" function (below)
*/
-static s16b randnor_table[RANDNOR_NUM] =
+static int16_t randnor_table[RANDNOR_NUM] =
{
206, 613, 1022, 1430, 1838, 2245, 2652, 3058,
3463, 3867, 4271, 4673, 5075, 5475, 5874, 6271,
*
* Note that the binary search takes up to 16 quick iterations.
*/
-s16b randnor(int mean, int stand)
+int16_t randnor(int mean, int stand)
{
- s16b tmp;
- s16b offset;
+ int16_t tmp;
+ int16_t offset;
- s16b low = 0;
- s16b high = RANDNOR_NUM;
+ int16_t low = 0;
+ int16_t high = RANDNOR_NUM;
if (stand < 1)
- return (s16b)(mean);
+ return (int16_t)(mean);
/* Roll for probability */
- tmp = (s16b)randint0(32768);
+ tmp = (int16_t)randint0(32768);
/* Binary Search */
while (low < high) {
/* Move left otherwise */
else {
- high = (s16b)mid;
+ high = (int16_t)mid;
}
}
/*
* Generates damage for "2d6" style dice rolls
*/
-s16b damroll(DICE_NUMBER num, DICE_SID sides)
+int16_t damroll(DICE_NUMBER num, DICE_SID sides)
{
int i, sum = 0;
for (i = 0; i < num; i++)
sum += randint1(sides);
- return (s16b)(sum);
+ return (int16_t)(sum);
}
/*
* Same as above, but always maximal
*/
-s16b maxroll(DICE_NUMBER num, DICE_SID sides) { return (num * sides); }
+int16_t maxroll(DICE_NUMBER num, DICE_SID sides) { return (num * sides); }
/*
* Given a numerator and a denominator, supply a properly rounded result,
void Rand_state_backup(u32b *backup_state);
void Rand_state_restore(u32b *backup_state);
s32b Rand_div(s32b m);
-s16b randnor(int mean, int stand);
-s16b damroll(DICE_NUMBER num, DICE_SID sides);
-s16b maxroll(DICE_NUMBER num, DICE_SID sides);
+int16_t randnor(int mean, int stand);
+int16_t damroll(DICE_NUMBER num, DICE_SID sides);
+int16_t maxroll(DICE_NUMBER num, DICE_SID sides);
s32b div_round(s32b n, s32b d);
s32b Rand_external(s32b m);
bool next_bool();
hooked_roff(format(_("%^sは AC%d の防御力と", "%^s has an armor rating of %d"), Who::who(lore_ptr->msex), lore_ptr->r_ptr->ac));
if ((lore_ptr->flags1 & RF1_FORCE_MAXHP) || (lore_ptr->r_ptr->hside == 1)) {
u32b hp = lore_ptr->r_ptr->hdice * (lore_ptr->nightmare ? 2 : 1) * lore_ptr->r_ptr->hside;
- hooked_roff(format(_(" %d の体力がある。", " and a life rating of %d. "), (s16b)MIN(30000, hp)));
+ hooked_roff(format(_(" %d の体力がある。", " and a life rating of %d. "), (int16_t)MIN(30000, hp)));
} else {
hooked_roff(format(
_(" %dd%d の体力がある。", " and a life rating of %dd%d. "), lore_ptr->r_ptr->hdice * (lore_ptr->nightmare ? 2 : 1), lore_ptr->r_ptr->hside));
TERM_LEN w, h;
term_get_size(&w, &h);
for (int i = 0; i < h; i++) {
- term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
+ term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((int16_t)i));
TERM_LEN x, y;
term_locate(&x, &y);
term_erase(x, y, 255);
*/
void health_redraw(player_type *creature_ptr, bool riding)
{
- s16b health_who;
+ int16_t health_who;
int row, col;
if (riding) {
for (auto i = 1; i < max_r_idx; i++) {
monster_race *r_ptr = &r_info[i];
if (!r_ptr->name.empty())
- who[n++] = (s16b)i;
+ who[n++] = (int16_t)i;
}
ang_sort(&dummy, who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
}
fprintf(spoiler_file, "\n");
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
return ferror(spoiler_file) || angband_fclose(spoiler_file) ? spoiler_output_status::SPOILER_OUTPUT_FAIL_FCLOSE
: spoiler_output_status::SPOILER_OUTPUT_SUCCESS;
}
for (int i = 1; i < max_r_idx; i++) {
monster_race *r_ptr = &r_info[i];
if (!r_ptr->name.empty())
- who[n++] = (s16b)i;
+ who[n++] = (int16_t)i;
}
u16b why = 2;
spoil_out(NULL);
}
- C_KILL(who, max_r_idx, s16b);
+ C_KILL(who, max_r_idx, int16_t);
return ferror(spoiler_file) || angband_fclose(spoiler_file) ? spoiler_output_status::SPOILER_OUTPUT_FAIL_FCLOSE
: spoiler_output_status::SPOILER_OUTPUT_SUCCESS;
}
if (!get_string(p, tmp_val, 5))
return;
- o_ptr->pval = clamp_cast<s16b>(atoi(tmp_val));
+ o_ptr->pval = clamp_cast<int16_t>(atoi(tmp_val));
wiz_display_item(player_ptr, o_ptr);
p = "Enter new 'to_a' setting: ";
sprintf(tmp_val, "%d", o_ptr->to_a);
if (!get_string(p, tmp_val, 5))
return;
- o_ptr->to_a = clamp_cast<s16b>(atoi(tmp_val));
+ o_ptr->to_a = clamp_cast<int16_t>(atoi(tmp_val));
wiz_display_item(player_ptr, o_ptr);
p = "Enter new 'to_h' setting: ";
sprintf(tmp_val, "%d", o_ptr->to_h);
if (!get_string(p, tmp_val, 5))
return;
- o_ptr->to_h = clamp_cast<s16b>(atoi(tmp_val));
+ o_ptr->to_h = clamp_cast<int16_t>(atoi(tmp_val));
wiz_display_item(player_ptr, o_ptr);
p = "Enter new 'to_d' setting: ";
sprintf(tmp_val, "%d", (int)o_ptr->to_d);
if (!get_string(p, tmp_val, 5))
return;
- o_ptr->to_d = clamp_cast<s16b>(atoi(tmp_val));
+ o_ptr->to_d = clamp_cast<int16_t>(atoi(tmp_val));
wiz_display_item(player_ptr, o_ptr);
}
if (!get_string(_("熟練度: ", "Proficiency: "), tmp_val, 4))
return;
- s16b tmp_s16b = (s16b)atoi(tmp_val);
+ int16_t tmp_s16b = (int16_t)atoi(tmp_val);
if (tmp_s16b < WEAPON_EXP_UNSKILLED)
tmp_s16b = WEAPON_EXP_UNSKILLED;
tmp_mimic = max_f_idx - 1;
cave_set_feat(creature_ptr, y, x, tmp_feat);
- g_ptr->mimic = (s16b)tmp_mimic;
+ g_ptr->mimic = (int16_t)tmp_mimic;
feature_type *f_ptr;
f_ptr = &f_info[g_ptr->get_feat_mimic()];