From 4c52796ea9be62e3ae97bc072654a040f22f52ab Mon Sep 17 00:00:00 2001 From: Habu Date: Sat, 6 Mar 2021 22:40:24 +0900 Subject: [PATCH] =?utf8?q?[feature]=20=E3=82=BD=E3=83=BC=E3=82=B9=E3=83=95?= =?utf8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92C++=E3=81=AB=E5=AF=BE?= =?utf8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 今後C++によるソースコードの記述を可能にするため、 ソースファイルをC++コンパイラでコンパイルできるように修正する。 --- Hengband/Hengband/Hengband.vcxproj | 17 ++- src/action/movement-execution.c | 4 +- src/action/racial-execution.h | 4 +- src/artifact/fixed-art-types.h | 4 +- src/artifact/random-art-bias-types.h | 4 +- src/artifact/random-art-effects.h | 4 +- src/autopick/autopick-editor-command.h | 4 +- src/autopick/autopick-entry.c | 2 +- src/autopick/autopick-finder.c | 2 +- src/birth/birth-select-class.c | 2 +- src/birth/birth-select-race.c | 2 +- src/birth/birth-util.h | 4 +- src/birth/birth-wizard.c | 6 +- src/birth/inventory-initializer.c | 10 +- src/blue-magic/blue-magic-checker.h | 2 +- src/blue-magic/blue-magic-summon.c | 6 +- src/blue-magic/learnt-info.c | 2 +- src/blue-magic/learnt-info.h | 4 +- src/blue-magic/learnt-power-getter.c | 4 +- src/cmd-action/cmd-attack.c | 2 +- src/cmd-action/cmd-mane.c | 4 +- src/cmd-action/cmd-mind.c | 12 +- src/cmd-action/cmd-open-close.c | 10 +- src/cmd-action/cmd-others.c | 2 +- src/cmd-action/cmd-pet.c | 4 +- src/cmd-action/cmd-shoot.c | 2 +- src/cmd-action/cmd-spell.c | 6 +- src/cmd-action/cmd-tunnel.c | 2 +- src/cmd-building/cmd-building.c | 10 +- src/cmd-item/cmd-destroy.c | 2 +- src/cmd-item/cmd-eat.c | 2 +- src/cmd-item/cmd-equipment.c | 14 +-- src/cmd-item/cmd-item.c | 14 +-- src/cmd-item/cmd-magiceat.c | 2 +- src/cmd-item/cmd-quaff.c | 2 +- src/cmd-item/cmd-read.c | 2 +- src/cmd-item/cmd-refill.c | 4 +- src/cmd-item/cmd-smith.c | 6 +- src/cmd-item/cmd-throw.c | 10 +- src/cmd-item/cmd-usestaff.c | 10 +- src/cmd-item/cmd-zaprod.c | 4 +- src/combat/combat-options-type.h | 4 +- src/core/player-redraw-types.h | 4 +- src/core/player-update-types.h | 4 +- src/core/scores.c | 22 ++-- src/core/show-file.c | 2 +- src/core/visuals-reseter.c | 4 +- src/core/window-redrawer.c | 4 +- src/core/window-redrawer.h | 4 +- src/dungeon/dungeon-flag-types.h | 4 +- src/dungeon/dungeon-processor.c | 2 +- src/effect/effect-characteristics.h | 4 +- src/effect/effect-monster-charm.h | 2 +- src/effect/effect-monster-curse.h | 2 +- src/effect/effect-monster-evil.h | 2 +- src/effect/effect-monster-lite-dark.h | 2 +- src/effect/effect-monster-oldies.h | 2 +- src/effect/effect-monster-psi.h | 2 +- src/effect/effect-monster-resist-hurt.h | 2 +- src/effect/effect-monster-spirit.h | 2 +- src/effect/effect-monster-switcher.c | 4 +- src/effect/effect-monster-switcher.h | 2 +- src/effect/effect-monster.c | 5 +- src/effect/effect-player.c | 6 +- src/flavor/object-flavor-types.h | 4 +- src/floor/cave.h | 2 +- src/floor/fixed-map-generator.c | 6 +- src/floor/fixed-map-generator.h | 2 +- src/floor/floor-allocation-types.h | 8 +- src/floor/floor-generator.c | 4 +- src/floor/floor-mode-changer.h | 4 +- src/floor/object-allocator.h | 2 +- src/floor/object-scanner.h | 4 +- src/floor/wild.c | 16 +-- src/floor/wild.h | 8 +- src/game-option/cheat-types.h | 4 +- src/game-option/keymap-directory-getter.h | 4 +- src/grid/feature-flag-types.h | 4 +- src/grid/grid.h | 4 +- src/grid/trap.c | 4 +- src/info-reader/fixed-map-parser.c | 4 +- src/info-reader/fixed-map-parser.h | 2 +- src/info-reader/general-parser.c | 24 ++-- src/info-reader/general-parser.h | 6 +- src/info-reader/magic-reader.c | 2 +- src/info-reader/parse-error-types.h | 4 +- src/info-reader/random-grid-effect-types.h | 4 +- src/inventory/floor-item-getter.c | 12 +- src/inventory/inventory-curse.c | 6 +- src/inventory/inventory-slot-types.h | 4 +- src/inventory/item-getter.c | 10 +- src/inventory/player-inventory.c | 2 +- src/io-dump/character-dump.c | 2 +- src/io-dump/random-art-info-dumper.c | 2 +- src/io-dump/special-class-dump.c | 4 +- src/io/inet.c | 2 +- src/io/input-key-requester.c | 6 +- src/io/record-play-movie.c | 2 +- src/io/report.c | 8 +- src/knowledge/knowledge-inventory.c | 10 +- src/knowledge/knowledge-monsters.c | 2 +- src/load/load-v1-5-0.c | 2 +- src/load/load-v1-5-0.h | 8 +- src/load/load-zangband.c | 8 +- src/load/old-feature-types.h | 4 +- src/load/savedata-flag-types.h | 8 +- src/load/world-loader.c | 2 +- src/locale/japanese.c | 4 +- src/lore/lore-calculator.c | 2 +- src/lore/lore-calculator.h | 2 +- src/lore/lore-util.h | 8 +- src/maid-x11.c | 2 +- src/main-win.c | 40 +++--- src/main-x11.c | 30 ++--- src/main/info-initializer.c | 26 ++-- src/main/music-definitions-table.h | 4 +- src/main/sound-definitions-table.h | 4 +- src/market/arena-info-table.c | 4 +- src/market/articles-on-sale.c | 192 ++++++++++++++--------------- src/market/building-actions-table.h | 4 +- src/market/building-craft-fix.c | 6 +- src/market/building-craft-weapon.c | 4 +- src/market/building-initializer.c | 8 +- src/market/building-quest.c | 4 +- src/market/building-recharger.c | 2 +- src/melee/melee-switcher.c | 3 +- src/melee/melee-switcher.h | 4 +- src/mind/drs-types.h | 4 +- src/mind/mind-archer.c | 8 +- src/mind/mind-berserker.c | 2 +- src/mind/mind-berserker.h | 2 +- src/mind/mind-blue-mage.h | 4 +- src/mind/mind-force-trainer.h | 2 +- src/mind/mind-mage.c | 2 +- src/mind/mind-magic-eater.c | 2 +- src/mind/mind-mindcrafter.c | 11 +- src/mind/mind-mindcrafter.h | 2 +- src/mind/mind-mirror-master.h | 2 +- src/mind/mind-ninja.c | 2 +- src/mind/mind-ninja.h | 2 +- src/mind/mind-numbers.h | 20 +-- src/mind/mind-priest.c | 2 +- src/mind/mind-types.h | 4 +- src/mind/mind-warrior.c | 4 +- src/mind/monk-attack.c | 6 +- src/mind/snipe-types.h | 4 +- src/monster-attack/monster-attack-effect.h | 4 +- src/monster-attack/monster-attack-types.h | 4 +- src/monster-floor/monster-generator.h | 2 +- src/monster-floor/monster-lite.c | 2 +- src/monster-floor/monster-summon.c | 6 +- src/monster-floor/monster-summon.h | 2 +- src/monster-floor/place-monster-types.h | 4 +- src/monster-race/race-flags-ability1.h | 4 +- src/monster-race/race-flags-ability2.h | 4 +- src/monster-race/race-flags-resistance.h | 4 +- src/monster-race/race-flags1.h | 4 +- src/monster-race/race-flags2.h | 4 +- src/monster-race/race-flags3.h | 4 +- src/monster-race/race-flags4.h | 4 +- src/monster-race/race-flags7.h | 4 +- src/monster-race/race-flags8.h | 4 +- src/monster-race/race-flags9.h | 4 +- src/monster-race/race-indice-types.h | 4 +- src/monster/monster-description-types.h | 4 +- src/monster/monster-flag-types.h | 8 +- src/monster/monster-processor.c | 2 +- src/monster/monster-timed-effect-types.h | 4 +- src/monster/monster-util.c | 4 +- src/monster/monster-util.h | 2 +- src/monster/smart-learn-types.h | 4 +- src/mspell/mspell-attack-util.h | 4 +- src/mspell/mspell-damage-calculator.h | 4 +- src/mspell/mspell-special.c | 4 +- src/mspell/mspell-summon.c | 12 +- src/mspell/mspell-type.h | 4 +- src/mutation/mutation-flag-types.h | 12 +- src/mutation/mutation-processor.c | 2 +- src/mutation/mutation-techniques.c | 2 +- src/object-activation/activation-others.c | 6 +- src/object-enchant/dragon-breaths-table.c | 3 +- src/object-enchant/item-apply-magic.h | 5 +- src/object-enchant/item-feeling.h | 4 +- src/object-enchant/special-object-flags.h | 4 +- src/object-enchant/tr-types.h | 4 +- src/object-enchant/trc-types.h | 8 +- src/object-enchant/trg-types.h | 4 +- src/object-hook/hook-magic.c | 2 +- src/object-use/quaff-execution.c | 4 +- src/object-use/read-execution.c | 8 +- src/object/item-use-flags.h | 4 +- src/object/object-mark-types.h | 4 +- src/object/tval-types.h | 4 +- src/object/warning.c | 2 +- src/pet/pet-util.h | 12 +- src/player-attack/player-attack-util.h | 4 +- src/player-attack/player-attack.c | 4 +- src/player-info/base-status-types.h | 4 +- src/player/attack-defense-types.h | 8 +- src/player/patron.c | 14 +-- src/player/player-classes-types.h | 4 +- src/player/player-damage.c | 2 + src/player/player-personalities-types.h | 4 +- src/player/player-race-types.h | 4 +- src/player/player-realm.h | 4 +- src/player/player-status-flags.c | 20 +-- src/player/player-status-flags.h | 7 +- src/player/player-status-resist.h | 4 +- src/player/player-status-table.c | 48 ++++---- src/player/player-status.c | 54 ++++---- src/player/player-status.h | 7 +- src/player/process-death.c | 6 +- src/player/race-resistances.c | 2 +- src/player/special-defense-types.h | 4 +- src/player/temporary-resistances.c | 4 +- src/racial/racial-android.c | 2 +- src/racial/racial-switcher.c | 6 +- src/realm/realm-arcane.c | 2 +- src/realm/realm-craft.c | 2 +- src/realm/realm-death.c | 4 +- src/realm/realm-hex-numbers.h | 4 +- src/realm/realm-hex.c | 6 +- src/realm/realm-hissatsu.c | 18 +-- src/realm/realm-life.c | 4 +- src/realm/realm-nature.c | 2 +- src/realm/realm-song-numbers.h | 4 +- src/realm/realm-sorcery.c | 4 +- src/realm/realm-trump.c | 12 +- src/realm/realm-types.h | 4 +- src/room/lake-types.h | 4 +- src/room/room-types.h | 4 +- src/save/save.h | 4 +- src/specific-object/chest.c | 3 +- src/specific-object/torch.c | 2 +- src/spell-kind/blood-curse.c | 2 +- src/spell-kind/magic-item-recharger.c | 2 +- src/spell-kind/spells-curse-removal.c | 2 +- src/spell-kind/spells-enchant.c | 4 +- src/spell-kind/spells-perception.c | 4 +- src/spell-kind/spells-random.c | 4 +- src/spell-kind/spells-teleport.c | 2 +- src/spell-realm/spells-nature.c | 2 +- src/spell-realm/spells-sorcery.c | 2 +- src/spell-realm/spells-trump.c | 4 +- src/spell/spell-types.h | 4 +- src/spell/spells-object.c | 10 +- src/spell/spells-summon.c | 8 +- src/spell/spells-summon.h | 4 +- src/spell/spells-util.h | 21 ++-- src/spell/summon-types.h | 4 +- src/status/shape-changer.c | 4 +- src/store/sell-order.c | 2 +- src/sv-definition/sv-amulet-types.h | 4 +- src/sv-definition/sv-armor-types.h | 12 +- src/sv-definition/sv-bow-types.h | 4 +- src/sv-definition/sv-digging-types.h | 4 +- src/sv-definition/sv-food-types.h | 4 +- src/sv-definition/sv-lite-types.h | 4 +- src/sv-definition/sv-potion-types.h | 4 +- src/sv-definition/sv-protector-types.h | 24 ++-- src/sv-definition/sv-ring-types.h | 4 +- src/sv-definition/sv-rod-types.h | 4 +- src/sv-definition/sv-scroll-types.h | 4 +- src/sv-definition/sv-staff-types.h | 4 +- src/sv-definition/sv-wand-types.h | 4 +- src/sv-definition/sv-weapon-types.h | 12 +- src/system/angband-version.c | 4 +- src/system/game-option-types.h | 4 +- src/system/h-type.h | 6 +- src/system/system-variables.h | 4 +- src/target/target-describer.c | 4 +- src/target/target-describer.h | 2 +- src/target/target-setter.c | 2 +- src/target/target-setter.h | 2 +- src/target/target-types.h | 4 +- src/term/readdib.c | 8 +- src/term/term-color-types.h | 4 +- src/term/z-term.c | 2 +- src/view/display-characteristic.c | 8 +- src/view/display-inventory.c | 2 +- src/view/display-player-stat-info.c | 2 +- src/view/display-player.c | 2 +- src/view/display-self-info.c | 2 +- src/view/status-bars-table.h | 4 +- src/window/display-sub-windows.c | 2 +- src/wizard/cmd-wizard.c | 6 +- src/wizard/monster-info-spoiler.h | 3 +- src/wizard/spoiler-table.c | 4 +- src/wizard/spoiler-table.h | 4 +- src/wizard/spoiler-util.h | 4 +- src/wizard/wizard-item-modifier.c | 8 +- src/wizard/wizard-special-process.c | 8 +- src/wizard/wizard-spells.c | 4 +- src/wizard/wizard-spells.h | 2 +- 294 files changed, 907 insertions(+), 870 deletions(-) diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index e0bdbdb13..e8856b8ab 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -108,11 +108,13 @@ MultiThreadedDebug EnableAllWarnings EditAndContinue - CompileAsC - 4061;4062;4127;4244;4255;4668;4710;4820;4996;4774;5045;%(DisableSpecificWarnings) + CompileAsCpp + 4061;4062;4127;4244;4255;4365;4514;4668;4710;4820;4996;4774;5045;%(DisableSpecificWarnings) true true ..\..\src;curl\include;%(AdditionalIncludeDirectories) + stdcpplatest + SyncCThrow true @@ -133,10 +135,12 @@ MultiThreadedDebugDLL Level4 EditAndContinue - CompileAsC + CompileAsCpp 4127;4996;4244;%(DisableSpecificWarnings) true ..\..\src;curl\include;%(AdditionalIncludeDirectories) + SyncCThrow + stdcpplatest true @@ -157,7 +161,9 @@ None true true - CompileAsC + CompileAsCpp + SyncCThrow + stdcpplatest MachineX86 @@ -181,6 +187,9 @@ 4244;4996;%(DisableSpecificWarnings) true ..\..\src;curl\include;%(AdditionalIncludeDirectories) + SyncCThrow + stdcpplatest + CompileAsCpp winmm.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;Normaliz.lib;curl\x86 Release\libcurl_a.lib;%(AdditionalDependencies) diff --git a/src/action/movement-execution.c b/src/action/movement-execution.c index e25367f9b..3ba5626f5 100644 --- a/src/action/movement-execution.c +++ b/src/action/movement-execution.c @@ -162,7 +162,7 @@ void exe_movement(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool } if ((stormbringer && (randint1(1000) > 666)) || (creature_ptr->pclass == CLASS_BERSERKER)) { - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); can_move = FALSE; } else if (monster_can_cross_terrain(creature_ptr, floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0)) { do_past = TRUE; @@ -172,7 +172,7 @@ void exe_movement(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool can_move = FALSE; } } else { - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); can_move = FALSE; } } diff --git a/src/action/racial-execution.h b/src/action/racial-execution.h index 90e3d4e58..a5d9592e1 100644 --- a/src/action/racial-execution.h +++ b/src/action/racial-execution.h @@ -2,11 +2,11 @@ #include "system/angband.h" -typedef enum racial_level_check_result { +enum racial_level_check_result { RACIAL_SUCCESS = 1, RACIAL_FAILURE = -1, RACIAL_CANCEL = 0, -} racial_level_check_result; +}; typedef struct rpi_type rpi_type; PERCENTAGE racial_chance(player_type *creature_ptr, rpi_type *rpi_ptr); diff --git a/src/artifact/fixed-art-types.h b/src/artifact/fixed-art-types.h index 794fddbfc..bb6ed34e7 100644 --- a/src/artifact/fixed-art-types.h +++ b/src/artifact/fixed-art-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum fixed_artifact_type { +enum fixed_artifact_type { ART_JUDGE = 3, ART_POWER = 13, ART_CRIMSON = 16, @@ -39,4 +39,4 @@ typedef enum fixed_artifact_type { ART_ROBINTON = 251, ART_ICINGDEATH = 259, ART_TWINKLE = 260 -} fixed_artifact_type; +}; diff --git a/src/artifact/random-art-bias-types.h b/src/artifact/random-art-bias-types.h index 8943a3c5c..61f6aee13 100644 --- a/src/artifact/random-art-bias-types.h +++ b/src/artifact/random-art-bias-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum random_art_bias_type { +enum random_art_bias_type { BIAS_NONE = 0, BIAS_ELEC = 1, /*!< ランダムアーティファクトバイアス:電撃 */ BIAS_POIS = 2, /*!< ランダムアーティファクトバイアス:毒 */ @@ -22,4 +22,4 @@ typedef enum random_art_bias_type { BIAS_WARRIOR = 18, /*!< ランダムアーティファクトバイアス:戦士系 */ BIAS_RANGER = 19, /*!< ランダムアーティファクトバイアス:レンジャー系 */ MAX_BIAS = 20, /*!< ランダムアーティファクトバイアス:最大数 */ -} random_art_bias_type; +}; diff --git a/src/artifact/random-art-effects.h b/src/artifact/random-art-effects.h index ff4abe62b..49c4d44d2 100644 --- a/src/artifact/random-art-effects.h +++ b/src/artifact/random-art-effects.h @@ -1,6 +1,6 @@ #pragma once -typedef enum random_art_activation_type { +enum random_art_activation_type { ACT_SUNLIGHT = 1, ACT_BO_MISS_1 = 2, ACT_BA_POIS_1 = 3, @@ -141,4 +141,4 @@ typedef enum random_art_activation_type { ACT_BLOODY_MOON = 254, ACT_CRIMSON = 255, ACT_MAX = 255, /* ダミー、最大値と合わせること / Dummy. Please match the value as max value */ -} random_art_activation_type; +}; diff --git a/src/autopick/autopick-editor-command.h b/src/autopick/autopick-editor-command.h index def634790..c2aac2212 100644 --- a/src/autopick/autopick-editor-command.h +++ b/src/autopick/autopick-editor-command.h @@ -4,10 +4,10 @@ #include "autopick/autopick-util.h" /*! APE means AutoPickEditor*/ -typedef enum ape_quittance { +enum ape_quittance { APE_QUIT = 0, APE_QUIT_WITHOUT_SAVE = 1, APE_QUIT_AND_SAVE = 2 -} ape_quittance; +}; ape_quittance do_editor_command(player_type *player_ptr, text_body_type *tb, int com_id); diff --git a/src/autopick/autopick-entry.c b/src/autopick/autopick-entry.c index 35f8537ab..81c1d1a0b 100644 --- a/src/autopick/autopick-entry.c +++ b/src/autopick/autopick-entry.c @@ -643,7 +643,7 @@ bool entry_from_choosed_object(player_type *player_ptr, autopick_type *entry) concptr q = _("どのアイテムを登録しますか? ", "Enter which item? "); concptr s = _("アイテムを持っていない。", "You have nothing to enter."); object_type *o_ptr; - o_ptr = choose_object(player_ptr, NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0); + o_ptr = choose_object(player_ptr, NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/autopick/autopick-finder.c b/src/autopick/autopick-finder.c index ec9438772..4d676351a 100644 --- a/src/autopick/autopick-finder.c +++ b/src/autopick/autopick-finder.c @@ -55,7 +55,7 @@ bool get_object_for_search(player_type *player_ptr, object_type **o_handle, conc concptr q = _("どのアイテムを検索しますか? ", "Enter which item? "); concptr s = _("アイテムを持っていない。", "You have nothing to enter."); object_type *o_ptr; - o_ptr = choose_object(player_ptr, NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0); + o_ptr = choose_object(player_ptr, NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/birth/birth-select-class.c b/src/birth/birth-select-class.c index 067832530..6f0e22b10 100644 --- a/src/birth/birth-select-class.c +++ b/src/birth/birth-select-class.c @@ -164,7 +164,7 @@ bool get_player_class(player_type *creature_ptr) if (!select_class(creature_ptr, cur, sym, &k)) return FALSE; - creature_ptr->pclass = (byte)k; + creature_ptr->pclass = static_cast(k); cp_ptr = &class_info[creature_ptr->pclass]; mp_ptr = &m_info[creature_ptr->pclass]; c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15); diff --git a/src/birth/birth-select-race.c b/src/birth/birth-select-race.c index fbd44e243..28c898e7e 100644 --- a/src/birth/birth-select-race.c +++ b/src/birth/birth-select-race.c @@ -152,7 +152,7 @@ bool get_player_race(player_type *creature_ptr) if (!select_race(creature_ptr, sym, &k)) return FALSE; - creature_ptr->prace = (byte)k; + creature_ptr->prace = static_cast(k); rp_ptr = &race_info[creature_ptr->prace]; c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15); return TRUE; diff --git a/src/birth/birth-util.h b/src/birth/birth-util.h index fbcc6f6a9..c7d7ce376 100644 --- a/src/birth/birth-util.h +++ b/src/birth/birth-util.h @@ -2,14 +2,14 @@ #include "system/angband.h" -typedef enum birth_kind +enum birth_kind { BK_REALM, BK_RACE, BK_CLASS, BK_PERSONALITY, BK_AUTO_ROLLER, -} birth_kind; +}; void birth_quit(void); void show_help(player_type* creature_ptr, concptr helpfile); diff --git a/src/birth/birth-wizard.c b/src/birth/birth-wizard.c index 0e06939f5..5145f0936 100644 --- a/src/birth/birth-wizard.c +++ b/src/birth/birth-wizard.c @@ -157,7 +157,7 @@ static bool get_player_sex(player_type *creature_ptr, char *buf) static bool let_player_select_race(player_type *creature_ptr) { clear_from(10); - creature_ptr->prace = 0; + creature_ptr->prace = RACE_HUMAN; while (TRUE) { char temp[80 * 10]; if (!get_player_race(creature_ptr)) @@ -187,7 +187,7 @@ static bool let_player_select_race(player_type *creature_ptr) static bool let_player_select_class(player_type *creature_ptr) { clear_from(10); - creature_ptr->pclass = 0; + creature_ptr->pclass = CLASS_WARRIOR; while (TRUE) { char temp[80 * 9]; if (!get_player_class(creature_ptr)) @@ -216,7 +216,7 @@ static bool let_player_select_class(player_type *creature_ptr) static bool let_player_select_personality(player_type *creature_ptr) { - creature_ptr->pseikaku = 0; + creature_ptr->pseikaku = PERSONALITY_ORDINARY; while (TRUE) { char temp[80 * 8]; if (!get_player_personality(creature_ptr)) diff --git a/src/birth/inventory-initializer.c b/src/birth/inventory-initializer.c index b550122c0..bed991ed5 100644 --- a/src/birth/inventory-initializer.c +++ b/src/birth/inventory-initializer.c @@ -186,9 +186,9 @@ void player_outfit(player_type *creature_ptr) q_ptr->pval = (PARAMETER_VALUE)rand_range(25, 30); add_outfit(creature_ptr, q_ptr); } else if (creature_ptr->pclass == CLASS_SORCERER) { - tval_type book_tval; - for (book_tval = TV_LIFE_BOOK; book_tval <= TV_LIFE_BOOK + MAX_MAGIC - 1; book_tval++) { - object_prep(creature_ptr, q_ptr, lookup_kind(book_tval, 0)); + int book_tval; + for (book_tval = TV_LIFE_BOOK; book_tval <= TV_LIFE_BOOK + static_cast(MAX_MAGIC) - 1; book_tval++) { + object_prep(creature_ptr, q_ptr, lookup_kind(static_cast(book_tval), 0)); q_ptr->number = 1; add_outfit(creature_ptr, q_ptr); } @@ -244,7 +244,7 @@ void player_outfit(player_type *creature_ptr) } for (int i = 0; i < 3; i++) { - tval_type tv = player_init[creature_ptr->pclass][i][0]; + int tv = player_init[creature_ptr->pclass][i][0]; OBJECT_SUBTYPE_VALUE sv = player_init[creature_ptr->pclass][i][1]; if ((creature_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue; @@ -261,7 +261,7 @@ void player_outfit(player_type *creature_ptr) } q_ptr = &forge; - object_prep(creature_ptr, q_ptr, lookup_kind(tv, sv)); + object_prep(creature_ptr, q_ptr, lookup_kind(static_cast(tv), sv)); if ((tv == TV_SWORD || tv == TV_HAFTED) && (creature_ptr->pclass == CLASS_ROGUE && creature_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */ q_ptr->name2 = EGO_BRAND_POIS; diff --git a/src/blue-magic/blue-magic-checker.h b/src/blue-magic/blue-magic-checker.h index 917c1a415..ee09f0e80 100644 --- a/src/blue-magic/blue-magic-checker.h +++ b/src/blue-magic/blue-magic-checker.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum blue_magic_type blue_magic_type; +enum blue_magic_type : int; bool monster_spell_is_learnable(int monspell); void learn_spell(player_type *learner_ptr, int monspell); diff --git a/src/blue-magic/blue-magic-summon.c b/src/blue-magic/blue-magic-summon.c index d4f1a207d..27d19cf70 100644 --- a/src/blue-magic/blue-magic-summon.c +++ b/src/blue-magic/blue-magic-summon.c @@ -10,7 +10,7 @@ bool cast_blue_summon_kin(player_type *caster_ptr, bmc_type *bmc_ptr) { msg_print(_("援軍を召喚した。", "You summon one of your kin.")); for (int k = 0; k < 1; k++) { - if (summon_kin_player(caster_ptr, bmc_ptr->summon_lev, caster_ptr->y, caster_ptr->x, (bmc_ptr->pet ? PM_FORCE_PET : 0L))) { + if (summon_kin_player(caster_ptr, bmc_ptr->summon_lev, caster_ptr->y, caster_ptr->x, (bmc_ptr->pet ? PM_FORCE_PET : PM_NONE))) { if (!bmc_ptr->pet) msg_print(_("召喚された仲間は怒っている!", "The summoned companion is angry!")); } else { @@ -40,7 +40,7 @@ bool cast_blue_summon_monster(player_type *caster_ptr, bmc_type *bmc_ptr) { msg_print(_("仲間を召喚した。", "You summon help.")); for (int k = 0; k < 1; k++) { - if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, 0, bmc_ptr->p_mode)) { + if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_NONE, bmc_ptr->p_mode)) { if (!bmc_ptr->pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!")); } else { @@ -55,7 +55,7 @@ bool cast_blue_summon_monsters(player_type *caster_ptr, bmc_type *bmc_ptr) { msg_print(_("モンスターを召喚した!", "You summon monsters!")); for (int k = 0; k < bmc_ptr->plev / 15 + 2; k++) { - if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, 0, (bmc_ptr->p_mode | bmc_ptr->u_mode))) { + if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_NONE, (bmc_ptr->p_mode | bmc_ptr->u_mode))) { if (!bmc_ptr->pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!")); } else { diff --git a/src/blue-magic/learnt-info.c b/src/blue-magic/learnt-info.c index f91206062..bea38accb 100644 --- a/src/blue-magic/learnt-info.c +++ b/src/blue-magic/learnt-info.c @@ -42,7 +42,7 @@ static void set_bluemage_damage(player_type *learner_type, monster_spell_type ms * @param power モンスター魔法のID * @return なし */ -void learnt_info(player_type *learner_ptr, char *p, int power) +void learnt_info(player_type *learner_ptr, char *p, monster_spell_type power) { PLAYER_LEVEL plev = get_pseudo_monstetr_level(learner_ptr); diff --git a/src/blue-magic/learnt-info.h b/src/blue-magic/learnt-info.h index 96c819a06..25426ee7f 100644 --- a/src/blue-magic/learnt-info.h +++ b/src/blue-magic/learnt-info.h @@ -2,5 +2,7 @@ #include "system/angband.h" +enum monster_spell_type : int; + PLAYER_LEVEL get_pseudo_monstetr_level(player_type *caster_ptr); -void learnt_info(player_type *learner_ptr, char *p, int power); +void learnt_info(player_type *learner_ptr, char *p, monster_spell_type power); diff --git a/src/blue-magic/learnt-power-getter.c b/src/blue-magic/learnt-power-getter.c index 0dca35919..250661b7b 100644 --- a/src/blue-magic/learnt-power-getter.c +++ b/src/blue-magic/learnt-power-getter.c @@ -170,7 +170,7 @@ static bool check_blue_magic_kind(learnt_magic_type *lm_ptr) static bool sweep_learnt_spells(player_type *caster_ptr, learnt_magic_type *lm_ptr) { - set_rf_masks(&lm_ptr->f4, &lm_ptr->f5, &lm_ptr->f6, lm_ptr->mode); + set_rf_masks(&lm_ptr->f4, &lm_ptr->f5, &lm_ptr->f6, static_cast(lm_ptr->mode)); for (lm_ptr->blue_magic_num = 0, lm_ptr->count = 0; lm_ptr->blue_magic_num < 32; lm_ptr->blue_magic_num++) if ((0x00000001U << lm_ptr->blue_magic_num) & lm_ptr->f4) lm_ptr->blue_magics[lm_ptr->count++] = lm_ptr->blue_magic_num; @@ -308,7 +308,7 @@ static void describe_blue_magic_name(player_type *caster_ptr, learnt_magic_type lm_ptr->spell = monster_powers[lm_ptr->blue_magics[lm_ptr->blue_magic_num]]; calculate_blue_magic_success_probability(caster_ptr, lm_ptr); - learnt_info(caster_ptr, lm_ptr->comment, lm_ptr->blue_magics[lm_ptr->blue_magic_num]); + learnt_info(caster_ptr, lm_ptr->comment, static_cast(lm_ptr->blue_magics[lm_ptr->blue_magic_num])); close_blue_magic_name(lm_ptr); strcat(lm_ptr->psi_desc, format(" %-26s %3d %3d%%%s", lm_ptr->spell.name, lm_ptr->need_mana, lm_ptr->chance, lm_ptr->comment)); prt(lm_ptr->psi_desc, lm_ptr->y + lm_ptr->blue_magic_num + 1, lm_ptr->x); diff --git a/src/cmd-action/cmd-attack.c b/src/cmd-action/cmd-attack.c index 569ef3019..09db54b8e 100644 --- a/src/cmd-action/cmd-attack.c +++ b/src/cmd-action/cmd-attack.c @@ -114,7 +114,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att 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, 0); + k = critical_norm(attacker_ptr, n_weight, bonus, k, (s16b)bonus, HISSATSU_NONE); k += attacker_ptr->to_d_m; if (k < 0) k = 0; diff --git a/src/cmd-action/cmd-mane.c b/src/cmd-action/cmd-mane.c index 3a702a5de..21e9b74e1 100644 --- a/src/cmd-action/cmd-mane.c +++ b/src/cmd-action/cmd-mane.c @@ -912,7 +912,7 @@ static bool use_mane(player_type *caster_ptr, int spell) return FALSE; msg_print(_("仲間を召喚した。", "You summon help.")); for (k = 0; k < 1; k++) - summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode)); + summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode)); break; } case MS_S_MONSTERS: { @@ -921,7 +921,7 @@ static bool use_mane(player_type *caster_ptr, int spell) return FALSE; msg_print(_("モンスターを召喚した!", "You summon monsters!")); for (k = 0; k < 6; k++) - summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode)); + summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode)); break; } case MS_S_ANT: { diff --git a/src/cmd-action/cmd-mind.c b/src/cmd-action/cmd-mind.c index 1d3d236a7..d32c3004b 100644 --- a/src/cmd-action/cmd-mind.c +++ b/src/cmd-action/cmd-mind.c @@ -260,22 +260,22 @@ static bool switch_mind_class(player_type *caster_ptr, cm_type *cm_ptr) { switch (cm_ptr->use_mind) { case MIND_MINDCRAFTER: - cm_ptr->cast = cast_mindcrafter_spell(caster_ptr, cm_ptr->n); + cm_ptr->cast = cast_mindcrafter_spell(caster_ptr, static_cast(cm_ptr->n)); return TRUE; case MIND_KI: - cm_ptr->cast = cast_force_spell(caster_ptr, cm_ptr->n); + cm_ptr->cast = cast_force_spell(caster_ptr, static_cast(cm_ptr->n)); return TRUE; case MIND_BERSERKER: - cm_ptr->cast = cast_berserk_spell(caster_ptr, cm_ptr->n); + cm_ptr->cast = cast_berserk_spell(caster_ptr, static_cast(cm_ptr->n)); return TRUE; case MIND_MIRROR_MASTER: if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x])) cm_ptr->on_mirror = TRUE; - cm_ptr->cast = cast_mirror_spell(caster_ptr, cm_ptr->n); + cm_ptr->cast = cast_mirror_spell(caster_ptr, static_cast(cm_ptr->n)); return TRUE; case MIND_NINJUTSU: - cm_ptr->cast = cast_ninja_spell(caster_ptr, cm_ptr->n); + cm_ptr->cast = cast_ninja_spell(caster_ptr, static_cast(cm_ptr->n)); return TRUE; default: msg_format(_("謎の能力:%d, %d", "Mystery power:%d, %d"), cm_ptr->use_mind, cm_ptr->n); @@ -440,4 +440,4 @@ void do_cmd_mind_browse(player_type *caster_ptr) break; } } -} \ No newline at end of file +} diff --git a/src/cmd-action/cmd-open-close.c b/src/cmd-action/cmd-open-close.c index 8c136d5cf..07e95e782 100644 --- a/src/cmd-action/cmd-open-close.c +++ b/src/cmd-action/cmd-open-close.c @@ -121,7 +121,7 @@ void do_cmd_open(player_type *creature_ptr) } else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx) { take_turn(creature_ptr, 100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else if (o_idx) { more = exe_open_chest(creature_ptr, y, x, o_idx); } else { @@ -172,7 +172,7 @@ void do_cmd_close(player_type *creature_ptr) } else if (g_ptr->m_idx) { take_turn(creature_ptr, 100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else { more = exe_close(creature_ptr, y, x); } @@ -227,7 +227,7 @@ void do_cmd_disarm(player_type *creature_ptr) msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm.")); } else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx) { msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else if (o_idx) { more = exe_disarm_chest(creature_ptr, y, x, o_idx); } else { @@ -286,7 +286,7 @@ void do_cmd_bash(player_type *creature_ptr) } else if (g_ptr->m_idx) { take_turn(creature_ptr, 100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else { more = exe_bash(creature_ptr, y, x, dir); } @@ -358,7 +358,7 @@ void do_cmd_spike(player_type *creature_ptr) } else if (g_ptr->m_idx) { take_turn(creature_ptr, 100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else { take_turn(creature_ptr, 100); msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name); diff --git a/src/cmd-action/cmd-others.c b/src/cmd-action/cmd-others.c index 35bc1b081..5e8554084 100644 --- a/src/cmd-action/cmd-others.c +++ b/src/cmd-action/cmd-others.c @@ -67,7 +67,7 @@ static bool exe_alter(player_type *creature_ptr) f_ptr = &f_info[feat]; take_turn(creature_ptr, 100); if (g_ptr->m_idx) { - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); return FALSE; } diff --git a/src/cmd-action/cmd-pet.c b/src/cmd-action/cmd-pet.c index d5f3feddf..c8d615140 100644 --- a/src/cmd-action/cmd-pet.c +++ b/src/cmd-action/cmd-pet.c @@ -222,7 +222,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force) msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); return FALSE; } @@ -819,4 +819,4 @@ void do_cmd_pet(player_type *creature_ptr) break; } } -} \ No newline at end of file +} diff --git a/src/cmd-action/cmd-shoot.c b/src/cmd-action/cmd-shoot.c index 2c1c80941..e66923923 100644 --- a/src/cmd-action/cmd-shoot.c +++ b/src/cmd-action/cmd-shoot.c @@ -53,7 +53,7 @@ void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type) concptr q = _("どれを撃ちますか? ", "Fire which item? "); concptr s = _("発射されるアイテムがありません。", "You have nothing to fire."); - ammo_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, creature_ptr->tval_ammo); + ammo_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, static_cast(creature_ptr->tval_ammo)); if (!ammo_ptr) { flush(); return; diff --git a/src/cmd-action/cmd-spell.c b/src/cmd-action/cmd-spell.c index 8b77675e6..40eed730d 100644 --- a/src/cmd-action/cmd-spell.c +++ b/src/cmd-action/cmd-spell.c @@ -565,7 +565,7 @@ void do_cmd_browse(player_type *caster_ptr) object_type *o_ptr; concptr q, s; - tval_type tval = 0; + tval_type tval = TV_NONE; /* Warriors are illiterate */ if (!(caster_ptr->realm1 || caster_ptr->realm2) && (caster_ptr->pclass != CLASS_SORCERER) && (caster_ptr->pclass != CLASS_RED_MAGE)) { @@ -671,7 +671,7 @@ void do_cmd_browse(player_type *caster_ptr) * @param next_realm 変更先の魔法領域ID * @return なし */ -static void change_realm2(player_type *caster_ptr, player_personality_type next_realm) +static void change_realm2(player_type *caster_ptr, REALM_IDX next_realm) { int i, j = 0; char tmp[80]; @@ -722,7 +722,7 @@ void do_cmd_study(player_type *caster_ptr) concptr p = spell_category_name(mp_ptr->spell_book); object_type *o_ptr; concptr q, s; - tval_type tval = 0; + tval_type tval = TV_NONE; if (!caster_ptr->realm1) { msg_print(_("本を読むことができない!", "You cannot read books!")); diff --git a/src/cmd-action/cmd-tunnel.c b/src/cmd-action/cmd-tunnel.c index 32c91ee3e..d361b3e40 100644 --- a/src/cmd-action/cmd-tunnel.c +++ b/src/cmd-action/cmd-tunnel.c @@ -60,7 +60,7 @@ void do_cmd_tunnel(player_type *creature_ptr) else if (g_ptr->m_idx) { take_turn(creature_ptr, 100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } else more = exe_tunnel(creature_ptr, y, x); diff --git a/src/cmd-building/cmd-building.c b/src/cmd-building/cmd-building.c index 468fabff9..f6f1cce25 100644 --- a/src/cmd-building/cmd-building.c +++ b/src/cmd-building/cmd-building.c @@ -130,7 +130,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i /* Do nothing */ break; case BACT_RESEARCH_ITEM: - paid = identify_fully(player_ptr, FALSE, 0); + paid = identify_fully(player_ptr, FALSE, TV_NONE); break; case BACT_TOWN_HISTORY: town_history(player_ptr); @@ -173,11 +173,11 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i break; case BACT_ENCHANT_WEAPON: item_tester_hook = object_allow_enchant_melee_weapon; - enchant_item(player_ptr, bcost, 1, 1, 0, 0); + enchant_item(player_ptr, bcost, 1, 1, 0, TV_NONE); break; case BACT_ENCHANT_ARMOR: item_tester_hook = object_is_armour; - enchant_item(player_ptr, bcost, 0, 0, 1, 0); + enchant_item(player_ptr, bcost, 0, 0, 1, TV_NONE); break; case BACT_RECHARGE: building_recharge(player_ptr); @@ -192,7 +192,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i paid = TRUE; break; case BACT_IDENT_ONE: - paid = ident_spell(player_ptr, FALSE, 0); + paid = ident_spell(player_ptr, FALSE, TV_NONE); break; case BACT_LEARN: do_cmd_study(player_ptr); @@ -205,7 +205,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i break; case BACT_ENCHANT_ARROWS: item_tester_hook = item_tester_hook_ammo; - enchant_item(player_ptr, bcost, 1, 1, 0, 0); + enchant_item(player_ptr, bcost, 1, 1, 0, TV_NONE); break; case BACT_ENCHANT_BOW: enchant_item(player_ptr, bcost, 1, 1, 0, TV_BOW); diff --git a/src/cmd-item/cmd-destroy.c b/src/cmd-item/cmd-destroy.c index 2055089d2..b17ccd6a4 100644 --- a/src/cmd-item/cmd-destroy.c +++ b/src/cmd-item/cmd-destroy.c @@ -86,7 +86,7 @@ static bool select_destroying_item(player_type *creature_ptr, destroy_type *dest { concptr q = _("どのアイテムを壊しますか? ", "Destroy which item? "); concptr s = _("壊せるアイテムを持っていない。", "You have nothing to destroy."); - destroy_ptr->o_ptr = choose_object(creature_ptr, &destroy_ptr->item, q, s, USE_INVEN | USE_FLOOR, 0); + destroy_ptr->o_ptr = choose_object(creature_ptr, &destroy_ptr->item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (destroy_ptr->o_ptr == NULL) return FALSE; diff --git a/src/cmd-item/cmd-eat.c b/src/cmd-item/cmd-eat.c index 427f07ad7..95bc69835 100644 --- a/src/cmd-item/cmd-eat.c +++ b/src/cmd-item/cmd-eat.c @@ -434,7 +434,7 @@ void do_cmd_eat_food(player_type *creature_ptr) q = _("どれを食べますか? ", "Eat which item? "); s = _("食べ物がない。", "You have nothing to eat."); - if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0)) + if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE)) return; exe_eat_food(creature_ptr, item); diff --git a/src/cmd-item/cmd-equipment.c b/src/cmd-item/cmd-equipment.c index 4683a9191..d102f305e 100644 --- a/src/cmd-item/cmd-equipment.c +++ b/src/cmd-item/cmd-equipment.c @@ -54,7 +54,7 @@ void do_cmd_equip(player_type *creature_ptr) command_wrk = USE_EQUIP; screen_save(); - (void)show_equipment(creature_ptr, 0, USE_FULL, 0); + (void)show_equipment(creature_ptr, 0, USE_FULL, TV_NONE); WEIGHT weight = calc_inventory_weight(creature_ptr); WEIGHT weight_lim = calc_weight_limit(creature_ptr); #ifdef JP @@ -100,7 +100,7 @@ void do_cmd_wield(player_type *creature_ptr) item_tester_hook = item_tester_hook_wear; concptr q = _("どれを装備しますか? ", "Wear/Wield which item? "); concptr s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return; @@ -114,7 +114,7 @@ void do_cmd_wield(player_type *creature_ptr) item_tester_hook = item_tester_hook_melee_weapon; q = _("どちらの武器と取り替えますか?", "Replace which weapon? "); s = _("おっと。", "Oops."); - if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) + if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), TV_NONE)) return; if (slot == INVEN_MAIN_HAND) @@ -126,7 +126,7 @@ void do_cmd_wield(player_type *creature_ptr) item_tester_hook = item_tester_hook_mochikae; q = _("どちらの手に装備しますか?", "Equip which hand? "); s = _("おっと。", "Oops."); - if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) + if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), TV_NONE)) return; } @@ -145,7 +145,7 @@ void do_cmd_wield(player_type *creature_ptr) item_tester_hook = item_tester_hook_mochikae; q = _("どちらの手に装備しますか?", "Equip which hand? "); s = _("おっと。", "Oops."); - if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) + if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), TV_NONE)) return; if ((slot == INVEN_SUB_HAND) && !has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)) @@ -161,7 +161,7 @@ void do_cmd_wield(player_type *creature_ptr) s = _("おっと。", "Oops."); creature_ptr->select_ring_slot = TRUE; - if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) { + if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), TV_NONE)) { creature_ptr->select_ring_slot = FALSE; return; } @@ -303,7 +303,7 @@ void do_cmd_takeoff(player_type *creature_ptr) concptr q = _("どれを装備からはずしますか? ", "Take off which item? "); concptr s = _("はずせる装備がない。", "You are not wearing anything to take off."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; diff --git a/src/cmd-item/cmd-item.c b/src/cmd-item/cmd-item.c index 9758450a7..64a66dbe9 100644 --- a/src/cmd-item/cmd-item.c +++ b/src/cmd-item/cmd-item.c @@ -73,7 +73,7 @@ void do_cmd_inven(player_type *creature_ptr) command_wrk = USE_INVEN; screen_save(); - (void)show_inventory(creature_ptr, 0, USE_FULL, 0); + (void)show_inventory(creature_ptr, 0, USE_FULL, TV_NONE); WEIGHT weight = calc_inventory_weight(creature_ptr); WEIGHT weight_lim = calc_weight_limit(creature_ptr); #ifdef JP @@ -112,7 +112,7 @@ void do_cmd_drop(player_type *creature_ptr) concptr q = _("どのアイテムを落としますか? ", "Drop which item? "); concptr s = _("落とせるアイテムを持っていない。", "You have nothing to drop."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -148,7 +148,7 @@ void do_cmd_observe(player_type *creature_ptr) GAME_TEXT o_name[MAX_NLEN]; concptr q = _("どのアイテムを調べますか? ", "Examine which item? "); concptr s = _("調べられるアイテムがない。", "You have nothing to examine."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -174,7 +174,7 @@ void do_cmd_uninscribe(player_type *creature_ptr) object_type *o_ptr; concptr q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? "); concptr s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -203,7 +203,7 @@ void do_cmd_inscribe(player_type *creature_ptr) char out_val[80]; concptr q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? "); concptr s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -242,7 +242,7 @@ void do_cmd_use(player_type *creature_ptr) item_tester_hook = item_tester_hook_use; concptr q = _("どれを使いますか?", "Use which item? "); concptr s = _("使えるものがありません。", "You have nothing to use."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -300,7 +300,7 @@ void do_cmd_activate(player_type *user_ptr) concptr q = _("どのアイテムを始動させますか? ", "Activate which item? "); concptr s = _("始動できるアイテムを装備していない。", "You have nothing to activate."); - if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) + if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), TV_NONE)) return; exe_activate(user_ptr, item); diff --git a/src/cmd-item/cmd-magiceat.c b/src/cmd-item/cmd-magiceat.c index 625893722..663bab3c8 100644 --- a/src/cmd-item/cmd-magiceat.c +++ b/src/cmd-item/cmd-magiceat.c @@ -90,7 +90,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(player_type *creature_ptr, bool o OBJECT_SUBTYPE_VALUE ext = 0; char choice; bool flag, request_list; - tval_type tval = 0; + tval_type tval = TV_NONE; int ask = TRUE; OBJECT_SUBTYPE_VALUE i = 0; char out_val[160]; diff --git a/src/cmd-item/cmd-quaff.c b/src/cmd-item/cmd-quaff.c index 499e7c013..07615118d 100644 --- a/src/cmd-item/cmd-quaff.c +++ b/src/cmd-item/cmd-quaff.c @@ -36,7 +36,7 @@ void do_cmd_quaff_potion(player_type *creature_ptr) concptr s = _("飲める薬がない。", "You have no potions to quaff."); OBJECT_IDX item; - if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0)) + if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE)) return; exe_quaff_potion(creature_ptr, item); diff --git a/src/cmd-item/cmd-read.c b/src/cmd-item/cmd-read.c index 42a25eae5..ee4dbcb9f 100644 --- a/src/cmd-item/cmd-read.c +++ b/src/cmd-item/cmd-read.c @@ -38,7 +38,7 @@ void do_cmd_read_scroll(player_type *creature_ptr) concptr s = _("読める巻物がない。", "You have no scrolls to read."); object_type *o_ptr; OBJECT_IDX item; - o_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0); + o_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (!o_ptr) return; diff --git a/src/cmd-item/cmd-refill.c b/src/cmd-item/cmd-refill.c index 352e707de..68a4af15b 100644 --- a/src/cmd-item/cmd-refill.c +++ b/src/cmd-item/cmd-refill.c @@ -30,7 +30,7 @@ static void do_cmd_refill_lamp(player_type *user_ptr) item_tester_hook = item_tester_refill_lantern; concptr q = _("どの油つぼから注ぎますか? ", "Refill with which flask? "); concptr s = _("油つぼがない。", "You have no flasks of oil."); - o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0); + o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (!o_ptr) return; @@ -70,7 +70,7 @@ static void do_cmd_refill_torch(player_type *user_ptr) item_tester_hook = object_can_refill_torch; concptr q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? "); concptr s = _("他に松明がない。", "You have no extra torches."); - o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0); + o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (!o_ptr) return; diff --git a/src/cmd-item/cmd-smith.c b/src/cmd-item/cmd-smith.c index fccd78454..c374e7f4d 100644 --- a/src/cmd-item/cmd-smith.c +++ b/src/cmd-item/cmd-smith.c @@ -248,7 +248,7 @@ static void drain_essence(player_type *creature_ptr) q = _("どのアイテムから抽出しますか?", "Extract from which item? "); s = _("抽出できるアイテムがありません。", "You have nothing you can extract from."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return; @@ -561,7 +561,7 @@ static void add_essence(player_type *creature_ptr, ESSENCE_IDX mode) int use_essence; essence_type *es_ptr; bool able[22] = { 0 }; - tval_type tval = 0; + tval_type tval = TV_NONE; int menu_line = (use_menu ? 1 : 0); for (i = 0; essence_info[i].add_name; i++) { @@ -1003,7 +1003,7 @@ static void erase_essence(player_type *creature_ptr) q = _("どのアイテムのエッセンスを消去しますか?", "Remove from which item? "); s = _("エッセンスを付加したアイテムがありません。", "You have nothing with added essence to remove."); - o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return; diff --git a/src/cmd-item/cmd-throw.c b/src/cmd-item/cmd-throw.c index fda6432bb..bc3afbf7a 100644 --- a/src/cmd-item/cmd-throw.c +++ b/src/cmd-item/cmd-throw.c @@ -69,7 +69,7 @@ static bool check_throw_boomerang(player_type *creature_ptr, it_type *it_ptr, co item_tester_hook = item_tester_hook_boomerang; *q = _("どの武器を投げますか? ", "Throw which item? "); *s = _("投げる武器がない。", "You have nothing to throw."); - it_ptr->o_ptr = choose_object(creature_ptr, &it_ptr->item, *q, *s, USE_EQUIP, 0); + it_ptr->o_ptr = choose_object(creature_ptr, &it_ptr->item, *q, *s, USE_EQUIP, TV_NONE); if (!it_ptr->o_ptr) { flush(); return FALSE; @@ -103,7 +103,7 @@ static bool check_what_throw(player_type *creature_ptr, it_type *it_ptr) q = _("どのアイテムを投げますか? ", "Throw which item? "); s = _("投げるアイテムがない。", "You have nothing to throw."); - it_ptr->o_ptr = choose_object(creature_ptr, &it_ptr->item, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0); + it_ptr->o_ptr = choose_object(creature_ptr, &it_ptr->item, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, TV_NONE); if (!it_ptr->o_ptr) { flush(); return FALSE; @@ -284,7 +284,7 @@ static void calc_racial_power_damage(player_type *creature_ptr, it_type *it_ptr) int ds = it_ptr->q_ptr->ds; torch_dice(it_ptr->q_ptr, &dd, &ds); it_ptr->tdam = damroll(dd, ds); - it_ptr->tdam = calc_attack_damage_with_slay(creature_ptr, it_ptr->q_ptr, it_ptr->tdam, it_ptr->m_ptr, 0, TRUE); + it_ptr->tdam = calc_attack_damage_with_slay(creature_ptr, it_ptr->q_ptr, it_ptr->tdam, it_ptr->m_ptr, HISSATSU_NONE, TRUE); it_ptr->tdam = critical_shot(creature_ptr, it_ptr->q_ptr->weight, it_ptr->q_ptr->to_h, 0, it_ptr->tdam); if (it_ptr->q_ptr->to_d > 0) it_ptr->tdam += it_ptr->q_ptr->to_d; @@ -364,7 +364,7 @@ void display_figurine_throw(player_type *creature_ptr, it_type *it_ptr) return; it_ptr->corruption_possibility = 100; - if (!(summon_named_creature(creature_ptr, 0, it_ptr->y, it_ptr->x, it_ptr->q_ptr->pval, !(object_is_cursed(it_ptr->q_ptr)) ? PM_FORCE_PET : 0L))) { + if (!(summon_named_creature(creature_ptr, 0, it_ptr->y, it_ptr->x, it_ptr->q_ptr->pval, !(object_is_cursed(it_ptr->q_ptr)) ? PM_FORCE_PET : PM_NONE))) { msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters.")); return; } @@ -557,4 +557,4 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID process_boomerang_back(creature_ptr, it_ptr); drop_thrown_item(creature_ptr, it_ptr); return TRUE; -} \ No newline at end of file +} diff --git a/src/cmd-item/cmd-usestaff.c b/src/cmd-item/cmd-usestaff.c index 37793b357..ed3e55048 100644 --- a/src/cmd-item/cmd-usestaff.c +++ b/src/cmd-item/cmd-usestaff.c @@ -63,7 +63,7 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, bool magic, bool known) { int k; - int ident = FALSE; + bool ident = FALSE; PLAYER_LEVEL lev = powerful ? creature_ptr->lev * 2 : creature_ptr->lev; POSITION detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT; @@ -94,7 +94,7 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use case SV_STAFF_SUMMONING: { const int times = randint1(powerful ? 8 : 4); for (k = 0; k < times; k++) { - if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, + if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -110,10 +110,10 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use case SV_STAFF_IDENTIFY: { if (powerful) { - if (!identify_fully(creature_ptr, FALSE, 0)) + if (!identify_fully(creature_ptr, FALSE, TV_NONE)) *use_charge = FALSE; } else { - if (!ident_spell(creature_ptr, FALSE, 0)) + if (!ident_spell(creature_ptr, FALSE, TV_NONE)) *use_charge = FALSE; } ident = TRUE; @@ -121,7 +121,7 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use } case SV_STAFF_REMOVE_CURSE: { - bool result = powerful ? remove_all_curse(creature_ptr) : remove_curse(creature_ptr); + bool result = (powerful ? remove_all_curse(creature_ptr) : remove_curse(creature_ptr)) != 0; if (result) { ident = TRUE; } diff --git a/src/cmd-item/cmd-zaprod.c b/src/cmd-item/cmd-zaprod.c index d137c8180..35c8b5b1a 100644 --- a/src/cmd-item/cmd-zaprod.c +++ b/src/cmd-item/cmd-zaprod.c @@ -78,10 +78,10 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d case SV_ROD_IDENTIFY: { if (powerful) { - if (!identify_fully(creature_ptr, FALSE, 0)) + if (!identify_fully(creature_ptr, FALSE, TV_NONE)) *use_charge = FALSE; } else { - if (!ident_spell(creature_ptr, FALSE, 0)) + if (!ident_spell(creature_ptr, FALSE, TV_NONE)) *use_charge = FALSE; } ident = TRUE; diff --git a/src/combat/combat-options-type.h b/src/combat/combat-options-type.h index a50e9e317..00a02aaa9 100644 --- a/src/combat/combat-options-type.h +++ b/src/combat/combat-options-type.h @@ -1,6 +1,6 @@ #pragma once -typedef enum combat_options { +enum combat_options { HISSATSU_NONE = 0, HISSATSU_2 = 1, HISSATSU_3WAY = 2, @@ -33,4 +33,4 @@ typedef enum combat_options { HISSATSU_3DAN = 29, HISSATSU_100NIN = 30, HISSATSU_IAI = 100, -} combat_options; +}; diff --git a/src/core/player-redraw-types.h b/src/core/player-redraw-types.h index 6e8cba0ad..868140898 100644 --- a/src/core/player-redraw-types.h +++ b/src/core/player-redraw-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum player_redraw_type { +enum player_redraw_type { PR_MISC = 0x00000001L, /*!< 再描画フラグ: 種族と職業 / Display Race/Class */ PR_TITLE = 0x00000002L, /*!< 再描画フラグ: 称号 / Display Title */ PR_LEV = 0x00000004L, /*!< 再描画フラグ: レベル / Display Level */ @@ -29,4 +29,4 @@ typedef enum player_redraw_type { PR_BASIC = 0x02000000L, /*!< 再描画フラグ: 基本ステータス全体 / Display Basic Info */ PR_MAP = 0x04000000L, /*!< 再描画フラグ: ゲームマップ / Display Map */ PR_WIPE = 0x08000000L, /*!< 再描画フラグ: 画面消去 / Hack -- Total Redraw */ -} player_redraw_type; +}; diff --git a/src/core/player-update-types.h b/src/core/player-update-types.h index 18568f0bc..ab61b14b9 100644 --- a/src/core/player-update-types.h +++ b/src/core/player-update-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum player_update_type { +enum player_update_type { PU_BONUS = 0x00000001L, /*!< ステータス更新フラグ: 能力値修正 / Calculate bonuses */ PU_TORCH = 0x00000002L, /*!< ステータス更新フラグ: 光源半径 / Calculate torch radius */ PU_HP = 0x00000010L, /*!< ステータス更新フラグ: HP / Calculate chp and mhp */ @@ -18,4 +18,4 @@ typedef enum player_update_type { PU_MONSTERS = 0x01000000L, /*!< ステータス更新フラグ: モンスターのステータス / Update monsters */ PU_DISTANCE = 0x02000000L, /*!< ステータス更新フラグ: プレイヤーとモンスターの距離 / Update distances */ PU_FLOW = 0x10000000L, /*!< ステータス更新フラグ: プレイヤーから各マスへの到達距離 / Update flow */ -} player_update_type; +}; diff --git a/src/core/scores.c b/src/core/scores.c index ceec92c89..83a0eabb7 100644 --- a/src/core/scores.c +++ b/src/core/scores.c @@ -483,6 +483,7 @@ bool send_world_score(player_type *current_player_ptr, bool do_send, void(*updat errr top_twenty(player_type *current_player_ptr) { high_score the_score; + char buf[32]; (void)WIPE(&the_score, high_score); /* Save the version */ @@ -512,9 +513,12 @@ errr top_twenty(player_type *current_player_ptr) /* Save the player info */ sprintf(the_score.uid, "%7u", current_player_ptr->player_uid); sprintf(the_score.sex, "%c", (current_player_ptr->psex ? 'm' : 'f')); - sprintf(the_score.p_r, "%2d", MIN(current_player_ptr->prace, MAX_RACES)); - sprintf(the_score.p_c, "%2d", MIN(current_player_ptr->pclass, MAX_CLASS)); - sprintf(the_score.p_a, "%2d", MIN(current_player_ptr->pseikaku, MAX_PERSONALITIES)); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->prace, MAX_RACES)); + memcpy(the_score.p_r, buf, 3); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->pclass, MAX_CLASS)); + memcpy(the_score.p_c, buf, 3); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->pseikaku, MAX_PERSONALITIES)); + memcpy(the_score.p_r, buf, 3); /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", MIN((u16b)current_player_ptr->lev, 999)); @@ -585,6 +589,7 @@ errr top_twenty(player_type *current_player_ptr) errr predict_score(player_type *current_player_ptr) { high_score the_score; + char buf[32]; /* No score file */ if (highscore_fd < 0) @@ -616,9 +621,12 @@ errr predict_score(player_type *current_player_ptr) /* Save the player info */ sprintf(the_score.uid, "%7u", current_player_ptr->player_uid); sprintf(the_score.sex, "%c", (current_player_ptr->psex ? 'm' : 'f')); - sprintf(the_score.p_r, "%2d", MIN(current_player_ptr->prace, MAX_RACES)); - sprintf(the_score.p_c, "%2d", MIN(current_player_ptr->pclass, MAX_CLASS)); - sprintf(the_score.p_a, "%2d", MIN(current_player_ptr->pseikaku, MAX_PERSONALITIES)); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->prace, MAX_RACES)); + memcpy(the_score.p_r, buf, 3); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->pclass, MAX_CLASS)); + memcpy(the_score.p_c, buf, 3); + snprintf(buf, sizeof(buf), "%2d", MIN(current_player_ptr->pseikaku, MAX_PERSONALITIES)); + memcpy(the_score.p_a, buf, 3); /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", MIN((u16b)current_player_ptr->lev, 999)); @@ -725,7 +733,7 @@ void show_highclass(player_type *current_player_ptr) */ void race_score(player_type *current_player_ptr, int race_num) { - register int i = 0, j, m = 0; + int i = 0, j, m = 0; int pr, clev, lastlev; high_score the_score; char buf[1024], out_val[256], tmp_str[80]; diff --git a/src/core/show-file.c b/src/core/show-file.c index 4e7a703c9..cc24ec95e 100644 --- a/src/core/show-file.c +++ b/src/core/show-file.c @@ -217,7 +217,7 @@ bool show_file(player_type *creature_ptr, bool show_version, concptr name, concp int k = str[7] - 'A'; menu = TRUE; if ((str[8] == ']') && (str[9] == ' ')) { - strncpy(hook[k], str + 10, 31); + memcpy(hook[k], str + 10, 31); hook[k][31] = '\0'; } diff --git a/src/core/visuals-reseter.c b/src/core/visuals-reseter.c index 2dd98cbca..5df67f36b 100644 --- a/src/core/visuals-reseter.c +++ b/src/core/visuals-reseter.c @@ -33,8 +33,8 @@ void reset_visuals(player_type *owner_ptr, void (*process_autopick_file_command) r_ptr->x_char = r_ptr->d_char; } - char *pref_file = use_graphics ? "graf.prf" : "font.prf"; - char *base_name = use_graphics ? "graf-%s.prf" : "font-%s.prf"; + concptr pref_file = use_graphics ? "graf.prf" : "font.prf"; + concptr base_name = use_graphics ? "graf-%s.prf" : "font-%s.prf"; char buf[1024]; process_pref_file(owner_ptr, pref_file, process_autopick_file_command); sprintf(buf, base_name, owner_ptr->base_name); diff --git a/src/core/window-redrawer.c b/src/core/window-redrawer.c index 41887fbca..b37581c42 100644 --- a/src/core/window-redrawer.c +++ b/src/core/window-redrawer.c @@ -237,12 +237,12 @@ void window_stuff(player_type *player_ptr) if (window_flags & (PW_INVEN)) { player_ptr->window_flags &= ~(PW_INVEN); - fix_inventory(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保 + fix_inventory(player_ptr, TV_NONE); // TODO:2.2.2 まともなtval参照手段を確保 } if (window_flags & (PW_EQUIP)) { player_ptr->window_flags &= ~(PW_EQUIP); - fix_equip(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保 + fix_equip(player_ptr, TV_NONE); // TODO:2.2.2 まともなtval参照手段を確保 } if (window_flags & (PW_SPELL)) { diff --git a/src/core/window-redrawer.h b/src/core/window-redrawer.h index 92c910b5d..40495e438 100644 --- a/src/core/window-redrawer.h +++ b/src/core/window-redrawer.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum window_redraw_type { +enum window_redraw_type { PW_INVEN = 0x00000001L, /*!<サブウィンドウ描画フラグ: 所持品-装備品 / Display inven/equip */ PW_EQUIP = 0x00000002L, /*!<サブウィンドウ描画フラグ: 装備品-所持品 / Display equip/inven */ PW_SPELL = 0x00000004L, /*!<サブウィンドウ描画フラグ: 魔法一覧 / Display spell list */ @@ -16,7 +16,7 @@ typedef enum window_redraw_type { PW_SNAPSHOT = 0x00000800L, /*!<サブウィンドウ描画フラグ: 記念写真 / Display snap-shot */ PW_ALL = (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER_LIST | PW_MESSAGE | PW_OVERHEAD | PW_MONSTER | PW_OBJECT | PW_DUNGEON | PW_SNAPSHOT), -} window_redraw_type; +}; void redraw_window(void); void window_stuff(player_type *player_ptr); diff --git a/src/dungeon/dungeon-flag-types.h b/src/dungeon/dungeon-flag-types.h index 768caf2ae..c0ce99002 100644 --- a/src/dungeon/dungeon-flag-types.h +++ b/src/dungeon/dungeon-flag-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum dungeon_flag_type { +enum dungeon_flag_type { DF1_WINNER = 0x00000001L, DF1_MAZE = 0x00000002L, DF1_SMALLEST = 0x00000004L, @@ -33,6 +33,6 @@ typedef enum dungeon_flag_type { DF1_DARKNESS = 0x20000000L, DF1_ACID_RIVER = 0x40000000L, DF1_POISONOUS_RIVER = 0x80000000L, -} dungeon_flag_type; +}; #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID) diff --git a/src/dungeon/dungeon-processor.c b/src/dungeon/dungeon-processor.c index f0a8f74a8..b56d1b248 100644 --- a/src/dungeon/dungeon-processor.c +++ b/src/dungeon/dungeon-processor.c @@ -71,7 +71,7 @@ void process_dungeon(player_type *player_ptr, bool load_game) health_track(player_ptr, 0); disturb(player_ptr, TRUE, TRUE); - int quest_num = quest_num = quest_number(player_ptr, floor_ptr->dun_level); + int quest_num = quest_number(player_ptr, floor_ptr->dun_level); if (quest_num) { r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR; } diff --git a/src/effect/effect-characteristics.h b/src/effect/effect-characteristics.h index 963e97c52..1bb2fe7e1 100644 --- a/src/effect/effect-characteristics.h +++ b/src/effect/effect-characteristics.h @@ -3,7 +3,7 @@ /* * project()関数に用いられる、遠隔攻撃特性ビットフラグ / Bit flags for the "project()" function */ -typedef enum effect_characteristics { +enum effect_characteristics { PROJECT_NONE = 0x0000, PROJECT_JUMP = 0x0001, /*!< 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) */ PROJECT_BEAM = 0x0002, /*!< ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) */ @@ -21,4 +21,4 @@ typedef enum effect_characteristics { PROJECT_PATH = 0x2000, /*!< 軌跡の表示 / Only used for printing project path */ PROJECT_FAST = 0x4000, /*!< 炸裂するまで画面上に表示しない / Hide "visual" of flying bolts until blast */ PROJECT_LOS = 0x8000 /*!< 視線が通っているか(?) / Line of sight */ -} effect_characteristics; +}; diff --git a/src/effect/effect-monster-charm.h b/src/effect/effect-monster-charm.h index 65b5e90b2..7aa8e05a5 100644 --- a/src/effect/effect-monster-charm.h +++ b/src/effect/effect-monster-charm.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_charm(player_type *caster_ptr, effect_monster_type *em_ptr); process_result effect_monster_control_undead(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-curse.h b/src/effect/effect-monster-curse.h index 3673cbdf7..958f6b897 100644 --- a/src/effect/effect-monster-curse.h +++ b/src/effect/effect-monster-curse.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_curse_1(effect_monster_type *em_ptr); process_result effect_monster_curse_2(effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-evil.h b/src/effect/effect-monster-evil.h index 45162d711..07c090ccc 100644 --- a/src/effect/effect-monster-evil.h +++ b/src/effect/effect-monster-evil.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_away_undead(player_type *caster_ptr, effect_monster_type *em_ptr); process_result effect_monster_away_evil(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-lite-dark.h b/src/effect/effect-monster-lite-dark.h index 24c638415..0e291a8d5 100644 --- a/src/effect/effect-monster-lite-dark.h +++ b/src/effect/effect-monster-lite-dark.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_lite_weak(player_type *caster_ptr, effect_monster_type *em_ptr); process_result effect_monster_lite(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-oldies.h b/src/effect/effect-monster-oldies.h index 15f1997ca..b23f9eea7 100644 --- a/src/effect/effect-monster-oldies.h +++ b/src/effect/effect-monster-oldies.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_old_poly(effect_monster_type *em_ptr); process_result effect_monster_old_clone(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-psi.h b/src/effect/effect-monster-psi.h index 755256411..5be55885a 100644 --- a/src/effect/effect-monster-psi.h +++ b/src/effect/effect-monster-psi.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_psi(player_type *caster_ptr, effect_monster_type *em_ptr); process_result effect_monster_psi_drain(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-resist-hurt.h b/src/effect/effect-monster-resist-hurt.h index a36309f1d..d74945278 100644 --- a/src/effect/effect-monster-resist-hurt.h +++ b/src/effect/effect-monster-resist-hurt.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_void(effect_monster_type *em_ptr); process_result effect_monster_acid(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-spirit.h b/src/effect/effect-monster-spirit.h index 3c724c062..9b55254c3 100644 --- a/src/effect/effect-monster-spirit.h +++ b/src/effect/effect-monster-spirit.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result effect_monster_drain_mana(player_type *caster_ptr, effect_monster_type *em_ptr); process_result effect_monster_mind_blast(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster-switcher.c b/src/effect/effect-monster-switcher.c index dac0acbb3..8f176de25 100644 --- a/src/effect/effect-monster-switcher.c +++ b/src/effect/effect-monster-switcher.c @@ -414,7 +414,7 @@ process_result switch_effects_monster(player_type *caster_ptr, effect_monster_ty case GF_CAPTURE: return effect_monster_capture(caster_ptr, em_ptr); case GF_ATTACK: - return (process_result)do_cmd_attack(caster_ptr, em_ptr->y, em_ptr->x, em_ptr->dam); + return (process_result)do_cmd_attack(caster_ptr, em_ptr->y, em_ptr->x, static_cast(em_ptr->dam)); case GF_ENGETSU: return effect_monster_engetsu(caster_ptr, em_ptr); case GF_GENOCIDE: @@ -431,4 +431,4 @@ process_result switch_effects_monster(player_type *caster_ptr, effect_monster_ty return PROCESS_CONTINUE; } } -} \ No newline at end of file +} diff --git a/src/effect/effect-monster-switcher.h b/src/effect/effect-monster-switcher.h index 740b36e4f..7016c3b9a 100644 --- a/src/effect/effect-monster-switcher.h +++ b/src/effect/effect-monster-switcher.h @@ -2,6 +2,6 @@ #include "system/angband.h" -typedef enum process_result process_resut; +enum process_result; typedef struct effect_monster_type effect_monster_type; process_result switch_effects_monster(player_type *caster_ptr, effect_monster_type *em_ptr); diff --git a/src/effect/effect-monster.c b/src/effect/effect-monster.c index 345fa12f8..93c206fd7 100644 --- a/src/effect/effect-monster.c +++ b/src/effect/effect-monster.c @@ -402,7 +402,8 @@ static void process_monster_teleport(player_type *caster_ptr, effect_monster_typ if (!em_ptr->who) chg_virtue(caster_ptr, V_VALOUR, -1); - teleport_away(caster_ptr, em_ptr->g_ptr->m_idx, em_ptr->do_dist, (!em_ptr->who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE); + teleport_flags tflag = static_cast((!em_ptr->who ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE); + teleport_away(caster_ptr, em_ptr->g_ptr->m_idx, em_ptr->do_dist, tflag); em_ptr->y = em_ptr->m_ptr->fy; em_ptr->x = em_ptr->m_ptr->fx; @@ -597,4 +598,4 @@ bool affect_monster( postprocess_spell(caster_ptr, em_ptr); return em_ptr->obvious; -} \ No newline at end of file +} diff --git a/src/effect/effect-player.c b/src/effect/effect-player.c index 19ae37d16..2b5c5414d 100644 --- a/src/effect/effect-player.c +++ b/src/effect/effect-player.c @@ -141,11 +141,11 @@ concptr blind_spell_effect_messages[MAX_GF] = { "", // GF_WOUNDS = 116, /*!< 魔法効果: 創傷*/ }; -typedef enum effect_player_check_result { +enum ep_check_result { EP_CHECK_FALSE = 0, EP_CHECK_TRUE = 1, EP_CHECK_CONTINUE = 2, -} ep_check_result; +}; /*! * @brief effect_player_type構造体を初期化する @@ -297,7 +297,7 @@ bool affect_player(MONSTER_IDX who, player_type *target_ptr, concptr who_name, i effect_player_type *ep_ptr = initialize_effect_player(&tmp_effect, who, dam, effect_type, flag, monspell); ep_check_result check_result = check_continue_player_effect(target_ptr, ep_ptr, y, x, project); if (check_result != EP_CHECK_CONTINUE) - return check_result; + return (bool)check_result; if (ep_ptr->dam > 1600) ep_ptr->dam = 1600; diff --git a/src/flavor/object-flavor-types.h b/src/flavor/object-flavor-types.h index 4c14b0a6c..70861f7a0 100644 --- a/src/flavor/object-flavor-types.h +++ b/src/flavor/object-flavor-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum object_description_type { +enum object_description_type { OD_NAME_ONLY = 0x00000001, /* Omit values, pval, inscription */ OD_NAME_AND_ENCHANT = 0x00000002, /* Omit pval, inscription */ OD_OMIT_INSCRIPTION = 0x00000004, /* Omit inscription */ @@ -10,4 +10,4 @@ typedef enum object_description_type { OD_NO_FLAVOR = 0x00000040, /* Allow to hidden flavor */ OD_FORCE_FLAVOR = 0x00000080, /* Get un-shuffled flavor name */ OD_DEBUG = 0x10000000, /* Print for DEBUG */ -} object_description_type; +}; diff --git a/src/floor/cave.h b/src/floor/cave.h index a789de6d9..ff2df20f4 100644 --- a/src/floor/cave.h +++ b/src/floor/cave.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum feature_flag_type feature_flag_type; +enum feature_flag_type : int; typedef struct grid_type grid_type; bool in_bounds(floor_type *floor_ptr, POSITION y, POSITION x); bool in_bounds2(floor_type *floor_ptr, POSITION y, POSITION x); diff --git a/src/floor/fixed-map-generator.c b/src/floor/fixed-map-generator.c index fbbf1e313..8f043d589 100644 --- a/src/floor/fixed-map-generator.c +++ b/src/floor/fixed-map-generator.c @@ -202,7 +202,7 @@ static bool parse_qtw_QQ(quest_type *q_ptr, char **zz, int num) artifact_type *a_ptr; if (num < 9) - return (PARSE_ERROR_TOO_FEW_ARGUMENTS); + return TRUE; q_ptr->type = (QUEST_TYPE)atoi(zz[2]); q_ptr->num_mon = (MONSTER_NUMBER)atoi(zz[3]); @@ -437,7 +437,7 @@ parse_error_type generate_fixed_map_floor(player_type *player_ptr, qtwg_type *qt return PARSE_ERROR_NONE; } - parse_error_type parse_result_Q = parse_qtw_Q(qtwg_ptr, zz); + parse_error_type parse_result_Q = static_cast(parse_qtw_Q(qtwg_ptr, zz)); if (parse_result_Q != PARSE_CONTINUE) return parse_result_Q; @@ -454,4 +454,4 @@ parse_error_type generate_fixed_map_floor(player_type *player_ptr, qtwg_type *qt return PARSE_ERROR_NONE; return PARSE_ERROR_GENERIC; -} \ No newline at end of file +} diff --git a/src/floor/fixed-map-generator.h b/src/floor/fixed-map-generator.h index 4cef031a8..75af293a6 100644 --- a/src/floor/fixed-map-generator.h +++ b/src/floor/fixed-map-generator.h @@ -14,7 +14,7 @@ typedef struct qtwg_type { int *x; } qtwg_type; -typedef errr (*process_dungeon_file_pf)(player_type *, concptr, int, int, int, int); +typedef parse_error_type (*process_dungeon_file_pf)(player_type *, concptr, int, int, int, int); qtwg_type *initialize_quest_generator_type(qtwg_type *qg_ptr, char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x); parse_error_type generate_fixed_map_floor(player_type *player_ptr, qtwg_type *qg_ptr, process_dungeon_file_pf parse_fixed_map); diff --git a/src/floor/floor-allocation-types.h b/src/floor/floor-allocation-types.h index 916b79414..8c20769e5 100644 --- a/src/floor/floor-allocation-types.h +++ b/src/floor/floor-allocation-types.h @@ -1,17 +1,17 @@ #pragma once /* Dungeon allocation "places" */ -typedef enum dap_type { +enum dap_type : int { ALLOC_SET_CORR = 1, /* Hallway */ ALLOC_SET_ROOM = 2, /* Room */ ALLOC_SET_BOTH = 3, /* Anywhere */ -} dap_type; +}; /* Dungeon allocation "types" */ -typedef enum dungeon_allocation_type { +enum dungeon_allocation_type { ALLOC_TYP_RUBBLE = 1, /* Rubble */ ALLOC_TYP_TRAP = 3, /* Trap */ ALLOC_TYP_GOLD = 4, /* Gold */ ALLOC_TYP_OBJECT = 5, /* Object */ ALLOC_TYP_INVIS = 6, /* Invisible wall */ -} dungeon_allocation_type; +}; diff --git a/src/floor/floor-generator.c b/src/floor/floor-generator.c index 840553d83..746763885 100644 --- a/src/floor/floor-generator.c +++ b/src/floor/floor-generator.c @@ -64,7 +64,7 @@ static Vec vec_with_capacity(const size_t cap) assert(cap > 0); Vec vec = { .len = 0, .cap = cap, .data = NULL }; - vec.data = malloc(sizeof(int) * cap); + vec.data = static_cast(malloc(sizeof(int) * cap)); if (!vec.data) rpanic(cap); @@ -104,7 +104,7 @@ static void vec_push_back(Vec *const vec, const int e) // 容量不足になったら容量を拡張する。 if (vec->len == vec->cap) { vec->cap = vec->cap > 0 ? 2 * vec->cap : 1; - vec->data = realloc(vec->data, sizeof(int) * vec->cap); + vec->data = static_cast(realloc(vec->data, sizeof(int) * vec->cap)); if (!vec->data) rpanic(vec->cap); } diff --git a/src/floor/floor-mode-changer.h b/src/floor/floor-mode-changer.h index a85c76fda..9af3fa474 100644 --- a/src/floor/floor-mode-changer.h +++ b/src/floor/floor-mode-changer.h @@ -3,7 +3,7 @@ #include "system/angband.h" // Change Floor Mode. -typedef enum cfm_type { +enum cfm_type { CFM_UP = 0x0001, /* Move up */ CFM_DOWN = 0x0002, /* Move down */ CFM_LONG_STAIRS = 0x0004, /* Randomly occurred long stairs/shaft */ @@ -14,6 +14,6 @@ typedef enum cfm_type { CFM_SAVE_FLOORS = 0x0080, /* Save floors */ CFM_NO_RETURN = 0x0100, /* Flee from random quest etc... */ CFM_FIRST_FLOOR = 0x0200, /* Create exit from the dungeon */ -} cfm_type; +}; void prepare_change_floor_mode(player_type *creature_ptr, BIT_FLAGS mode); diff --git a/src/floor/object-allocator.h b/src/floor/object-allocator.h index 31fa4d3e6..3e8c3bffb 100644 --- a/src/floor/object-allocator.h +++ b/src/floor/object-allocator.h @@ -2,6 +2,6 @@ #include "system/angband.h" -typedef enum dap_type dap_type; +enum dap_type : int; bool alloc_stairs(player_type *owner_ptr, FEAT_IDX feat, int num, int walls); void alloc_object(player_type *owner_ptr, dap_type set, EFFECT_ID typ, int num); diff --git a/src/floor/object-scanner.h b/src/floor/object-scanner.h index 03d3153ae..419e1e600 100644 --- a/src/floor/object-scanner.h +++ b/src/floor/object-scanner.h @@ -6,11 +6,11 @@ /*! * @brief scan_floor_items() の動作を指定するフラグたち。 */ -typedef enum scan_floor_mode { +enum scan_floor_mode { SCAN_FLOOR_ITEM_TESTER = 1U << 0, /*!< item_tester_hook によるフィルタリングを適用する */ SCAN_FLOOR_ONLY_MARKED = 1U << 1, /*!< マークされたアイテムのみを対象とする */ SCAN_FLOOR_AT_MOST_ONE = 1U << 2, /*!< 高々1つのアイテムしか取得しない */ -} scan_floor_mode; +}; ITEM_NUMBER scan_floor_items(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode, tval_type item_tester_tval); COMMAND_CODE show_floor_items(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width, tval_type item_tester_tval); diff --git a/src/floor/wild.c b/src/floor/wild.c index 3657a0bc5..4d4b228d7 100644 --- a/src/floor/wild.c +++ b/src/floor/wild.c @@ -299,8 +299,8 @@ static void generate_area(player_type *player_ptr, POSITION y, POSITION x, bool floor_ptr->object_level = floor_ptr->base_level; if (player_ptr->town_num) { init_buildings(); - if (border | corner) - init_flags = INIT_CREATE_DUNGEON | INIT_ONLY_FEATURES; + if (border || corner) + init_flags = static_cast(INIT_CREATE_DUNGEON | INIT_ONLY_FEATURES); else init_flags = INIT_CREATE_DUNGEON; @@ -629,7 +629,7 @@ static wilderness_grid w_letter[255]; * @param x 広域マップの幅を返す参照ポインタ * @return なし */ -errr parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int xmax, int *y, int *x) +parse_error_type parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int xmax, int *y, int *x) { if (!(buf[0] == 'W')) return (PARSE_ERROR_GENERIC); @@ -640,12 +640,12 @@ errr parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int x /* Process "W:F::::: */ #ifdef JP case 'E': - return 0; + return PARSE_ERROR_NONE; case 'F': case 'J': #else case 'J': - return 0; + return PARSE_ERROR_NONE; case 'F': case 'E': #endif @@ -654,9 +654,9 @@ errr parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int x int index = zz[0][0]; if (num > 1) - w_letter[index].terrain = atoi(zz[1]); + w_letter[index].terrain = static_cast(atoi(zz[1])); else - w_letter[index].terrain = 0; + w_letter[index].terrain = TERRAIN_EDGE; if (num > 2) w_letter[index].level = (s16b)atoi(zz[2]); @@ -739,7 +739,7 @@ errr parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int x } } - return 0; + return PARSE_ERROR_NONE; } /*! diff --git a/src/floor/wild.h b/src/floor/wild.h index 4af01f4a7..b8527a3fa 100644 --- a/src/floor/wild.h +++ b/src/floor/wild.h @@ -5,8 +5,10 @@ #define NO_TOWN 6 #define SECRET_TOWN 5 +enum parse_error_type : int; + /* Wilderness Terrains */ -typedef enum wt_type { +enum wt_type { TERRAIN_EDGE = 0, /* Edge of the World */ TERRAIN_TOWN = 1, /* Town */ TERRAIN_DEEP_WATER = 2, /* Deep water */ @@ -20,7 +22,7 @@ typedef enum wt_type { TERRAIN_DEEP_LAVA = 10, /* Deep lava */ TERRAIN_MOUNTAIN = 11, /* Mountain */ MAX_WILDERNESS = 12, /* Maximum wilderness index */ -} wt_type; +}; void set_floor_and_wall(DUNGEON_IDX type); void wilderness_gen(player_type *creature_ptr); @@ -28,7 +30,7 @@ void wilderness_gen_small(player_type *creature_ptr); errr init_wilderness(void); void init_wilderness_terrains(void); void seed_wilderness(void); -errr parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int xmax, int *y, int *x); +parse_error_type parse_line_wilderness(player_type *creature_ptr, char *buf, int xmin, int xmax, int *y, int *x); bool change_wild_mode(player_type *creature_ptr, bool encount); /* diff --git a/src/game-option/cheat-types.h b/src/game-option/cheat-types.h index c2b0515ee..733479040 100644 --- a/src/game-option/cheat-types.h +++ b/src/game-option/cheat-types.h @@ -1,8 +1,8 @@ #pragma once -typedef enum cheat_type { +enum cheat_type { CHEAT_OBJECT = 0, CHEAT_MONSTER = 1, CHEAT_DUNGEON = 2, CHEAT_MISC = 3, -} cheat_type; +}; diff --git a/src/game-option/keymap-directory-getter.h b/src/game-option/keymap-directory-getter.h index 65fc30150..d38259f55 100644 --- a/src/game-option/keymap-directory-getter.h +++ b/src/game-option/keymap-directory-getter.h @@ -1,9 +1,9 @@ #pragma once -typedef enum keymap_mode { +enum keymap_mode { KEYMAP_MODE_ORIG = 0, /*!< オリジナルキー配置 / Mode for original keyset commands */ KEYMAP_MODE_ROGUE = 1, /*!< ローグライクキー配置 / Mode for roguelike keyset commands */ KEYMAP_MODES = 2, /*!< キー配置の数 / Number of keymap modes */ -} keymap_mode; +}; int get_keymap_dir(char ch); diff --git a/src/grid/feature-flag-types.h b/src/grid/feature-flag-types.h index c938d42bd..0367a8d4d 100644 --- a/src/grid/feature-flag-types.h +++ b/src/grid/feature-flag-types.h @@ -5,7 +5,7 @@ * Originally from UnAngband, and modified into TR-like style in Hengband */ -typedef enum feature_flag_type { +enum feature_flag_type : int { FF_LOS = 0, /*!< 視界が通る地形である */ FF_PROJECT = 1, /*!< 飛び道具が通過できる地形である */ FF_MOVE = 2, /*!< 移動可能な地形である */ @@ -69,6 +69,6 @@ typedef enum feature_flag_type { FF_CONVERT = 111, /*!< 地形生成処理中の疑似フラグ */ FF_GLASS = 112, /*!< ガラス製の地形である */ FF_FLAG_MAX = 113 -} feature_flag_type; +}; #define FF_FLAG_SIZE (1 + ((FF_FLAG_MAX - 1) / 32)) diff --git a/src/grid/grid.h b/src/grid/grid.h index 02d6bf6b9..e957e0953 100644 --- a/src/grid/grid.h +++ b/src/grid/grid.h @@ -178,7 +178,7 @@ extern bool check_local_illumination(player_type *creature_ptr, POSITION y, POSI extern bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, teleport_flags mode); extern bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION x, teleport_flags mode); -typedef enum grid_bold_type +enum grid_bold_type { GB_FLOOR, GB_EXTRA, @@ -190,7 +190,7 @@ typedef enum grid_bold_type GB_SOLID, GB_SOLID_PERM, GB_SOLID_NOPERM -} grid_bold_type; +}; void place_grid(player_type *player_ptr, grid_type *g_ptr, grid_bold_type pg_type); bool darkened_grid(player_type *player_ptr, grid_type *g_ptr); diff --git a/src/grid/trap.c b/src/grid/trap.c index e49ca49c1..3a3dffe68 100644 --- a/src/grid/trap.c +++ b/src/grid/trap.c @@ -456,7 +456,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) msg_print(_("何かがピカッと光った!", "There is a flash of shimmering light!")); num = 2 + randint1(3); for (i = 0; i < num; i++) { - (void)summon_specific(trapped_ptr, 0, y, x, trapped_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(trapped_ptr, 0, y, x, trapped_ptr->current_floor_ptr->dun_level, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } if (trapped_ptr->current_floor_ptr->dun_level > randint1(100)) /* No nasty effect for low levels */ @@ -633,4 +633,4 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) cave_alter_feat(trapped_ptr, y, x, FF_DISARM); msg_print(_("トラップを粉砕した。", "You destroyed the trap.")); } -} \ No newline at end of file +} diff --git a/src/info-reader/fixed-map-parser.c b/src/info-reader/fixed-map-parser.c index fc04fbd47..5d42a791e 100644 --- a/src/info-reader/fixed-map-parser.c +++ b/src/info-reader/fixed-map-parser.c @@ -232,13 +232,13 @@ static concptr parse_fixed_map_expression(player_type *player_ptr, char **sp, ch * @param xmax 詳細不明 * @return エラーコード */ -errr parse_fixed_map(player_type *player_ptr, concptr name, int ymin, int xmin, int ymax, int xmax) +parse_error_type parse_fixed_map(player_type *player_ptr, concptr name, int ymin, int xmin, int ymax, int xmax) { char buf[1024]; path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, name); FILE *fp = angband_fopen(buf, "r"); if (fp == NULL) - return -1; + return PARSE_ERROR_GENERIC; int num = -1; parse_error_type err = PARSE_ERROR_NONE; diff --git a/src/info-reader/fixed-map-parser.h b/src/info-reader/fixed-map-parser.h index 1f93e2138..72212b22b 100644 --- a/src/info-reader/fixed-map-parser.h +++ b/src/info-reader/fixed-map-parser.h @@ -4,4 +4,4 @@ #include "info-reader/info-reader-util.h" #include "info-reader/parse-error-types.h" -errr parse_fixed_map(player_type *player_ptr, concptr name, int ymin, int xmin, int ymax, int xmax); +parse_error_type parse_fixed_map(player_type *player_ptr, concptr name, int ymin, int xmin, int ymax, int xmax); diff --git a/src/info-reader/general-parser.c b/src/info-reader/general-parser.c index 2224af968..e3345006e 100644 --- a/src/info-reader/general-parser.c +++ b/src/info-reader/general-parser.c @@ -76,15 +76,15 @@ errr init_info_txt(FILE *fp, char *buf, angband_header *head, parse_info_txt_fun * @param buf 解析文字列 * @return エラーコード */ -errr parse_line_feature(floor_type *floor_ptr, char *buf) +parse_error_type parse_line_feature(floor_type *floor_ptr, char *buf) { if (init_flags & INIT_ONLY_BUILDINGS) - return 0; + return PARSE_ERROR_NONE; char *zz[9]; int num = tokenize(buf + 2, 9, zz, 0); if (num <= 1) - return 1; + return PARSE_ERROR_GENERIC; int index = zz[0][0]; letter[index].feature = feat_none; @@ -179,7 +179,7 @@ errr parse_line_feature(floor_type *floor_ptr, char *buf) break; } - return 0; + return PARSE_ERROR_NONE; } /*! @@ -188,28 +188,28 @@ errr parse_line_feature(floor_type *floor_ptr, char *buf) * @param buf 解析文字列 * @return エラーコード */ -errr parse_line_building(char *buf) +parse_error_type parse_line_building(char *buf) { char *zz[1000]; char *s; #ifdef JP if (buf[2] == '$') - return 0; + return PARSE_ERROR_NONE; s = buf + 2; #else if (buf[2] != '$') - return 0; + return PARSE_ERROR_NONE; s = buf + 3; #endif int index = atoi(s); s = angband_strchr(s, ':'); if (!s) - return 1; + return PARSE_ERROR_GENERIC; *s++ = '\0'; if (!*s) - return 1; + return PARSE_ERROR_GENERIC; switch (s[0]) { case 'N': { @@ -240,7 +240,7 @@ errr parse_line_building(char *buf) int n; n = tokenize(s + 2, MAX_CLASS, zz, 0); for (int i = 0; i < MAX_CLASS; i++) { - building[index].member_class[i] = ((i < n) ? (player_class_type)atoi(zz[i]) : 1); + building[index].member_class[i] = static_cast((i < n) ? atoi(zz[i]) : 1); } break; @@ -249,7 +249,7 @@ errr parse_line_building(char *buf) int n; n = tokenize(s + 2, MAX_RACES, zz, 0); for (int i = 0; i < MAX_RACES; i++) { - building[index].member_race[i] = ((i < n) ? (player_race_type)atoi(zz[i]) : 1); + building[index].member_race[i] = static_cast((i < n) ? atoi(zz[i]) : 1); } break; @@ -271,5 +271,5 @@ errr parse_line_building(char *buf) } } - return 0; + return PARSE_ERROR_NONE; } diff --git a/src/info-reader/general-parser.h b/src/info-reader/general-parser.h index c0bb32c55..f9f20ec73 100644 --- a/src/info-reader/general-parser.h +++ b/src/info-reader/general-parser.h @@ -2,6 +2,8 @@ #include "system/angband.h" +enum parse_error_type : int; + typedef struct dungeon_grid { FEAT_IDX feature; /* Terrain feature */ MONSTER_IDX monster; /* Monster */ @@ -19,5 +21,5 @@ extern dungeon_grid letter[255]; typedef struct angband_header angband_header; typedef errr (*parse_info_txt_func)(char *buf, angband_header *head); errr init_info_txt(FILE *fp, char *buf, angband_header *head, parse_info_txt_func parse_info_txt_line); -errr parse_line_feature(floor_type *floor_ptr, char *buf); -errr parse_line_building(char *buf); +parse_error_type parse_line_feature(floor_type *floor_ptr, char *buf); +parse_error_type parse_line_building(char *buf); diff --git a/src/info-reader/magic-reader.c b/src/info-reader/magic-reader.c index 3a15a93b2..655003f8c 100644 --- a/src/info-reader/magic-reader.c +++ b/src/info-reader/magic-reader.c @@ -51,7 +51,7 @@ errr parse_m_info(char *buf, angband_header *head) else if (streq(book, "HISSATSU")) m_ptr->spell_book = TV_HISSATSU_BOOK; else if (streq(book, "NONE")) - m_ptr->spell_book = 0; + m_ptr->spell_book = TV_NONE; else return 5; diff --git a/src/info-reader/parse-error-types.h b/src/info-reader/parse-error-types.h index 3f899cf57..46ad00a92 100644 --- a/src/info-reader/parse-error-types.h +++ b/src/info-reader/parse-error-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum parse_error_type { +enum parse_error_type : int { PARSE_ERROR_NONE = 0, PARSE_ERROR_GENERIC = 1, PARSE_ERROR_ABSOLETE_FILE = 2, @@ -13,4 +13,4 @@ typedef enum parse_error_type { PARSE_ERROR_TOO_FEW_ARGUMENTS = 9, PARSE_ERROR_UNDEFINED_TERRAIN_TAG = 10, PARSE_ERROR_MAX = 11, -} parse_error_type; +}; diff --git a/src/info-reader/random-grid-effect-types.h b/src/info-reader/random-grid-effect-types.h index dbfd2a916..e45caef6e 100644 --- a/src/info-reader/random-grid-effect-types.h +++ b/src/info-reader/random-grid-effect-types.h @@ -1,7 +1,7 @@ #pragma once /* Random dungeon grid effects */ -typedef enum rdge_type { +enum rdge_type { RANDOM_NONE = 0x00000000, RANDOM_FEATURE = 0x00000001, RANDOM_MONSTER = 0x00000002, @@ -9,4 +9,4 @@ typedef enum rdge_type { RANDOM_EGO = 0x00000008, RANDOM_ARTIFACT = 0x00000010, RANDOM_TRAP = 0x00000020, -} rdge_type; +}; diff --git a/src/inventory/floor-item-getter.c b/src/inventory/floor-item-getter.c index 7e3ca6aa7..15c94daa1 100644 --- a/src/inventory/floor-item-getter.c +++ b/src/inventory/floor-item-getter.c @@ -50,7 +50,7 @@ static bool check_floor_item_tag_aux(player_type *owner_ptr, fis_type *fis_ptr, = scan_floor_items(owner_ptr, fis_ptr->floor_list, owner_ptr->y, owner_ptr->x, SCAN_FLOOR_ITEM_TESTER | SCAN_FLOOR_ONLY_MARKED, fis_ptr->tval); if (get_tag_floor(owner_ptr->current_floor_ptr, &fis_ptr->k, *prev_tag, fis_ptr->floor_list, fis_ptr->floor_num)) { *fis_ptr->cp = 0 - fis_ptr->floor_list[fis_ptr->k]; - fis_ptr->tval = 0; + fis_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -63,7 +63,7 @@ static bool check_floor_item_tag_aux(player_type *owner_ptr, fis_type *fis_ptr, if (!item_tester_okay(owner_ptr, &owner_ptr->current_floor_ptr->o_list[0 - (*fis_ptr->cp)], fis_ptr->tval) && ((fis_ptr->mode & USE_FULL) == 0)) return FALSE; - fis_ptr->tval = 0; + fis_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -118,7 +118,7 @@ static bool check_floor_item_tag_inventory(player_type *owner_ptr, fis_type *fis return get_floor_item_tag_inventory(owner_ptr, fis_ptr, prev_tag); if (get_item_okay(owner_ptr, *fis_ptr->cp, fis_ptr->tval)) { - fis_ptr->tval = 0; + fis_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -140,7 +140,7 @@ static bool check_floor_item_tag(player_type *owner_ptr, fis_type *fis_ptr, char return FALSE; if (fis_ptr->force && (*fis_ptr->cp == INVEN_FORCE)) { - fis_ptr->tval = 0; + fis_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -189,7 +189,7 @@ static void test_equipment_floor(player_type *owner_ptr, fis_type *fis_ptr) if (!use_menu) return; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) if (owner_ptr->select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, &owner_ptr->inventory_list[i], fis_ptr->tval) || (fis_ptr->mode & USE_FULL)) fis_ptr->max_equip++; @@ -840,7 +840,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp command_see = FALSE; } - fis_ptr->tval = 0; + fis_ptr->tval = TV_NONE; item_tester_hook = NULL; if (fis_ptr->toggle) toggle_inventory_equipment(owner_ptr); diff --git a/src/inventory/inventory-curse.c b/src/inventory/inventory-curse.c index 0b16bf0dd..f42b6fa55 100644 --- a/src/inventory/inventory-curse.c +++ b/src/inventory/inventory-curse.c @@ -46,7 +46,7 @@ static void choise_cursed_item(player_type *creature_ptr, BIT_FLAGS flag, object if (!is_specific_curse(flag)) return; - tr_type cf = 0; + tr_type cf = TR_STR; BIT_FLAGS flgs[TR_FLAG_SIZE]; object_flags(creature_ptr, o_ptr, flgs); switch (flag) { @@ -116,7 +116,7 @@ object_type *choose_cursed_obj_name(player_type *creature_ptr, BIT_FLAGS flag) if (!(creature_ptr->cursed & flag)) return NULL; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; if (o_ptr->curse_flags & flag) { choices[number] = i; @@ -143,7 +143,7 @@ static void curse_teleport(player_type *creature_ptr) GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; int i_keep = 0, count = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) diff --git a/src/inventory/inventory-slot-types.h b/src/inventory/inventory-slot-types.h index 5295d80a3..d69096abe 100644 --- a/src/inventory/inventory-slot-types.h +++ b/src/inventory/inventory-slot-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum inventory_slot_type { +enum inventory_slot_type { INVEN_PACK = 23, /*!< アイテムスロット…所持品(0~) */ INVEN_MAIN_HAND = 24, /*!< アイテムスロット…利手 */ INVEN_SUB_HAND = 25, /*!< アイテムスロット…逆手 */ @@ -18,4 +18,4 @@ typedef enum inventory_slot_type { INVEN_TOTAL = 36, /*!< Total number of inventory_list slots (hard-coded). */ INVEN_NONE = 1000, /*!< アイテムスロット非選択状態 */ INVEN_FORCE = 1111, /*!< inventory_list slot for selecting force (hard-coded). */ -} inventory_slot_type; +}; diff --git a/src/inventory/item-getter.c b/src/inventory/item-getter.c index 237aaed03..e251693c3 100644 --- a/src/inventory/item-getter.c +++ b/src/inventory/item-getter.c @@ -61,7 +61,7 @@ static bool check_item_tag_aux(player_type *owner_ptr, item_selection_type *item if (!item_tester_okay(owner_ptr, o_ptr, item_selection_ptr->tval) && ((item_selection_ptr->mode & USE_FULL) == 0)) return FALSE; - item_selection_ptr->tval = 0; + item_selection_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -99,7 +99,7 @@ static bool check_item_tag_inventory(player_type *owner_ptr, item_selection_type } *item_selection_ptr->cp = item_selection_ptr->k; - item_selection_ptr->tval = 0; + item_selection_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -108,7 +108,7 @@ static bool check_item_tag_inventory(player_type *owner_ptr, item_selection_type if (!get_item_okay(owner_ptr, *item_selection_ptr->cp, item_selection_ptr->tval)) return FALSE; - item_selection_ptr->tval = 0; + item_selection_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -127,7 +127,7 @@ static bool check_item_tag(player_type *owner_ptr, item_selection_type *item_sel return FALSE; if (item_selection_ptr->mode & USE_FORCE && (*item_selection_ptr->cp == INVEN_FORCE)) { - item_selection_ptr->tval = 0; + item_selection_ptr->tval = TV_NONE; item_tester_hook = NULL; command_cmd = 0; return TRUE; @@ -605,7 +605,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str, command_see = FALSE; } - item_selection_ptr->tval = 0; + item_selection_ptr->tval = TV_NONE; item_tester_hook = NULL; if (item_selection_ptr->toggle) toggle_inventory_equipment(owner_ptr); diff --git a/src/inventory/player-inventory.c b/src/inventory/player-inventory.c index 20b39bbeb..e5d29d76d 100644 --- a/src/inventory/player-inventory.c +++ b/src/inventory/player-inventory.c @@ -64,7 +64,7 @@ static bool py_pickup_floor_aux(player_type *owner_ptr) item_tester_hook = check_store_item_to_inventory; concptr q = _("どれを拾いますか?", "Get which item? "); concptr s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor."); - if (choose_object(owner_ptr, &item, q, s, (USE_FLOOR), 0)) + if (choose_object(owner_ptr, &item, q, s, (USE_FLOOR), TV_NONE)) this_o_idx = 0 - item; else return FALSE; diff --git a/src/io-dump/character-dump.c b/src/io-dump/character-dump.c index db9b6b8b1..a56f848e2 100644 --- a/src/io-dump/character-dump.c +++ b/src/io-dump/character-dump.c @@ -468,7 +468,7 @@ static void dump_aux_equipment_inventory(player_type *creature_ptr, FILE *fff) GAME_TEXT o_name[MAX_NLEN]; if (creature_ptr->equip_cnt) { fprintf(fff, _(" [キャラクタの装備]\n\n", " [Character Equipment]\n\n")); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[i], 0); if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(creature_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(creature_ptr))) && has_two_handed_weapons(creature_ptr)) diff --git a/src/io-dump/random-art-info-dumper.c b/src/io-dump/random-art-info-dumper.c index 86fe60f92..015f5453c 100644 --- a/src/io-dump/random-art-info-dumper.c +++ b/src/io-dump/random-art-info-dumper.c @@ -84,7 +84,7 @@ void spoil_random_artifact(player_type *creature_ptr, concptr fname) sprintf(buf, "Random artifacts list.\r"); spoiler_underline(buf); for (int j = 0; group_artifact[j].tval; j++) { - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { q_ptr = &creature_ptr->inventory_list[i]; spoil_random_artifact_aux(creature_ptr, q_ptr, j); } diff --git a/src/io-dump/special-class-dump.c b/src/io-dump/special-class-dump.c index e8f2ecfae..9f3d028ac 100644 --- a/src/io-dump/special-class-dump.c +++ b/src/io-dump/special-class-dump.c @@ -31,7 +31,7 @@ static void dump_magic_eater(player_type *creature_ptr, FILE *fff) fprintf(fff, _("\n\n [取り込んだ魔法道具]\n", "\n\n [Magic devices eaten]\n")); for (int ext = 0; ext < 3; ext++) { - tval_type tval = 0; + tval_type tval = TV_NONE; switch (ext) { case 0: tval = TV_STAFF; @@ -168,7 +168,7 @@ static void dump_blue_mage(player_type *creature_ptr, FILE *fff) for (int spell_type = 1; spell_type < 6; spell_type++) { col++; learnt_spell_table learnt_magic; - add_monster_spell_type(p, col, spell_type, &learnt_magic); + add_monster_spell_type(p, col, static_cast(spell_type), &learnt_magic); int num = 0; for (int i = 0; i < 32; i++) { diff --git a/src/io/inet.c b/src/io/inet.c index d618301b3..4168a675c 100644 --- a/src/io/inet.c +++ b/src/io/inet.c @@ -71,7 +71,7 @@ void set_proxy(char *default_url, int default_port) /* 文字列の長さを調べ、必要なメモリを確保 */ len = strlen(s); - proxy = malloc(len + 1); + proxy = static_cast(malloc(len + 1)); /* ポート番号があるかどうかを調べ、あればproxy_portに設定。 */ --len; diff --git a/src/io/input-key-requester.c b/src/io/input-key-requester.c index 760d4c094..d7700a3af 100644 --- a/src/io/input-key-requester.c +++ b/src/io/input-key-requester.c @@ -107,7 +107,7 @@ static char inkey_from_menu(player_type *player_ptr) } max_num = i; - kisuu = max_num % 2; + kisuu = (max_num % 2) == 1; put_str(_("》", "> "), basey + 1 + num / 2, basex + 2 + (num % 2) * 24); move_cursor_relative(player_ptr->y, player_ptr->x); @@ -337,7 +337,7 @@ void request_command(player_type *player_ptr, int shopping) caretcmd = command_cmd; #endif - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &player_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -364,4 +364,4 @@ void request_command(player_type *player_ptr, int shopping) } prt("", 0, 0); -} \ No newline at end of file +} diff --git a/src/io/record-play-movie.c b/src/io/record-play-movie.c index 3a1fb0b94..484dffdc5 100644 --- a/src/io/record-play-movie.c +++ b/src/io/record-play-movie.c @@ -82,7 +82,7 @@ static errr init_buffer(void) fresh_queue.next = fresh_queue.tail = 0; ring.wptr = ring.rptr = ring.inlen = 0; fresh_queue.time[0] = 0; - ring.buf = malloc(RINGBUF_SIZE); + ring.buf = static_cast(malloc(RINGBUF_SIZE)); if (ring.buf == NULL) return -1; diff --git a/src/io/report.c b/src/io/report.c index 34867fa2a..74c6f5884 100644 --- a/src/io/report.c +++ b/src/io/report.c @@ -68,13 +68,13 @@ typedef struct { static BUF *buf_new(void) { BUF *p; - p = malloc(sizeof(BUF)); + p = static_cast(malloc(sizeof(BUF))); if (!p) return NULL; p->size = 0; p->max_size = BUFSIZE; - p->data = malloc(BUFSIZE); + p->data = static_cast(malloc(BUFSIZE)); if (!p->data) { free(p); return NULL; @@ -104,7 +104,7 @@ static int buf_append(BUF *buf, concptr data, size_t size) { while (buf->size + size > buf->max_size) { char *tmp; - if ((tmp = malloc(buf->max_size * 2)) == NULL) + if ((tmp = static_cast(malloc(buf->max_size * 2))) == NULL) return -1; memcpy(tmp, buf->data, buf->max_size); @@ -149,7 +149,7 @@ static int buf_sprintf(BUF *buf, concptr fmt, ...) size_t read_callback(char *buffer, size_t size, size_t nitems, void *userdata) { - BUF *buf = userdata; + BUF *buf = static_cast(userdata); const size_t remain = buf->size - buf->read_head; const size_t copy_size = MIN(size * nitems, remain); diff --git a/src/knowledge/knowledge-inventory.c b/src/knowledge/knowledge-inventory.c index c1057f433..df6ee3815 100644 --- a/src/knowledge/knowledge-inventory.c +++ b/src/knowledge/knowledge-inventory.c @@ -217,7 +217,7 @@ static void show_wearing_equipment_resistances(player_type *creature_ptr, tval_t { char where[32]; strcpy(where, _("装", "E ")); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; if (!check_item_knowledge(o_ptr, tval)) continue; @@ -287,11 +287,11 @@ void do_cmd_knowledge_inventory(player_type *creature_ptr) fprintf(fff, "%s\n", inven_res_label); int label_number = 0; - for (tval_type tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++) { + for (int tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++) { reset_label_number(&label_number, fff); - show_wearing_equipment_resistances(creature_ptr, tval, &label_number, fff); - show_holding_equipment_resistances(creature_ptr, tval, &label_number, fff); - show_home_equipment_resistances(creature_ptr, tval, &label_number, fff); + show_wearing_equipment_resistances(creature_ptr, static_cast(tval), &label_number, fff); + show_holding_equipment_resistances(creature_ptr, static_cast(tval), &label_number, fff); + show_home_equipment_resistances(creature_ptr, static_cast(tval), &label_number, fff); } angband_fclose(fff); diff --git a/src/knowledge/knowledge-monsters.c b/src/knowledge/knowledge-monsters.c index be88a9385..14f545154 100644 --- a/src/knowledge/knowledge-monsters.c +++ b/src/knowledge/knowledge-monsters.c @@ -215,7 +215,7 @@ void do_cmd_knowledge_kill_count(player_type *creature_ptr) continue; #ifdef JP - char *number_of_kills = angband_strchr("pt", r_ptr->d_char) ? "人" : "体"; + concptr number_of_kills = angband_strchr("pt", r_ptr->d_char) ? "人" : "体"; fprintf(fff, " %3d %sの %s\n", (int)this_monster, number_of_kills, r_name + r_ptr->name); #else if (this_monster < 2) { diff --git a/src/load/load-v1-5-0.c b/src/load/load-v1-5-0.c index dfab30ba8..d49a11df4 100644 --- a/src/load/load-v1-5-0.c +++ b/src/load/load-v1-5-0.c @@ -68,7 +68,7 @@ void rd_item_old(player_type *player_ptr, object_type *o_ptr) /* Type/Subtype */ rd_byte(&tmp8u); - o_ptr->tval = tmp8u; + o_ptr->tval = static_cast(tmp8u); rd_byte(&tmp8u); o_ptr->sval = tmp8u; diff --git a/src/load/load-v1-5-0.h b/src/load/load-v1-5-0.h index 6c4a1f35a..c3bd50be7 100644 --- a/src/load/load-v1-5-0.h +++ b/src/load/load-v1-5-0.h @@ -4,7 +4,7 @@ #include "system/monster-type-definition.h" // TODO: 更に分割する可能性が中程度あるのでヘッダに置いておく -typedef enum old_monster_resistance_type { +enum old_monster_resistance_type { RF3_IM_ACID = 0x00010000, /* Resist acid a lot */ RF3_IM_ELEC = 0x00020000, /* Resist elec a lot */ RF3_IM_FIRE = 0x00040000, /* Resist fire a lot */ @@ -17,9 +17,9 @@ typedef enum old_monster_resistance_type { RF3_RES_NEXU = 0x02000000, /* Resist nexus */ RF3_RES_DISE = 0x04000000, /* Resist disenchantment */ RF3_RES_ALL = 0x08000000, /* Resist all */ -} old_monster_resistance_type; +}; -typedef enum old_monster_breath_type { +enum old_monster_breath_type { RF4_BR_LITE = 0x00004000, /* Breathe Lite */ RF4_BR_DARK = 0x00008000, /* Breathe Dark */ RF4_BR_CONF = 0x00010000, /* Breathe Confusion */ @@ -30,7 +30,7 @@ typedef enum old_monster_breath_type { RF4_BR_GRAV = 0x00800000, /* Breathe Gravity */ RF4_BR_SHAR = 0x01000000, /* Breathe Shards */ RF4_BR_WALL = 0x04000000, /* Breathe Force */ -} old_monster_breath_type; +}; extern const int OLD_QUEST_WATER_CAVE; extern const int QUEST_OLD_CASTLE; diff --git a/src/load/load-zangband.c b/src/load/load-zangband.c index f561f6d2b..a785e46dd 100644 --- a/src/load/load-zangband.c +++ b/src/load/load-zangband.c @@ -243,22 +243,22 @@ void set_zangband_class(player_type *creature_ptr) { if (z_older_than(10, 2, 2) && (creature_ptr->pclass == CLASS_BEASTMASTER) && !creature_ptr->is_dead) { creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); } if (z_older_than(10, 3, 2) && (creature_ptr->pclass == CLASS_ARCHER) && !creature_ptr->is_dead) { creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); } if (z_older_than(10, 2, 6) && (creature_ptr->pclass == CLASS_SORCERER) && !creature_ptr->is_dead) { creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp; - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); } if (z_older_than(10, 4, 7) && (creature_ptr->pclass == CLASS_BLUE_MAGE) && !creature_ptr->is_dead) { creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); } } diff --git a/src/load/old-feature-types.h b/src/load/old-feature-types.h index ddd2cd898..e9fb3d32d 100644 --- a/src/load/old-feature-types.h +++ b/src/load/old-feature-types.h @@ -1,7 +1,7 @@ #pragma once /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/ -typedef enum old_feature_type { +enum old_feature_type { OLD_FEAT_INVIS = 0x02, OLD_FEAT_RUNE_PROTECTION = 0x03, OLD_FEAT_QUEST_ENTER = 0x08, @@ -9,4 +9,4 @@ typedef enum old_feature_type { OLD_FEAT_RUNE_EXPLOSION = 0x40, OLD_FEAT_BLDG_1 = 0x81, OLD_FEAT_MIRROR = 0xc3, -} old_feature_type; +}; diff --git a/src/load/savedata-flag-types.h b/src/load/savedata-flag-types.h index b47c3e0d5..a354c0033 100644 --- a/src/load/savedata-flag-types.h +++ b/src/load/savedata-flag-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum savedata_item_flag_type { +enum savedata_item_flag_type { SAVE_ITEM_PVAL = 0x00000001, SAVE_ITEM_DISCOUNT = 0x00000002, SAVE_ITEM_NUMBER = 0x00000004, @@ -30,9 +30,9 @@ typedef enum savedata_item_flag_type { SAVE_ITEM_INSCRIPTION = 0x04000000, SAVE_ITEM_ART_NAME = 0x08000000, SAVE_ITEM_ART_FLAGS4 = 0x10000000, -} savedata_item_flag_type; +}; -typedef enum savedata_monster_flag_type { +enum savedata_monster_flag_type { SAVE_MON_AP_R_IDX = 0x00000001, SAVE_MON_SUB_ALIGN = 0x00000002, SAVE_MON_CSLEEP = 0x00000004, @@ -49,4 +49,4 @@ typedef enum savedata_monster_flag_type { SAVE_MON_MFLAG2 = 0x00002000, SAVE_MON_NICKNAME = 0x00004000, SAVE_MON_PARENT = 0x00008000, -} savedata_monster_flag_type; +}; diff --git a/src/load/world-loader.c b/src/load/world-loader.c index f3e8ba4e0..0ad0062ce 100644 --- a/src/load/world-loader.c +++ b/src/load/world-loader.c @@ -152,7 +152,7 @@ void rd_global_configurations(player_type *creature_ptr) byte tmp8u; rd_byte(&tmp8u); - creature_ptr->is_dead = tmp8u; + creature_ptr->is_dead = (bool)tmp8u; rd_byte(&creature_ptr->feeling); rd_world_info(creature_ptr); diff --git a/src/locale/japanese.c b/src/locale/japanese.c index a12a44ac7..21fe121cc 100644 --- a/src/locale/japanese.c +++ b/src/locale/japanese.c @@ -355,8 +355,8 @@ static bool is_ascii_str(concptr str) #include static const struct ms_to_jis_unicode_conv_t { - char from[3]; - char to[3]; + unsigned char from[3]; + unsigned char to[3]; } ms_to_jis_unicode_conv[] = { { { 0xef, 0xbd, 0x9e }, { 0xe3, 0x80, 0x9c } }, /* FULLWIDTH TILDE -> WAVE DASH */ { { 0xef, 0xbc, 0x8d }, { 0xe2, 0x88, 0x92 } }, /* FULLWIDTH HYPHEN-MINUS -> MINUS SIGN */ diff --git a/src/lore/lore-calculator.c b/src/lore/lore-calculator.c index 138894f17..069105db5 100644 --- a/src/lore/lore-calculator.c +++ b/src/lore/lore-calculator.c @@ -109,7 +109,7 @@ bool know_damage(MONRACE_IDX r_idx, int i) * @param msg 表示する文字列 * @return なし */ -void set_damage(player_type *player_ptr, lore_type *lore_ptr, monster_spell_type ms_type, char *msg) +void set_damage(player_type *player_ptr, lore_type *lore_ptr, monster_spell_type ms_type, concptr msg) { MONRACE_IDX r_idx = lore_ptr->r_idx; int base_damage = monspell_race_damage(player_ptr, ms_type, r_idx, BASE_DAM); diff --git a/src/lore/lore-calculator.h b/src/lore/lore-calculator.h index 75276c15e..2603344a4 100644 --- a/src/lore/lore-calculator.h +++ b/src/lore/lore-calculator.h @@ -7,5 +7,5 @@ void dice_to_string(int base_damage, int dice_num, int dice_side, int dice_mult, int dice_div, char *msg); bool know_armour(MONRACE_IDX r_idx, const bool know_everything); bool know_damage(MONRACE_IDX r_idx, int i); -void set_damage(player_type *player_ptr, lore_type *lore_ptr, monster_spell_type ms_type, char *msg); +void set_damage(player_type *player_ptr, lore_type *lore_ptr, monster_spell_type ms_type, concptr msg); void set_drop_flags(lore_type *lore_ptr); diff --git a/src/lore/lore-util.h b/src/lore/lore-util.h index 9ec8675ed..1279343a5 100644 --- a/src/lore/lore-util.h +++ b/src/lore/lore-util.h @@ -3,11 +3,11 @@ #include "system/angband.h" #include "system/monster-race-definition.h" -typedef enum monster_sex { +enum monster_sex { MSEX_NONE = 0, MSEX_MALE = 1, MSEX_FEMALE = 2, -} monster_sex; +}; typedef struct lore_type { #ifdef JP @@ -50,12 +50,12 @@ typedef struct lore_type { int count; } lore_type; -typedef enum monster_lore_mode { +enum monster_lore_mode { MONSTER_LORE_NONE, MONSTER_LORE_NORMAL, MONSTER_LORE_RESEARCH, MONSTER_LORE_DEBUG -} monster_lore_mode; +}; typedef void (*hook_c_roff_pf)(TERM_COLOR attr, concptr str); extern hook_c_roff_pf hook_c_roff; diff --git a/src/maid-x11.c b/src/maid-x11.c index 21f14ffd1..904b073bc 100644 --- a/src/maid-x11.c +++ b/src/maid-x11.c @@ -811,7 +811,7 @@ static XImage *ResizeImage(Display *dpy, XImage *Im, char *Data; if (smoothRescaling && (ix != ox || iy != oy) && - visual->class == TrueColor) + visual->c_class == TrueColor) { return ResizeImageSmooth(dpy, Im, ix, iy, ox, oy); } diff --git a/src/main-win.c b/src/main-win.c index b9c3a2a56..44858c939 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -451,7 +451,7 @@ static DIBINIT infMask; static bool can_use_sound = FALSE; /* - * Show sub-windows even when Hengband is not in focus + * Show sub-windows even when Hengband is not in focus */ static bool keep_subwindows = TRUE; @@ -495,7 +495,6 @@ static concptr AngList = "AngList"; */ static concptr ANGBAND_DIR_XTRA_GRAF; static concptr ANGBAND_DIR_XTRA_SOUND; -static concptr ANGBAND_DIR_XTRA_MUSIC; static concptr ANGBAND_DIR_XTRA_HELP; static concptr ANGBAND_DIR_XTRA_MUSIC; @@ -586,7 +585,7 @@ static int init_bg(void) if (use_bg == 0) return 0; - hBG = LoadImage(NULL, bmfile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + hBG = static_cast(LoadImage(NULL, bmfile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); if (!hBG) { plog_fmt(_("壁紙用ビットマップ '%s' を読み込めません。", "Can't load the bitmap file '%s'."), bmfile); use_bg = 0; @@ -611,7 +610,7 @@ static void DrawBG(HDC hdc, RECT *r) int shgt = bm.bmHeight; HDC hdcSrc = CreateCompatibleDC(hdc); - HBITMAP hOld = SelectObject(hdcSrc, hBG); + HBITMAP hOld = static_cast(SelectObject(hdcSrc, hBG)); do { int sx = nx % swid; @@ -1087,7 +1086,7 @@ static int new_palette(void) lppe = NULL; nEntries = 0; - HPALETTE hBmPal = infGraph.hPalette; + HPALETTE hBmPal = static_cast(infGraph.hPalette); if (hBmPal) { lppeSize = 256 * sizeof(PALETTEENTRY); lppe = (LPPALETTEENTRY)ralloc(lppeSize); @@ -1226,7 +1225,7 @@ static bool init_graphics(void) } current_graphics_mode = arg_graphics; - return (current_graphics_mode); + return current_graphics_mode != 0; } /* @@ -1300,7 +1299,7 @@ static errr term_force_font(term_data *td, concptr path) TEXTMETRIC tm; hdcDesktop = GetDC(HWND_DESKTOP); - hfOld = SelectObject(hdcDesktop, td->font_id); + hfOld = static_cast(SelectObject(hdcDesktop, td->font_id)); GetTextMetrics(hdcDesktop, &tm); SelectObject(hdcDesktop, hfOld); ReleaseDC(HWND_DESKTOP, hdcDesktop); @@ -1369,8 +1368,8 @@ void term_inversed_area(HWND hWnd, int x, int y, int w, int h) HDC hdc = GetDC(hWnd); HBRUSH myBrush = CreateSolidBrush(RGB(255, 255, 255)); - HBRUSH oldBrush = SelectObject(hdc, myBrush); - HPEN oldPen = SelectObject(hdc, GetStockObject(NULL_PEN)); + HBRUSH oldBrush = static_cast(SelectObject(hdc, myBrush)); + HPEN oldPen = static_cast(SelectObject(hdc, GetStockObject(NULL_PEN))); PatBlt(hdc, tx, ty, tw, th, PATINVERT); @@ -1429,13 +1428,13 @@ static errr term_xtra_win_react(player_type *player_ptr) select_floor_music(player_ptr); } - if (use_graphics != arg_graphics) { + if (use_graphics != (arg_graphics > 0)) { if (arg_graphics && !init_graphics()) { plog(_("グラフィックスを初期化できません!", "Cannot initialize graphics!")); arg_graphics = GRAPHICS_NONE; } - use_graphics = arg_graphics; + use_graphics = (arg_graphics > 0); reset_visuals(player_ptr, process_autopick_file_command); } @@ -1829,8 +1828,8 @@ static errr term_text_win(int x, int y, int n, TERM_COLOR a, concptr s) #ifdef JP if (use_bigtile && *(s + i) == "■"[0] && *(s + i + 1) == "■"[1]) { rc.right += td->font_wid; - oldBrush = SelectObject(hdc, myBrush); - oldPen = SelectObject(hdc, GetStockObject(NULL_PEN)); + oldBrush = static_cast(SelectObject(hdc, myBrush)); + oldPen = static_cast(SelectObject(hdc, GetStockObject(NULL_PEN))); Rectangle(hdc, rc.left, rc.top, rc.right + 1, rc.bottom + 1); SelectObject(hdc, oldBrush); SelectObject(hdc, oldPen); @@ -1847,8 +1846,8 @@ static errr term_text_win(int x, int y, int n, TERM_COLOR a, concptr s) rc.left += 2 * td->tile_wid; rc.right += 2 * td->tile_wid; } else if (*(s + i) == 127) { - oldBrush = SelectObject(hdc, myBrush); - oldPen = SelectObject(hdc, GetStockObject(NULL_PEN)); + oldBrush = static_cast(SelectObject(hdc, myBrush)); + oldPen = static_cast(SelectObject(hdc, GetStockObject(NULL_PEN))); Rectangle(hdc, rc.left, rc.top, rc.right + 1, rc.bottom + 1); SelectObject(hdc, oldBrush); SelectObject(hdc, oldPen); @@ -1861,8 +1860,8 @@ static errr term_text_win(int x, int y, int n, TERM_COLOR a, concptr s) } #else if (*(s + i) == 127) { - oldBrush = SelectObject(hdc, myBrush); - oldPen = SelectObject(hdc, GetStockObject(NULL_PEN)); + oldBrush = static_cast(SelectObject(hdc, myBrush)); + oldPen = static_cast(SelectObject(hdc, GetStockObject(NULL_PEN))); Rectangle(hdc, rc.left, rc.top, rc.right + 1, rc.bottom + 1); SelectObject(hdc, oldBrush); SelectObject(hdc, oldPen); @@ -1925,7 +1924,7 @@ static errr term_pict_win(TERM_LEN x, TERM_LEN y, int n, const TERM_COLOR *ap, c TERM_LEN y2 = y * h2 + td->size_oh1 + infGraph.OffsetY; HDC hdc = GetDC(td->w); HDC hdcSrc = CreateCompatibleDC(hdc); - HBITMAP hbmSrcOld = SelectObject(hdcSrc, infGraph.hBitmap); + HBITMAP hbmSrcOld = static_cast(SelectObject(hdcSrc, infGraph.hBitmap)); if (arg_graphics == GRAPHICS_ADAM_BOLT || arg_graphics == GRAPHICS_HENGBAND) { hdcMask = CreateCompatibleDC(hdc); @@ -3558,7 +3557,8 @@ static void init_stuff(void) */ static spoiler_output_status create_debug_spoiler(LPSTR cmd_line) { - char *s, *option; + char *s; + concptr option; s = cmd_line; if (!*s) return SPOILER_OUTPUT_CANCEL; @@ -3631,7 +3631,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC wc.hInstance = hInst; wc.hIcon = hIcon = LoadIcon(hInst, AppName); wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = GetStockObject(BLACK_BRUSH); + wc.hbrBackground = static_cast(GetStockObject(BLACK_BRUSH)); wc.lpszMenuName = AppName; wc.lpszClassName = AppName; diff --git a/src/main-x11.c b/src/main-x11.c index d4f8058b7..e4d82a1f2 100644 --- a/src/main-x11.c +++ b/src/main-x11.c @@ -523,7 +523,7 @@ static errr Infowin_prepare(Window xid) #ifdef USE_XFT Visual *vis = DefaultVisual(Metadpy->dpy, 0); - if (vis->class != TrueColor) { + if (vis->c_class != TrueColor) { quit_fmt("Display does not support truecolor.\n"); } iwin->draw = XftDrawCreate(Metadpy->dpy, iwin->win, vis, Metadpy->cmap); @@ -672,7 +672,7 @@ static concptr opcode_pairs[] = */ static int Infoclr_Opcode(concptr str) { - register int i; + int i; for (i = 0; opcode_pairs[i * 2]; ++i) { if (streq(opcode_pairs[i * 2], str)) { return (atoi(opcode_pairs[i * 2 + 1])); @@ -970,7 +970,7 @@ static errr Infofnt_text_non(int x, int y, concptr str, int len) /* * Hack -- cursor color */ -static infoclr * xor ; +static infoclr * xor_ ; /* * Actual color table @@ -1879,15 +1879,15 @@ static errr Term_curs_x11(int x, int y) { if (use_graphics) { #ifdef USE_XFT - XftDrawRect(Infowin->draw, &xor->fg, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->wid - 1, Infofnt->hgt - 1); - XftDrawRect(Infowin->draw, &xor->fg, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->wid - 3, Infofnt->hgt - 3); + XftDrawRect(Infowin->draw, &xor_->fg, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->wid - 1, Infofnt->hgt - 1); + XftDrawRect(Infowin->draw, &xor_->fg, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->wid - 3, Infofnt->hgt - 3); #else - XDrawRectangle(Metadpy->dpy, Infowin->win, xor->gc, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->wid - 1, Infofnt->hgt - 1); + XDrawRectangle(Metadpy->dpy, Infowin->win, xor_->gc, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->wid - 1, Infofnt->hgt - 1); XDrawRectangle( - Metadpy->dpy, Infowin->win, xor->gc, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->wid - 3, Infofnt->hgt - 3); + Metadpy->dpy, Infowin->win, xor_->gc, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->wid - 3, Infofnt->hgt - 3); #endif } else { - Infoclr_set(xor); + Infoclr_set(xor_); Infofnt_text_non(x, y, " ", 1); } @@ -1901,16 +1901,16 @@ static errr Term_bigcurs_x11(int x, int y) { if (use_graphics) { #ifdef USE_XFT - XftDrawRect(Infowin->draw, &xor->fg, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->twid - 1, Infofnt->hgt - 1); - XftDrawRect(Infowin->draw, &xor->fg, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->twid - 3, Infofnt->hgt - 3); + XftDrawRect(Infowin->draw, &xor_->fg, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->twid - 1, Infofnt->hgt - 1); + XftDrawRect(Infowin->draw, &xor_->fg, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->twid - 3, Infofnt->hgt - 3); #else XDrawRectangle( - Metadpy->dpy, Infowin->win, xor->gc, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->twid - 1, Infofnt->hgt - 1); + Metadpy->dpy, Infowin->win, xor_->gc, x * Infofnt->wid + Infowin->ox, y * Infofnt->hgt + Infowin->oy, Infofnt->twid - 1, Infofnt->hgt - 1); XDrawRectangle( - Metadpy->dpy, Infowin->win, xor->gc, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->twid - 3, Infofnt->hgt - 3); + Metadpy->dpy, Infowin->win, xor_->gc, x * Infofnt->wid + Infowin->ox + 1, y * Infofnt->hgt + Infowin->oy + 1, Infofnt->twid - 3, Infofnt->hgt - 3); #endif } else { - Infoclr_set(xor); + Infoclr_set(xor_); Infofnt_text_non(x, y, " ", 2); } @@ -2378,8 +2378,8 @@ errr init_x11(int argc, char *argv[]) if (Metadpy_init_name(dpy_name)) return (-1); - MAKE(xor, infoclr); - Infoclr_set(xor); + MAKE(xor_, infoclr); + Infoclr_set(xor_); Infoclr_init_ppn(Metadpy->fg, Metadpy->bg, "xor", 0); for (i = 0; i < 256; ++i) { Pixell pixel; diff --git a/src/main/info-initializer.c b/src/main/info-initializer.c index d4212dd9c..7b5ee6ee4 100644 --- a/src/main/info-initializer.c +++ b/src/main/info-initializer.c @@ -58,7 +58,7 @@ static errr init_info_raw(int fd, angband_header *head) *head = test; C_MAKE(head->info_ptr, head->info_size, char); - fd_read(fd, head->info_ptr, head->info_size); + fd_read(fd, static_cast(head->info_ptr), head->info_size); if (head->name_size) { C_MAKE(head->name_ptr, head->name_size, char); fd_read(fd, head->name_ptr, head->name_size); @@ -80,7 +80,7 @@ static errr init_info_raw(int fd, angband_header *head) static void update_header(angband_header *head, void **info, char **name, char **text, char **tag) { if (info) - *info = head->info_ptr; + *info = static_cast(head->info_ptr); if (name) *name = head->name_ptr; @@ -183,7 +183,7 @@ static errr init_info(player_type *player_ptr, concptr filename, angband_header C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char); if (info) - *info = head->info_ptr; + *info = static_cast(head->info_ptr); if (name) *name = head->name_ptr; @@ -225,7 +225,7 @@ static errr init_info(player_type *player_ptr, concptr filename, angband_header safe_setuid_drop(); if (fd >= 0) { fd_write(fd, (concptr)(head), head->head_size); - fd_write(fd, head->info_ptr, head->info_size); + fd_write(fd, static_cast(head->info_ptr), head->info_size); fd_write(fd, head->name_ptr, head->name_size); fd_write(fd, head->text_ptr, head->text_size); fd_write(fd, head->tag_ptr, head->tag_size); @@ -266,7 +266,7 @@ errr init_f_info(player_type *player_ptr) init_header(&f_head, max_f_idx, sizeof(feature_type)); f_head.parse_info_txt = parse_f_info; f_head.retouch = retouch_f_info; - return init_info(player_ptr, "f_info", &f_head, (void *)&f_info, &f_name, NULL, &f_tag); + return init_info(player_ptr, "f_info", &f_head, reinterpret_cast(&f_info), &f_name, NULL, &f_tag); } /*! @@ -278,7 +278,7 @@ errr init_k_info(player_type *player_ptr) { init_header(&k_head, max_k_idx, sizeof(object_kind)); k_head.parse_info_txt = parse_k_info; - return init_info(player_ptr, "k_info", &k_head, (void *)&k_info, &k_name, &k_text, NULL); + return init_info(player_ptr, "k_info", &k_head, reinterpret_cast(&k_info), &k_name, &k_text, NULL); } /*! @@ -290,7 +290,7 @@ errr init_a_info(player_type *player_ptr) { init_header(&a_head, max_a_idx, sizeof(artifact_type)); a_head.parse_info_txt = parse_a_info; - return init_info(player_ptr, "a_info", &a_head, (void *)&a_info, &a_name, &a_text, NULL); + return init_info(player_ptr, "a_info", &a_head, reinterpret_cast(&a_info), &a_name, &a_text, NULL); } /*! @@ -302,7 +302,7 @@ errr init_e_info(player_type *player_ptr) { init_header(&e_head, max_e_idx, sizeof(ego_item_type)); e_head.parse_info_txt = parse_e_info; - return init_info(player_ptr, "e_info", &e_head, (void *)&e_info, &e_name, &e_text, NULL); + return init_info(player_ptr, "e_info", &e_head, reinterpret_cast(&e_info), &e_name, &e_text, NULL); } /*! @@ -314,7 +314,7 @@ errr init_r_info(player_type *player_ptr) { init_header(&r_head, max_r_idx, sizeof(monster_race)); r_head.parse_info_txt = parse_r_info; - return init_info(player_ptr, "r_info", &r_head, (void *)&r_info, &r_name, &r_text, NULL); + return init_info(player_ptr, "r_info", &r_head, reinterpret_cast(&r_info), &r_name, &r_text, NULL); } /*! @@ -326,7 +326,7 @@ errr init_d_info(player_type *player_ptr) { init_header(&d_head, current_world_ptr->max_d_idx, sizeof(dungeon_type)); d_head.parse_info_txt = parse_d_info; - return init_info(player_ptr, "d_info", &d_head, (void *)&d_info, &d_name, &d_text, NULL); + return init_info(player_ptr, "d_info", &d_head, reinterpret_cast(&d_info), &d_name, &d_text, NULL); } /*! @@ -341,7 +341,7 @@ errr init_v_info(player_type *player_ptr) { init_header(&v_head, max_v_idx, sizeof(vault_type)); v_head.parse_info_txt = parse_v_info; - return init_info(player_ptr, "v_info", &v_head, (void *)&v_info, &v_name, &v_text, NULL); + return init_info(player_ptr, "v_info", &v_head, reinterpret_cast(&v_info), &v_name, &v_text, NULL); } /*! @@ -353,7 +353,7 @@ errr init_s_info(player_type *player_ptr) { init_header(&s_head, MAX_CLASS, sizeof(skill_table)); s_head.parse_info_txt = parse_s_info; - return init_info(player_ptr, "s_info", &s_head, (void *)&s_info, NULL, NULL, NULL); + return init_info(player_ptr, "s_info", &s_head, reinterpret_cast(&s_info), NULL, NULL, NULL); } /*! @@ -365,5 +365,5 @@ errr init_m_info(player_type *player_ptr) { init_header(&m_head, MAX_CLASS, sizeof(player_magic)); m_head.parse_info_txt = parse_m_info; - return init_info(player_ptr, "m_info", &m_head, (void *)&m_info, NULL, NULL, NULL); + return init_info(player_ptr, "m_info", &m_head, reinterpret_cast(&m_info), NULL, NULL, NULL); } diff --git a/src/main/music-definitions-table.h b/src/main/music-definitions-table.h index a09a50b7a..badaca0b3 100644 --- a/src/main/music-definitions-table.h +++ b/src/main/music-definitions-table.h @@ -1,6 +1,6 @@ #pragma once -typedef enum music_type { +enum music_type { MUSIC_BASIC_DEFAULT = 0, MUSIC_BASIC_GAMEOVER = 1, MUSIC_BASIC_EXIT = 2, @@ -23,6 +23,6 @@ typedef enum music_type { MUSIC_BASIC_FINAL_QUEST_CLEAR = 19, MUSIC_BASIC_AMBUSH = 20, MUSIC_BASIC_MAX = 21, /*!< BGM定義の最大数 */ -} music_type; +}; extern const concptr angband_music_basic_name[MUSIC_BASIC_MAX]; diff --git a/src/main/sound-definitions-table.h b/src/main/sound-definitions-table.h index 7bca16697..488389c0c 100644 --- a/src/main/sound-definitions-table.h +++ b/src/main/sound-definitions-table.h @@ -1,6 +1,6 @@ #pragma once -typedef enum sound_type { +enum sound_type { SOUND_HIT = 1, SOUND_MISS = 2, SOUND_FLEE = 3, @@ -68,6 +68,6 @@ typedef enum sound_type { SOUND_GLASS = 65, /*!< A glass feature was crashed */ SOUND_REFLECT = 66, /*!< A bolt was reflected */ SOUND_MAX = 67, /*!< 効果音定義の最大数 / Maximum numbers of sound effect */ -} sound_type; +}; extern const concptr angband_sound_name[SOUND_MAX]; diff --git a/src/market/arena-info-table.c b/src/market/arena-info-table.c index ae57ecfd0..630e81110 100644 --- a/src/market/arena-info-table.c +++ b/src/market/arena-info-table.c @@ -18,7 +18,7 @@ const arena_type arena_info[MAX_ARENA_MONS + 2] = { { MON_NOBORTA, TV_AMULET, SV_AMULET_ADORNMENT }, { MON_MORI_TROLL, TV_FOOD, SV_FOOD_PINT_OF_WINE }, { MON_IMP, TV_POTION, SV_POTION_SPEED }, - { MON_LION_HEART, 0, 0 }, + { MON_LION_HEART, TV_NONE, 0 }, { MON_MASTER_YEEK, TV_POTION, SV_POTION_CURING }, { MON_SABRE_TIGER, TV_WAND, SV_WAND_STONE_TO_MUD }, { MON_LIZARD_KING, TV_WAND, SV_WAND_TELEPORT_AWAY }, @@ -56,6 +56,6 @@ const arena_type arena_info[MAX_ARENA_MONS + 2] = { { MON_BLACK_REAVER, TV_RING, SV_RING_LORDLY }, { MON_FENGHUANG, TV_STAFF, SV_STAFF_THE_MAGI }, { MON_WYRM_POWER, TV_SCROLL, SV_SCROLL_ARTIFACT }, - { 0, 0, 0 }, /* Victory prizing */ + { 0, TV_NONE, 0 }, /* Victory prizing */ { MON_HAGURE, TV_SCROLL, SV_SCROLL_ARTIFACT }, }; diff --git a/src/market/articles-on-sale.c b/src/market/articles-on-sale.c index 5d783b489..6cd430290 100644 --- a/src/market/articles-on-sale.c +++ b/src/market/articles-on-sale.c @@ -497,74 +497,74 @@ store_stock_item_type store_table[MAX_STORES][STORE_CHOICES] = { /* Black Market (unused) */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 } }, { /* Home (unused) */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 } }, { @@ -622,37 +622,37 @@ store_stock_item_type store_table[MAX_STORES][STORE_CHOICES] = { /* Museum (unused) */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 }, + { TV_NONE, 0 } } }; diff --git a/src/market/building-actions-table.h b/src/market/building-actions-table.h index d9f6b2acc..588ad7d3c 100644 --- a/src/market/building-actions-table.h +++ b/src/market/building-actions-table.h @@ -3,7 +3,7 @@ /* * Buildings actions */ -typedef enum ba_actions { +enum ba_actions { BACT_NOTHING = 0, BACT_RESEARCH_ITEM = 1, BACT_TOWN_HISTORY = 2, @@ -53,4 +53,4 @@ typedef enum ba_actions { BACT_EVAL_AC = 46, BACT_BROKEN_WEAPON = 47, MAX_BACT = 48, -} ba_actions; +}; diff --git a/src/market/building-craft-fix.c b/src/market/building-craft-fix.c index 4ae83a950..3535727ee 100644 --- a/src/market/building-craft-fix.c +++ b/src/market/building-craft-fix.c @@ -43,7 +43,7 @@ static void give_one_ability_of_object(player_type *player_ptr, object_type *to_ int n = 0; int cand[TR_FLAG_MAX]; - for (tr_type i = 0; i < TR_FLAG_MAX; i++) { + for (int i = 0; i < TR_FLAG_MAX; i++) { switch (i) { case TR_IGNORE_ACID: case TR_IGNORE_ELEC: @@ -100,7 +100,7 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost) OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP), 0); + o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP), TV_NONE); if (!o_ptr) return 0; @@ -124,7 +124,7 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost) item_tester_hook = item_tester_hook_orthodox_melee_weapons; OBJECT_IDX mater; object_type *mo_ptr; - mo_ptr = choose_object(player_ptr, &mater, q, s, (USE_INVEN | USE_EQUIP), 0); + mo_ptr = choose_object(player_ptr, &mater, q, s, (USE_INVEN | USE_EQUIP), TV_NONE); if (!mo_ptr) return 0; if (mater == item) { diff --git a/src/market/building-craft-weapon.c b/src/market/building-craft-weapon.c index d78a574a0..4c064f4e6 100644 --- a/src/market/building-craft-weapon.c +++ b/src/market/building-craft-weapon.c @@ -358,7 +358,7 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) concptr s = _("比べるものがありません。", "You have nothing to compare."); OBJECT_IDX item; - o_ptr[0] = choose_object(customer_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); + o_ptr[0] = choose_object(customer_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr[0]) { screen_load(); return 0; @@ -412,7 +412,7 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) q = _("第二の武器は?", "What is your second weapon? "); s = _("比べるものがありません。", "You have nothing to compare."); OBJECT_IDX item2; - object_type *i2_ptr = choose_object(customer_ptr, &item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); + object_type *i2_ptr = choose_object(customer_ptr, &item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!i2_ptr) continue; diff --git a/src/market/building-initializer.c b/src/market/building-initializer.c index ae38786eb..fc89f7e16 100644 --- a/src/market/building-initializer.c +++ b/src/market/building-initializer.c @@ -49,7 +49,7 @@ errr init_towns(void) if (tv == 0) break; - KIND_OBJECT_IDX k_idx = lookup_kind(tv, sv); + KIND_OBJECT_IDX k_idx = lookup_kind(static_cast(tv), sv); if (k_idx == 0) continue; @@ -66,7 +66,7 @@ errr init_towns(void) if (tv == 0) break; - KIND_OBJECT_IDX k_idx = lookup_kind(tv, sv); + KIND_OBJECT_IDX k_idx = lookup_kind(static_cast(tv), sv); if (k_idx == 0) continue; @@ -101,10 +101,10 @@ errr init_buildings(void) } for (int j = 0; j < MAX_CLASS; j++) - building[i].member_class[j] = 0; + building[i].member_class[j] = CLASS_WARRIOR; for (int j = 0; j < MAX_RACES; j++) - building[i].member_race[j] = 0; + building[i].member_race[j] = RACE_HUMAN; for (int j = 0; j < MAX_MAGIC + 1; j++) building[i].member_realm[j] = 0; diff --git a/src/market/building-quest.c b/src/market/building-quest.c index 73ebbb02f..0ee2e046b 100644 --- a/src/market/building-quest.c +++ b/src/market/building-quest.c @@ -34,7 +34,7 @@ static void get_questinfo(player_type *player_ptr, IDX questnum, bool do_init) init_flags = INIT_SHOW_TEXT; if (do_init) - init_flags |= INIT_ASSIGN; + init_flags = static_cast(init_flags | INIT_ASSIGN); parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0); floor_ptr->inside_quest = old_quest; @@ -123,4 +123,4 @@ void castle_quest(player_type *player_ptr) msg_format("Your quest: kill %d %s", q_ptr->max_num, name); #endif get_questinfo(player_ptr, q_index, TRUE); -} \ No newline at end of file +} diff --git a/src/market/building-recharger.c b/src/market/building-recharger.c index f212d3548..e534eeed1 100644 --- a/src/market/building-recharger.c +++ b/src/market/building-recharger.c @@ -42,7 +42,7 @@ void building_recharge(player_type *player_ptr) OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return; diff --git a/src/melee/melee-switcher.c b/src/melee/melee-switcher.c index e31fd2508..1421c06f6 100644 --- a/src/melee/melee-switcher.c +++ b/src/melee/melee-switcher.c @@ -145,7 +145,8 @@ void decide_monster_attack_effect(player_type *subject_ptr, mam_type *mam_ptr) switch (mam_ptr->effect) { case 0: case RBE_DR_MANA: - mam_ptr->damage = mam_ptr->pt = 0; + mam_ptr->damage = 0; + mam_ptr->pt = GF_NONE; break; case RBE_SUPERHURT: if ((randint1(mam_ptr->rlev * 2 + 250) > (mam_ptr->ac + 200)) || one_in_(13)) { diff --git a/src/melee/melee-switcher.h b/src/melee/melee-switcher.h index 0eadda2c8..2c7b38671 100644 --- a/src/melee/melee-switcher.h +++ b/src/melee/melee-switcher.h @@ -3,12 +3,12 @@ #include "system/angband.h" #include "melee/melee-util.h" -typedef enum be_type { +enum be_type { BLOW_EFFECT_TYPE_NONE = 0, BLOW_EFFECT_TYPE_FEAR = 1, BLOW_EFFECT_TYPE_SLEEP = 2, BLOW_EFFECT_TYPE_HEAL = 3, -} be_type; +}; void describe_melee_method(player_type *subject_ptr, mam_type *mam_ptr); void decide_monster_attack_effect(player_type *subject_ptr, mam_type *mam_ptr); diff --git a/src/mind/drs-types.h b/src/mind/drs-types.h index dc5f27853..72cd4c444 100644 --- a/src/mind/drs-types.h +++ b/src/mind/drs-types.h @@ -3,7 +3,7 @@ /* * Some things which induce learning */ -typedef enum drs_type { +enum drs_type { DRS_ACID = 1, DRS_ELEC = 2, DRS_FIRE = 3, @@ -23,4 +23,4 @@ typedef enum drs_type { DRS_FREE = 30, DRS_MANA = 31, DRS_REFLECT = 32, -} drs_type; +}; diff --git a/src/mind/mind-archer.c b/src/mind/mind-archer.c index c1cd4734a..be858f2bf 100644 --- a/src/mind/mind-archer.c +++ b/src/mind/mind-archer.c @@ -24,12 +24,12 @@ #include "util/bit-flags-calculator.h" #include "view/display-messages.h" -typedef enum ammo_creation_type { +enum ammo_creation_type { AMMO_NONE = 0, AMMO_SHOT = 1, AMMO_ARROW = 2, AMMO_BOLT = 3, -} ammo_creation_type; +}; /*! * @brief「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'. @@ -115,7 +115,7 @@ bool create_ammo(player_type *creature_ptr) concptr q = _("どのアイテムから作りますか? ", "Convert which item? "); concptr s = _("材料を持っていない。", "You have no item to convert."); OBJECT_IDX item; - object_type *q_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0); + object_type *q_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (!q_ptr) return FALSE; @@ -142,7 +142,7 @@ bool create_ammo(player_type *creature_ptr) concptr q = _("どのアイテムから作りますか? ", "Convert which item? "); concptr s = _("材料を持っていない。", "You have no item to convert."); OBJECT_IDX item; - object_type *q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + object_type *q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!q_ptr) return FALSE; diff --git a/src/mind/mind-berserker.c b/src/mind/mind-berserker.c index 3c41da1f7..4f268dbd1 100644 --- a/src/mind/mind-berserker.c +++ b/src/mind/mind-berserker.c @@ -44,7 +44,7 @@ bool cast_berserk_spell(player_type *caster_ptr, mind_berserker_type spell) return FALSE; } - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat)) break; diff --git a/src/mind/mind-berserker.h b/src/mind/mind-berserker.h index c95538b03..613a03ed0 100644 --- a/src/mind/mind-berserker.h +++ b/src/mind/mind-berserker.h @@ -2,5 +2,5 @@ #include "system/angband.h" -typedef enum mind_berserker_type mind_berserker_type; +enum mind_berserker_type : int; bool cast_berserk_spell(player_type *caster_ptr, mind_berserker_type spell); diff --git a/src/mind/mind-blue-mage.h b/src/mind/mind-blue-mage.h index d27c7fab6..cc2dd83fb 100644 --- a/src/mind/mind-blue-mage.h +++ b/src/mind/mind-blue-mage.h @@ -2,12 +2,12 @@ #include "system/angband.h" -typedef enum blue_magic_type { +enum blue_magic_type : int { MONSPELL_TYPE_BOLT = 1, MONSPELL_TYPE_BALL = 2, MONSPELL_TYPE_BREATH = 3, MONSPELL_TYPE_SUMMON = 4, MONSPELL_TYPE_OTHER = 5, -} blue_magic_type; +}; bool do_cmd_cast_learned(player_type *caster_ptr); diff --git a/src/mind/mind-force-trainer.h b/src/mind/mind-force-trainer.h index fec2a32f6..3e3194cef 100644 --- a/src/mind/mind-force-trainer.h +++ b/src/mind/mind-force-trainer.h @@ -9,5 +9,5 @@ void set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool set_tim_sh_force(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool shock_power(player_type *caster_ptr); -typedef enum mind_force_trainer_type mind_force_trainer_type; +enum mind_force_trainer_type : int; bool cast_force_spell(player_type *caster_ptr, mind_force_trainer_type spell); diff --git a/src/mind/mind-mage.c b/src/mind/mind-mage.c index 86051642d..b9b774cf6 100644 --- a/src/mind/mind-mage.c +++ b/src/mind/mind-mage.c @@ -39,7 +39,7 @@ bool eat_magic(player_type *caster_ptr, int power) object_type *o_ptr; OBJECT_IDX item; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/mind/mind-magic-eater.c b/src/mind/mind-magic-eater.c index bb2265564..6aaacbc29 100644 --- a/src/mind/mind-magic-eater.c +++ b/src/mind/mind-magic-eater.c @@ -21,7 +21,7 @@ bool import_magic_device(player_type *user_ptr) concptr q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? "); concptr s = _("魔力を取り込めるアイテムがない。", "There's nothing with power to absorb."); OBJECT_IDX item; - object_type *o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0); + object_type *o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/mind/mind-mindcrafter.c b/src/mind/mind-mindcrafter.c index 17a30fd9a..a632acc9c 100644 --- a/src/mind/mind-mindcrafter.c +++ b/src/mind/mind-mindcrafter.c @@ -55,7 +55,7 @@ bool psychometry(player_type *caster_ptr) concptr s = _("調べるアイテムがありません。", "You have nothing appropriate."); object_type *o_ptr; OBJECT_IDX item; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; @@ -126,7 +126,8 @@ bool psychometry(player_type *caster_ptr) */ bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell) { - int b = 0; + bool b = FALSE; + int dam = 0; DIRECTION dir; TIME_EFFECT t; PLAYER_LEVEL plev = caster_ptr->lev; @@ -208,7 +209,7 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell if (plev < 25) return psychometry(caster_ptr); else - return ident_spell(caster_ptr, FALSE, 0); + return ident_spell(caster_ptr, FALSE, TV_NONE); case MIND_WAVE: msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!")); if (plev < 25) @@ -237,8 +238,8 @@ bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell if (!get_aim_dir(caster_ptr, &dir)) return FALSE; - b = damroll(plev / 2, 6); - if (fire_ball(caster_ptr, GF_PSI_DRAIN, dir, b, 0)) + dam = damroll(plev / 2, 6); + if (fire_ball(caster_ptr, GF_PSI_DRAIN, dir, dam, 0)) caster_ptr->energy_need += randint1(150); break; diff --git a/src/mind/mind-mindcrafter.h b/src/mind/mind-mindcrafter.h index e3d07cfe4..fcf39099a 100644 --- a/src/mind/mind-mindcrafter.h +++ b/src/mind/mind-mindcrafter.h @@ -4,5 +4,5 @@ bool psychometry(player_type *caster_ptr); -typedef enum mind_mindcrafter_type mind_mindcrafter_type; +enum mind_mindcrafter_type : int; bool cast_mindcrafter_spell(player_type *caster_ptr, mind_mindcrafter_type spell); diff --git a/src/mind/mind-mirror-master.h b/src/mind/mind-mirror-master.h index 6f5398eef..440b07606 100644 --- a/src/mind/mind-mirror-master.h +++ b/src/mind/mind-mirror-master.h @@ -13,5 +13,5 @@ bool mirror_tunnel(player_type *caster_ptr); bool set_multishadow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); bool set_dustrobe(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); -typedef enum mind_mirror_master_type mind_mirror_master_type; +enum mind_mirror_master_type : int; bool cast_mirror_spell(player_type *caster_ptr, mind_mirror_master_type spell); diff --git a/src/mind/mind-ninja.c b/src/mind/mind-ninja.c index ad68bd8e5..901d9534c 100644 --- a/src/mind/mind-ninja.c +++ b/src/mind/mind-ninja.c @@ -378,7 +378,7 @@ bool cast_ninja_spell(player_type *caster_ptr, mind_ninja_type spell) (void)stasis_monster(caster_ptr, dir); break; case ANCIENT_KNOWLEDGE: - return ident_spell(caster_ptr, FALSE, 0); + return ident_spell(caster_ptr, FALSE, TV_NONE); case FLOATING: set_tim_levitation(caster_ptr, randint1(20) + 20, FALSE); break; diff --git a/src/mind/mind-ninja.h b/src/mind/mind-ninja.h index 864b6846d..8e1b6d539 100644 --- a/src/mind/mind-ninja.h +++ b/src/mind/mind-ninja.h @@ -11,5 +11,5 @@ void calc_surprise_attack_damage(player_type *attacker_ptr, player_attack_type * bool hayagake(player_type *creature_ptr); bool set_superstealth(player_type *creature_ptr, bool set); -typedef enum mind_ninja_type mind_ninja_type; +enum mind_ninja_type : int; bool cast_ninja_spell(player_type *caster_ptr, mind_ninja_type spell); diff --git a/src/mind/mind-numbers.h b/src/mind/mind-numbers.h index 3b9ae238d..d47cb36b1 100644 --- a/src/mind/mind-numbers.h +++ b/src/mind/mind-numbers.h @@ -1,14 +1,14 @@ #pragma once -typedef enum mind_berserker_type { +enum mind_berserker_type : int { DETECT_MANACE = 0, CHARGE = 1, SMASH_TRAP = 2, QUAKE = 3, MASSACRE = 4, -} mind_berserker_type; +}; -typedef enum mind_force_trainer_type { +enum mind_force_trainer_type : int { SMALL_FORCE_BALL = 0, FLASH_LIGHT = 1, FLYING_TECHNIQUE = 2, @@ -23,9 +23,9 @@ typedef enum mind_force_trainer_type { EXPLODING_FLAME = 11, SUPER_KAMEHAMEHA = 12, LIGHT_SPEED = 13, -} mind_force_trainer_type; +}; -typedef enum mind_mindcrafter_type { +enum mind_mindcrafter_type : int { PRECOGNITION = 0, NEURAL_BLAST = 1, MINOR_DISPLACEMENT = 2, @@ -40,9 +40,9 @@ typedef enum mind_mindcrafter_type { PSYCHIC_DRAIN = 11, PSYCHO_SPEAR = 12, THE_WORLD = 13, -} mind_mindcrafter_type; +}; -typedef enum mind_mirror_master_type { +enum mind_mirror_master_type : int { MIRROR_SEEING = 0, MAKE_MIRROR = 1, DRIP_LIGHT = 2, @@ -64,9 +64,9 @@ typedef enum mind_mirror_master_type { MULTI_SHADOW = 18, BINDING_FIELD = 19, RUFFNOR_MIRROR = 20, -} mind_mirror_master_type; +}; -typedef enum mind_ninja_type { +enum mind_ninja_type : int { DARKNESS_CREATION = 0, DETECT_NEAR = 1, HIDE_LEAVES = 2, @@ -87,4 +87,4 @@ typedef enum mind_ninja_type { HIDE_MIST =17, PURGATORY_FLAME = 18, ALTER_EGO = 19, -} mind_ninja_type; +}; diff --git a/src/mind/mind-priest.c b/src/mind/mind-priest.c index 99048ff4b..c0870e30d 100644 --- a/src/mind/mind-priest.c +++ b/src/mind/mind-priest.c @@ -32,7 +32,7 @@ bool bless_weapon(player_type *caster_ptr) concptr s = _("祝福できる武器がありません。", "You have weapon to bless."); OBJECT_IDX item; - object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0); + object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/mind/mind-types.h b/src/mind/mind-types.h index 044b61494..c561ac3f6 100644 --- a/src/mind/mind-types.h +++ b/src/mind/mind-types.h @@ -1,9 +1,9 @@ #pragma once -typedef enum mind_kind_type { +enum mind_kind_type { MIND_MINDCRAFTER = 0, /*!< 特殊能力: 超能力 */ MIND_KI = 1, /*!< 特殊能力: 練気 */ MIND_BERSERKER = 2, /*!< 特殊能力: 怒り */ MIND_MIRROR_MASTER = 3, /*!< 特殊能力: 鏡魔法 */ MIND_NINJUTSU = 4, /*!< 特殊能力: 忍術 */ -} mind_kind_type; +}; diff --git a/src/mind/mind-warrior.c b/src/mind/mind-warrior.c index 966e416ef..9279c5614 100644 --- a/src/mind/mind-warrior.c +++ b/src/mind/mind-warrior.c @@ -18,7 +18,7 @@ bool hit_and_away(player_type *caster_ptr) POSITION y = caster_ptr->y + ddy[dir]; POSITION x = caster_ptr->x + ddx[dir]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) { - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); if (randint0(caster_ptr->skill_dis) < 7) msg_print(_("うまく逃げられなかった。", "You failed to run away.")); else @@ -49,7 +49,7 @@ bool sword_dancing(player_type *creature_ptr) /* Hack -- attack monsters */ if (g_ptr->m_idx) - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); else { msg_print(_("攻撃が空をきった。", "You attack the empty air.")); } diff --git a/src/mind/monk-attack.c b/src/mind/monk-attack.c index ad26a3e1e..3fb47f8b8 100644 --- a/src/mind/monk-attack.c +++ b/src/mind/monk-attack.c @@ -231,7 +231,7 @@ void process_monk_attack(player_type *attacker_ptr, player_attack_type *pa_ptr) int stun_effect = 0; int special_effect = process_monk_additional_effect(pa_ptr, &stun_effect); WEIGHT weight = calc_monk_attack_weight(attacker_ptr); - pa_ptr->attack_damage = critical_norm(attacker_ptr, attacker_ptr->lev * weight, min_level, pa_ptr->attack_damage, attacker_ptr->to_h[0], 0); + pa_ptr->attack_damage = critical_norm(attacker_ptr, attacker_ptr->lev * weight, min_level, pa_ptr->attack_damage, attacker_ptr->to_h[0], HISSATSU_NONE); process_attack_vital_spot(attacker_ptr, pa_ptr, &stun_effect, &resist_stun, special_effect); print_stun_effect(attacker_ptr, pa_ptr, stun_effect, resist_stun); } @@ -256,10 +256,10 @@ bool double_attack(player_type *creature_ptr) else msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!", "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!")); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx) { handle_stuff(creature_ptr); - do_cmd_attack(creature_ptr, y, x, 0); + do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE); } creature_ptr->energy_need += ENERGY_NEED(); diff --git a/src/mind/snipe-types.h b/src/mind/snipe-types.h index 4037e81d3..4aa482717 100644 --- a/src/mind/snipe-types.h +++ b/src/mind/snipe-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum snipe_type { +enum snipe_type { SP_NONE = 0, SP_LITE = 1, SP_AWAY = 2, @@ -17,4 +17,4 @@ typedef enum snipe_type { SP_HOLYNESS = 13, SP_FINAL = 14, SP_NEEDLE = 15, -} snipe_type; \ No newline at end of file +}; diff --git a/src/monster-attack/monster-attack-effect.h b/src/monster-attack/monster-attack-effect.h index 7f9faf055..e43e141df 100644 --- a/src/monster-attack/monster-attack-effect.h +++ b/src/monster-attack/monster-attack-effect.h @@ -6,7 +6,7 @@ * "Race Blow Effect" の略。 * 実装の都合上、0 から始まる連番でなければならない。 */ -typedef enum rbe_type { +enum rbe_type { RBE_NONE = 0, RBE_HURT = 1, /*!< モンスターの攻撃効果: 攻撃する*/ RBE_POISON = 2, /*!< モンスターの攻撃効果: 毒をくらわす*/ @@ -46,4 +46,4 @@ typedef enum rbe_type { RBE_FLAVOR = 36, /*!< モンスターの攻撃効果: フレーバー(メッセージ表示のみ) */ NB_RBE_TYPE, /*!< enum バリアント数 */ -} rbe_type; +}; diff --git a/src/monster-attack/monster-attack-types.h b/src/monster-attack/monster-attack-types.h index 52956fe0e..c9293fe32 100644 --- a/src/monster-attack/monster-attack-types.h +++ b/src/monster-attack/monster-attack-types.h @@ -10,7 +10,7 @@ * "Race Blow Method" の略。 * 実装の都合上、0 から始まる連番でなければならない。 */ -typedef enum rbm_type { +enum rbm_type { RBM_NONE = 0, RBM_HIT = 1, /*!< モンスターの攻撃種別:殴る(傷/朦朧が半々) */ RBM_TOUCH = 2, /*!< モンスターの攻撃種別:触る */ @@ -39,7 +39,7 @@ typedef enum rbm_type { RBM_SHOOT = 25, /*!< モンスターの攻撃種別:射撃(非打撃) */ NB_RBM_TYPE, /*!< enum バリアント数 */ -} rbm_type; +}; typedef struct mbe_info_type { int power; /* The attack "power" */ diff --git a/src/monster-floor/monster-generator.h b/src/monster-floor/monster-generator.h index 01f20a831..81f8e59fd 100644 --- a/src/monster-floor/monster-generator.h +++ b/src/monster-floor/monster-generator.h @@ -2,7 +2,7 @@ #include "system/angband.h" -typedef enum summon_type summon_type; +enum summon_type : int; typedef bool (*summon_specific_pf)(player_type *, MONSTER_IDX, POSITION, POSITION, DEPTH, summon_type, BIT_FLAGS); bool mon_scatter(player_type *player_ptr, MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist); diff --git a/src/monster-floor/monster-lite.c b/src/monster-floor/monster-lite.c index 22e0c83a5..c625f487e 100644 --- a/src/monster-floor/monster-lite.c +++ b/src/monster-floor/monster-lite.c @@ -163,7 +163,7 @@ void update_mon_lite(player_type *subject_ptr) if (!rad) continue; - int f_flag; + feature_flag_type f_flag; if (rad > 0) { if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (monster_csleep_remaining(m_ptr) || (!floor_ptr->dun_level && is_daytime()) || subject_ptr->phase_out)) diff --git a/src/monster-floor/monster-summon.c b/src/monster-floor/monster-summon.c index c6c7320ac..c5343e358 100644 --- a/src/monster-floor/monster-summon.c +++ b/src/monster-floor/monster-summon.c @@ -132,7 +132,7 @@ bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSI DEPTH dlev = get_dungeon_or_wilderness_level(player_ptr); MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, (dlev + lev) / 2 + 5, 0); if (!r_idx) { - summon_specific_type = 0; + summon_specific_type = SUMMON_NONE; return FALSE; } @@ -140,11 +140,11 @@ bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSI mode |= PM_NO_KAGE; if (!place_monster_aux(player_ptr, who, y, x, r_idx, mode)) { - summon_specific_type = 0; + summon_specific_type = SUMMON_NONE; return FALSE; } - summon_specific_type = 0; + summon_specific_type = SUMMON_NONE; sound(SOUND_SUMMON); return TRUE; } diff --git a/src/monster-floor/monster-summon.h b/src/monster-floor/monster-summon.h index 842d22c45..5d9667646 100644 --- a/src/monster-floor/monster-summon.h +++ b/src/monster-floor/monster-summon.h @@ -5,6 +5,6 @@ extern int summon_specific_who; extern bool summon_unique_okay; -typedef enum summon_type summon_type; +enum summon_type : int; bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode); bool summon_named_creature(player_type *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode); diff --git a/src/monster-floor/place-monster-types.h b/src/monster-floor/place-monster-types.h index ff1766ba0..7ab0961ca 100644 --- a/src/monster-floor/place-monster-types.h +++ b/src/monster-floor/place-monster-types.h @@ -3,7 +3,7 @@ /* * Bit flags for the place_monster_???() (etc) */ -typedef enum place_monster_type { +enum place_monster_type { PM_NONE = 0x00000000, /*!< 特になし*/ PM_ALLOW_SLEEP = 0x00000001, /*!< モンスター生成フラグ: 眠っている状態で生成されても良い */ PM_ALLOW_GROUP = 0x00000002, /*!< モンスター生成フラグ: 集団生成されても良い */ @@ -17,4 +17,4 @@ typedef enum place_monster_type { PM_KAGE = 0x00000200, /*!< モンスター生成フラグ: 必ずあやしい影として生成する */ PM_MULTIPLY = 0x00000400, /*!< モンスター生成フラグ: 増殖処理時として生成する */ PM_JURAL = 0x00000800, /*!< モンスター生成フラグ: ジュラル星人として誤認生成する */ -} place_monster_type; +}; diff --git a/src/monster-race/race-flags-ability1.h b/src/monster-race/race-flags-ability1.h index 37a0c8b12..b158b42a7 100644 --- a/src/monster-race/race-flags-ability1.h +++ b/src/monster-race/race-flags-ability1.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags_ability { +enum race_flags_ability { RF5_BA_ACID = 0x00000001, /*!< モンスター能力: アシッド・ボール / Acid Ball */ RF5_BA_ELEC = 0x00000002, /*!< モンスター能力: サンダー・ボール / Elec Ball */ RF5_BA_FIRE = 0x00000004, /*!< モンスター能力: ファイア・ボール / Fire Ball */ @@ -33,4 +33,4 @@ typedef enum race_flags_ability { RF5_CONF = 0x20000000, /*!< モンスター能力: 混乱 / Confuse Player */ RF5_SLOW = 0x40000000, /*!< モンスター能力: 減速 / Slow Player */ RF5_HOLD = 0x80000000, /*!< モンスター能力: 麻痺 / Paralyze Player */ -} race_flags_ability; +}; diff --git a/src/monster-race/race-flags-ability2.h b/src/monster-race/race-flags-ability2.h index bbdf0e412..d5fe7796c 100644 --- a/src/monster-race/race-flags-ability2.h +++ b/src/monster-race/race-flags-ability2.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags_ability2 { +enum race_flags_ability2 { RF6_HASTE = 0x00000001, /* Speed self */ RF6_HAND_DOOM = 0x00000002, /* Hand of Doom */ RF6_HEAL = 0x00000004, /* Heal self */ @@ -33,4 +33,4 @@ typedef enum race_flags_ability2 { RF6_S_HI_DRAGON = 0x20000000, /* Summon Ancient Dragon */ RF6_S_AMBERITES = 0x40000000, /* Summon Amberites */ RF6_S_UNIQUE = 0x80000000, /* Summon Unique Monster */ -} race_flags_ability2; +}; diff --git a/src/monster-race/race-flags-resistance.h b/src/monster-race/race-flags-resistance.h index 011dd3046..b501be60a 100644 --- a/src/monster-race/race-flags-resistance.h +++ b/src/monster-race/race-flags-resistance.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags_resistance { +enum race_flags_resistance { RFR_IM_ACID = 0x00000001, /* Immunity acid */ RFR_IM_ELEC = 0x00000002, /* Immunity elec */ RFR_IM_FIRE = 0x00000004, /* Immunity fire */ @@ -33,7 +33,7 @@ typedef enum race_flags_resistance { RFR_XXX29 = 0x20000000, RFR_XXX30 = 0x40000000, RFR_XXX31 = 0x80000000, -} race_flags_resistance; +}; #define RFR_EFF_IM_ACID_MASK (RFR_IM_ACID | RFR_RES_ALL) #define RFR_EFF_IM_ELEC_MASK (RFR_IM_ELEC | RFR_RES_ALL) diff --git a/src/monster-race/race-flags1.h b/src/monster-race/race-flags1.h index 205a69d52..b2092d27d 100644 --- a/src/monster-race/race-flags1.h +++ b/src/monster-race/race-flags1.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags1 { +enum race_flags1 { RF1_UNIQUE = 0x00000001, /*!< モンスター特性: ユニーク / Unique Monster */ RF1_QUESTOR = 0x00000002, /*!< モンスター特性: クエストモンスター / Quest Monster */ RF1_MALE = 0x00000004, /*!< モンスター特性: 男性 / Male gender */ @@ -33,4 +33,4 @@ typedef enum race_flags1 { RF1_DROP_GREAT = 0x20000000, /*!< モンスター特性: 必ず高級品をドロップする / Drop great items */ RF1_XXX2 = 0x40000000, /*!< モンスター特性: 未使用 / XXX */ RF1_XXX3 = 0x80000000, /*!< モンスター特性: 未使用 / XXX */ -} race_flags1; +}; diff --git a/src/monster-race/race-flags2.h b/src/monster-race/race-flags2.h index e0acc0d49..8b809c365 100644 --- a/src/monster-race/race-flags2.h +++ b/src/monster-race/race-flags2.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags2 { +enum race_flags2 { RF2_STUPID = 0x00000001, /*!< モンスター特性: 愚かな行動を取る / Monster is stupid */ RF2_SMART = 0x00000002, /*!< モンスター特性: 賢い行動を取る / Monster is smart */ RF2_CAN_SPEAK = 0x00000004, /*!< モンスター特性: 台詞をしゃべる / TY: can speak */ @@ -33,4 +33,4 @@ typedef enum race_flags2 { RF2_XXX6 = 0x20000000, /*!< モンスター特性: 未使用 / XXX */ RF2_HUMAN = 0x40000000, /*!< モンスター特性: 人間 / Human */ RF2_QUANTUM = 0x80000000, /*!< モンスター特性: 量子的な振る舞いをする / Monster has quantum behavior */ -} race_flags2; +}; diff --git a/src/monster-race/race-flags3.h b/src/monster-race/race-flags3.h index 477060d60..f14d6e88e 100644 --- a/src/monster-race/race-flags3.h +++ b/src/monster-race/race-flags3.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags3 { +enum race_flags3 { RF3_ORC = 0x00000001, /*!< モンスター特性: オーク / Orc */ RF3_TROLL = 0x00000002, /*!< モンスター特性: トロル / Troll */ RF3_GIANT = 0x00000004, /*!< モンスター特性: 巨人 / Giant */ @@ -33,4 +33,4 @@ typedef enum race_flags3 { RF3_NO_STUN = 0x20000000, /*!< モンスター特性: 朦朧としない / Cannot be stunned */ RF3_NO_CONF = 0x40000000, /*!< モンスター特性: 混乱しない / Cannot be confused and resist confusion */ RF3_NO_SLEEP = 0x80000000, /*!< モンスター特性: 眠らない / Cannot be slept */ -} race_flags3; +}; diff --git a/src/monster-race/race-flags4.h b/src/monster-race/race-flags4.h index 31293e87b..0837381b8 100644 --- a/src/monster-race/race-flags4.h +++ b/src/monster-race/race-flags4.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags4 { +enum race_flags4 { RF4_SHRIEK = 0x00000001, /*!< モンスター能力: 叫ぶ / Shriek for help */ RF4_XXX1 = 0x00000002, /*!< モンスター能力: 未使用 / XXX */ RF4_DISPEL = 0x00000004, /*!< モンスター能力: 魔力消去 / Dispel magic */ @@ -33,4 +33,4 @@ typedef enum race_flags4 { RF4_BR_NUKE = 0x20000000, /*!< モンスター能力: 放射性廃棄物のブレス / TY: Toxic Breath */ RF4_BA_CHAO = 0x40000000, /*!< モンスター能力: ログルス球 / TY: Logrus Ball */ RF4_BR_DISI = 0x80000000, /*!< モンスター能力: 分解のブレス / Breathe Disintegration */ -} race_flags4; +}; diff --git a/src/monster-race/race-flags7.h b/src/monster-race/race-flags7.h index 23fca8bee..af39496c2 100644 --- a/src/monster-race/race-flags7.h +++ b/src/monster-race/race-flags7.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags7 { +enum race_flags7 { RF7_AQUATIC = 0x00000001, /* Aquatic monster */ RF7_CAN_SWIM = 0x00000002, /* Monster can swim */ RF7_CAN_FLY = 0x00000004, /* Monster can fly */ @@ -21,7 +21,7 @@ typedef enum race_flags7 { RF7_SELF_DARK_1 = 0x00020000, /* Monster darkens itself */ RF7_HAS_DARK_2 = 0x00040000, /* Monster carries darkness */ RF7_SELF_DARK_2 = 0x00080000, /* Monster darkens itself */ -} race_flags7; +}; #define RF7_LITE_MASK (RF7_HAS_LITE_1 | RF7_SELF_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_2) #define RF7_DARK_MASK (RF7_HAS_DARK_1 | RF7_SELF_DARK_1 | RF7_HAS_DARK_2 | RF7_SELF_DARK_2) diff --git a/src/monster-race/race-flags8.h b/src/monster-race/race-flags8.h index c9162f9fb..7735fe0ba 100644 --- a/src/monster-race/race-flags8.h +++ b/src/monster-race/race-flags8.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags8 { +enum race_flags8 : uint32_t { RF8_WILD_ONLY = 0x00000001, RF8_WILD_TOWN = 0x00000002, RF8_XXX8X02 = 0x00000004, @@ -13,4 +13,4 @@ typedef enum race_flags8 { RF8_WILD_MOUNTAIN = 0x00000200, RF8_WILD_GRASS = 0x00000400, RF8_WILD_ALL = 0x80000000, -} race_flags8; +}; diff --git a/src/monster-race/race-flags9.h b/src/monster-race/race-flags9.h index 83e1de89b..c6db18a4e 100644 --- a/src/monster-race/race-flags9.h +++ b/src/monster-race/race-flags9.h @@ -1,6 +1,6 @@ #pragma once -typedef enum race_flags9 { +enum race_flags9 { RF9_DROP_CORPSE = 0x00000001, RF9_DROP_SKELETON = 0x00000002, RF9_EAT_BLIND = 0x00000004, @@ -33,4 +33,4 @@ typedef enum race_flags9 { RF9_EAT_LOSE_CON = 0x20000000, RF9_EAT_LOSE_CHR = 0x40000000, RF9_EAT_DRAIN_MANA = 0x80000000, -} race_flags9; +}; diff --git a/src/monster-race/race-indice-types.h b/src/monster-race/race-indice-types.h index c7907658c..eb8ee8cbf 100644 --- a/src/monster-race/race-indice-types.h +++ b/src/monster-race/race-indice-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum monster_race_type { +enum monster_race_type { MON_PLAYER = 0, // Dummy. MON_BEGGAR = 12, MON_LEPER = 13, @@ -173,4 +173,4 @@ typedef enum monster_race_type { MON_CAIT_SITH = 1262, MON_SHIVA_BOOTS = 1264, MON_BIG_RAVEN = 1268, -} monster_race_type; +}; diff --git a/src/monster/monster-description-types.h b/src/monster/monster-description-types.h index 9e8221f14..5e109ae33 100644 --- a/src/monster/monster-description-types.h +++ b/src/monster/monster-description-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum monsetr_description_type { +enum monsetr_description_type { MD_NONE = 0x00000000, MD_OBJECTIVE = 0x00000001, /* Objective (or Reflexive) */ MD_POSSESSIVE = 0x00000002, /* Possessive (or Reflexive) */ @@ -12,6 +12,6 @@ typedef enum monsetr_description_type { MD_ASSUME_VISIBLE = 0x00000080, /* Assume the monster is visible */ MD_TRUE_NAME = 0x00000100, /* Chameleon's true name */ MD_IGNORE_HALLU = 0x00000200, /* Ignore hallucination, and penetrate shape change */ -} monsetr_description_type; +}; #define MD_WRONGDOER_NAME (MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE) /* 加害明記向け */ diff --git a/src/monster/monster-flag-types.h b/src/monster/monster-flag-types.h index d162772f8..ffbdbef54 100644 --- a/src/monster/monster-flag-types.h +++ b/src/monster/monster-flag-types.h @@ -1,15 +1,15 @@ #pragma once -typedef enum monster_flags_type { +enum monster_flags_type { MFLAG_VIEW = 0x01, /* Monster is in line of sight */ MFLAG_LOS = 0x02, /* Monster is marked for project_all_los(caster_ptr, ) */ MFLAG_ESP = 0x04, /* Monster is being sensed by ESP */ MFLAG_ETF = 0x08, /* Monster is entering the field. */ MFLAG_BORN = 0x10, /* Monster is still being born */ MFLAG_PREVENT_MAGIC = 0x20, /* Monster is still being no-magic */ -} monster_flags_type; +}; -typedef enum monster_flags2_type { +enum monster_flags2_type { MFLAG2_KAGE = 0x01, /* Monster is kage */ MFLAG2_NOPET = 0x02, /* Cannot make monster pet */ MFLAG2_NOGENO = 0x04, /* Cannot genocide */ @@ -17,4 +17,4 @@ typedef enum monster_flags2_type { MFLAG2_NOFLOW = 0x10, /* Monster is in no_flow_by_smell mode */ MFLAG2_SHOW = 0x20, /* Monster is recently memorized */ MFLAG2_MARK = 0x40, /* Monster is currently memorized */ -} monster_flags2_type; +}; diff --git a/src/monster/monster-processor.c b/src/monster/monster-processor.c index 90e9b2d69..4b2f99e5e 100644 --- a/src/monster/monster-processor.c +++ b/src/monster/monster-processor.c @@ -373,7 +373,7 @@ void process_special(player_type *target_ptr, MONSTER_IDX m_idx) int count = 0; DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); - BIT_FLAGS p_mode = is_pet(m_ptr) ? PM_FORCE_PET : 0L; + BIT_FLAGS p_mode = is_pet(m_ptr) ? PM_FORCE_PET : PM_NONE; for (int k = 0; k < A_MAX; k++) { if (summon_specific(target_ptr, m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) { diff --git a/src/monster/monster-timed-effect-types.h b/src/monster/monster-timed-effect-types.h index c8411db1d..4f80bd950 100644 --- a/src/monster/monster-timed-effect-types.h +++ b/src/monster/monster-timed-effect-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum monster_timed_effect_type { +enum monster_timed_effect_type { MTIMED_CSLEEP = 0, /* Monster is sleeping */ MTIMED_FAST = 1, /* Monster is temporarily fast */ MTIMED_SLOW = 2, /* Monster is temporarily slow */ @@ -9,4 +9,4 @@ typedef enum monster_timed_effect_type { MTIMED_MONFEAR = 5, /* Monster is afraid */ MTIMED_INVULNER = 6, /* Monster is temporarily invulnerable */ MAX_MTIMED = 7, -} monster_timed_effect_type; +}; diff --git a/src/monster/monster-util.c b/src/monster/monster-util.c index f61bb9abc..3c456d9f8 100644 --- a/src/monster/monster-util.c +++ b/src/monster/monster-util.c @@ -20,12 +20,12 @@ #include "util/bit-flags-calculator.h" #include "view/display-messages.h" -typedef enum dungeon_mode_type { +enum dungeon_mode_type { DUNGEON_MODE_AND = 1, DUNGEON_MODE_NAND = 2, DUNGEON_MODE_OR = 3, DUNGEON_MODE_NOR = 4, -} dungeon_mode_type; +}; MONSTER_IDX hack_m_idx = 0; /* Hack -- see "process_monsters()" */ MONSTER_IDX hack_m_idx_ii = 0; diff --git a/src/monster/monster-util.h b/src/monster/monster-util.h index c159ee0f3..ea15604b7 100644 --- a/src/monster/monster-util.h +++ b/src/monster/monster-util.h @@ -7,7 +7,7 @@ typedef bool (*monsterrace_hook_type)(player_type *, MONRACE_IDX); extern MONSTER_IDX hack_m_idx; extern MONSTER_IDX hack_m_idx_ii; extern int chameleon_change_m_idx; -typedef enum summon_type summon_type; +enum summon_type : int; extern summon_type summon_specific_type; monsterrace_hook_type get_monster_hook(player_type *player_ptr); diff --git a/src/monster/smart-learn-types.h b/src/monster/smart-learn-types.h index 98d83147c..eb9c8244d 100644 --- a/src/monster/smart-learn-types.h +++ b/src/monster/smart-learn-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum smart_learn_type { +enum smart_learn_type { SM_RES_ACID = 0x00000001, /*!< モンスターの学習フラグ: プレイヤーに酸耐性あり */ SM_RES_ELEC = 0x00000002, /*!< モンスターの学習フラグ: プレイヤーに電撃耐性あり */ SM_RES_FIRE = 0x00000004, /*!< モンスターの学習フラグ: プレイヤーに火炎耐性あり */ @@ -33,4 +33,4 @@ typedef enum smart_learn_type { SM_IMM_REFLECT = 0x20000000, /*!< モンスターの学習フラグ: プレイヤーに反射あり */ SM_IMM_FREE = 0x40000000, /*!< モンスターの学習フラグ: プレイヤーに麻痺耐性あり */ SM_IMM_MANA = 0x80000000, /*!< モンスターの学習フラグ: プレイヤーにMPがない */ -} smart_learn_type; +}; diff --git a/src/mspell/mspell-attack-util.h b/src/mspell/mspell-attack-util.h index 9bce2b9e7..ba35bebb4 100644 --- a/src/mspell/mspell-attack-util.h +++ b/src/mspell/mspell-attack-util.h @@ -2,12 +2,12 @@ #include "system/angband.h" -typedef enum mspell_lite_type { +enum mspell_lite_type { DO_SPELL_NONE = 0, DO_SPELL_BR_LITE = 1, DO_SPELL_BR_DISI = 2, DO_SPELL_BA_LITE = 3, -} mspell_lite_type; +}; // Monster Spell Attack. typedef struct monster_type monster_type; diff --git a/src/mspell/mspell-damage-calculator.h b/src/mspell/mspell-damage-calculator.h index ebebddce3..52f5713fa 100644 --- a/src/mspell/mspell-damage-calculator.h +++ b/src/mspell/mspell-damage-calculator.h @@ -3,7 +3,7 @@ #include "mspell/mspell-type.h" #include "system/angband.h" -typedef enum spell_flag_type { +enum spell_flag_type { DAM_ROLL = 1, DAM_MAX = 2, DAM_MIN = 3, @@ -12,7 +12,7 @@ typedef enum spell_flag_type { DICE_MULT = 6, DICE_DIV = 7, BASE_DAM = 8, -} spell_flag_type; +}; HIT_POINT monspell_damage(player_type* target_ptr, monster_spell_type ms_type, MONSTER_IDX m_idx, int TYPE); HIT_POINT monspell_race_damage(player_type* target_ptr, monster_spell_type ms_type, MONRACE_IDX r_idx, int TYPE); diff --git a/src/mspell/mspell-special.c b/src/mspell/mspell-special.c index b2afabb58..033af24f4 100644 --- a/src/mspell/mspell-special.c +++ b/src/mspell/mspell-special.c @@ -164,9 +164,9 @@ HIT_POINT spell_RF6_SPECIAL_B(player_type *target_ptr, POSITION y, POSITION x, M HIT_POINT dam = damroll(4, 8); if (monster_to_player || t_idx == target_ptr->riding) - teleport_player_to(target_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + teleport_player_to(target_ptr, m_ptr->fy, m_ptr->fx, static_cast(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE)); else - teleport_monster_to(target_ptr, t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + teleport_monster_to(target_ptr, t_idx, m_ptr->fy, m_ptr->fx, 100, static_cast(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE)); sound(SOUND_FALL); diff --git a/src/mspell/mspell-summon.c b/src/mspell/mspell-summon.c index 8d1a05a25..12bb6b642 100644 --- a/src/mspell/mspell-summon.c +++ b/src/mspell/mspell-summon.c @@ -229,10 +229,10 @@ void spell_RF6_S_MONSTER(player_type *target_ptr, POSITION y, POSITION x, MONSTE bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); for (int k = 0; k < 1; k++) { if (mon_to_player) - count += summon_specific(target_ptr, m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); + count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); if (mon_to_mon) - count += summon_specific(target_ptr, m_idx, y, x, rlev, 0, (monster_u_mode(floor_ptr, m_idx))); + count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_NONE, (monster_u_mode(floor_ptr, m_idx))); } if (target_ptr->blind && count && mon_to_player) @@ -265,10 +265,10 @@ void spell_RF6_S_MONSTERS(player_type *target_ptr, POSITION y, POSITION x, MONST bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); for (int k = 0; k < S_NUM_6; k++) { if (mon_to_player) - count += summon_specific(target_ptr, m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); + count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); if (mon_to_mon) - count += summon_specific(target_ptr, m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | monster_u_mode(floor_ptr, m_idx))); + count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_NONE, (PM_ALLOW_GROUP | monster_u_mode(floor_ptr, m_idx))); } if (target_ptr->blind && count && mon_to_player) @@ -686,9 +686,9 @@ void spell_RF6_S_UNIQUE(player_type *target_ptr, POSITION y, POSITION x, MONSTER if (count) uniques_are_summoned = TRUE; - int non_unique_type = SUMMON_HI_UNDEAD; + summon_type non_unique_type = SUMMON_HI_UNDEAD; if ((m_ptr->sub_align & (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL)) == (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL)) - non_unique_type = 0; + non_unique_type = SUMMON_NONE; else if (m_ptr->sub_align & SUB_ALIGN_GOOD) non_unique_type = SUMMON_ANGEL; diff --git a/src/mspell/mspell-type.h b/src/mspell/mspell-type.h index a82f502ad..d59bbd360 100644 --- a/src/mspell/mspell-type.h +++ b/src/mspell/mspell-type.h @@ -1,6 +1,6 @@ #pragma once -typedef enum monster_spell_type { +enum monster_spell_type : int { MS_SHRIEK = 0, MS_XXX1 = 1, MS_DISPEL = 2, @@ -97,4 +97,4 @@ typedef enum monster_spell_type { MS_S_HI_DRAGON = 93, MS_S_AMBERITE = 94, MS_S_UNIQUE = 95, -} monster_spell_type; +}; diff --git a/src/mutation/mutation-flag-types.h b/src/mutation/mutation-flag-types.h index 51f08c7d7..66944ee64 100644 --- a/src/mutation/mutation-flag-types.h +++ b/src/mutation/mutation-flag-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum racial_flag_type { +enum racial_flag_type { MUT1_SPIT_ACID = 0x00000001L, /*!< 突然変異: 酸の唾 */ MUT1_BR_FIRE = 0x00000002L, /*!< 突然変異: 炎のブレス */ MUT1_HYPN_GAZE = 0x00000004L, /*!< 突然変異: 催眠睨み */ @@ -33,9 +33,9 @@ typedef enum racial_flag_type { MUT1_BANISH = 0x20000000L, /*!< 突然変異: 邪悪消滅 */ MUT1_COLD_TOUCH = 0x40000000L, /*!< 突然変異: 凍結の手 */ MUT1_LAUNCHER = 0x80000000L, /*!< 突然変異: アイテム投げ */ -} racial_flag_type; +}; -typedef enum mutation_flag_type_1 { +enum mutation_flag_type_1 { MUT2_BERS_RAGE = 0x00000001L, /*!< 突然変異: 狂戦士化の発作 */ MUT2_COWARDICE = 0x00000002L, /*!< 突然変異: 臆病 */ MUT2_RTELEPORT = 0x00000004L, /*!< 突然変異: ランダムテレポート / Random teleport, instability */ @@ -68,9 +68,9 @@ typedef enum mutation_flag_type_1 { MUT2_SP_TO_HP = 0x20000000L, /*!< 突然変異: ランダムなMPからHPへの変換 */ MUT2_HP_TO_SP = 0x40000000L, /*!< 突然変異: ランダムなHPからMPへの変換 */ MUT2_DISARM = 0x80000000L, /*!< 突然変異: ランダムな武器落とし */ -} mutation_flag_type_1; +}; -typedef enum mutation_flag_type_2 { +enum mutation_flag_type_2 { MUT3_HYPER_STR = 0x00000001L, /*!< 突然変異: 超人的な力 */ MUT3_PUNY = 0x00000002L, /*!< 突然変異: 虚弱 */ MUT3_HYPER_INT = 0x00000004L, /*!< 突然変異: 生体コンピュータ */ @@ -103,4 +103,4 @@ typedef enum mutation_flag_type_2 { MUT3_VULN_ELEM = 0x20000000L, /*!< 突然変異: 元素攻撃弱点 */ MUT3_MOTION = 0x40000000L, /*!< 突然変異: 正確で力強い動作 */ MUT3_GOOD_LUCK = 0x80000000L, /*!< 突然変異: 白いオーラ(幸運) */ -} mutation_flag_type_2; +}; diff --git a/src/mutation/mutation-processor.c b/src/mutation/mutation-processor.c index e1aedc446..38fa36997 100644 --- a/src/mutation/mutation-processor.c +++ b/src/mutation/mutation-processor.c @@ -154,7 +154,7 @@ void process_world_aux_mutation(player_type *creature_ptr) lose_all_info(creature_ptr); else wiz_dark(creature_ptr); - (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + (void)teleport_player_aux(creature_ptr, 100, FALSE, static_cast(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE)); wiz_dark(creature_ptr); msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head...")); msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!")); diff --git a/src/mutation/mutation-techniques.c b/src/mutation/mutation-techniques.c index d6ec951ce..8bcc30704 100644 --- a/src/mutation/mutation-techniques.c +++ b/src/mutation/mutation-techniques.c @@ -45,7 +45,7 @@ bool eat_rock(player_type *caster_ptr) msg_print(_("何かが邪魔しています!", "There's something in the way!")); if (!m_ptr->ml || !is_pet(m_ptr)) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); } else if (has_flag(f_ptr->flags, FF_TREE)) { msg_print(_("木の味は好きじゃない!", "You don't like the woody taste!")); } else if (has_flag(f_ptr->flags, FF_GLASS)) { diff --git a/src/object-activation/activation-others.c b/src/object-activation/activation-others.c index ac897e1e7..6c29c2103 100644 --- a/src/object-activation/activation-others.c +++ b/src/object-activation/activation-others.c @@ -226,14 +226,14 @@ bool activate_extra_detection(player_type *user_ptr) msg_print(_("明るく輝いている...", "It glows brightly...")); detect_all(user_ptr, DETECT_RAD_DEFAULT); probing(user_ptr); - identify_fully(user_ptr, FALSE, 0); + identify_fully(user_ptr, FALSE, TV_NONE); return TRUE; } bool activate_fully_identification(player_type *user_ptr) { msg_print(_("黄色く輝いている...", "It glows yellow...")); - identify_fully(user_ptr, FALSE, 0); + identify_fully(user_ptr, FALSE, TV_NONE); return TRUE; } @@ -242,7 +242,7 @@ bool activate_fully_identification(player_type *user_ptr) * @param user_ptr プレーヤーへの参照ポインタ * @return 発動に成功したらTRUE */ -bool activate_identification(player_type *user_ptr) { return ident_spell(user_ptr, FALSE, 0); } +bool activate_identification(player_type *user_ptr) { return ident_spell(user_ptr, FALSE, TV_NONE); } bool activate_pesticide(player_type *user_ptr) { diff --git a/src/object-enchant/dragon-breaths-table.c b/src/object-enchant/dragon-breaths-table.c index 275424e7b..574ce88d8 100644 --- a/src/object-enchant/dragon-breaths-table.c +++ b/src/object-enchant/dragon-breaths-table.c @@ -20,6 +20,5 @@ const dragonbreath_type dragonbreath_info[] = { { TR_RES_NETHER, GF_NETHER, _("地獄", "nether") }, { TR_RES_CHAOS, GF_CHAOS, _("カオス", "chaos") }, { TR_RES_DISEN, GF_DISENCHANT, _("劣化", "disenchantment") }, - { 0, 0, NULL } + { TR_STR, 0, NULL } }; - diff --git a/src/object-enchant/item-apply-magic.h b/src/object-enchant/item-apply-magic.h index e805a49fb..0d03b7792 100644 --- a/src/object-enchant/item-apply-magic.h +++ b/src/object-enchant/item-apply-magic.h @@ -3,11 +3,12 @@ /* * Bit flags for apply_magic() */ -typedef enum item_am_type { +enum item_am_type : uint32_t { + AM_NONE = 0x00000000, AM_NO_FIXED_ART = 0x00000001, /*!< Don't allow roll for fixed artifacts */ AM_GOOD = 0x00000002, /*!< Generate good items */ AM_GREAT = 0x00000004, /*!< Generate great items */ AM_SPECIAL = 0x00000008, /*!< Generate artifacts (for debug mode only) */ AM_CURSED = 0x00000010, /*!< Generate cursed/worthless items */ AM_FORBID_CHEST = 0x00000020, /*!< 箱からさらに箱が出現することを抑止する */ -} item_am_type; +}; diff --git a/src/object-enchant/item-feeling.h b/src/object-enchant/item-feeling.h index 4a9333380..1e1685ee1 100644 --- a/src/object-enchant/item-feeling.h +++ b/src/object-enchant/item-feeling.h @@ -4,7 +4,7 @@ * アイテムの簡易鑑定定義 / Game generated inscription indices. These are stored in the object, * and are used to index the string array from tables.c. */ -typedef enum item_feel_type { +enum item_feel_type { FEEL_NONE = 0, /*!< 簡易鑑定: 未鑑定 */ FEEL_BROKEN = 1, /*!< 簡易鑑定: 壊れている */ FEEL_TERRIBLE = 2, /*!< 簡易鑑定: 恐ろしい */ @@ -16,4 +16,4 @@ typedef enum item_feel_type { FEEL_EXCELLENT = 8, /*!< 簡易鑑定: 高級 */ FEEL_SPECIAL = 9, /*!< 簡易鑑定: 特別 */ FEEL_MAX = 9, /*!< 簡易鑑定の種別数 */ -} item_feel_type; +}; diff --git a/src/object-enchant/special-object-flags.h b/src/object-enchant/special-object-flags.h index 2f732f37c..33a54e84b 100644 --- a/src/object-enchant/special-object-flags.h +++ b/src/object-enchant/special-object-flags.h @@ -3,7 +3,7 @@ /* * Special Object Flags */ -typedef enum sof_type { +enum sof_type { IDENT_SENSE = 0x01, /* Item has been "sensed" */ IDENT_FIXED = 0x02, /* Item has been "haggled" */ IDENT_EMPTY = 0x04, /* Item charges are known */ @@ -11,4 +11,4 @@ typedef enum sof_type { IDENT_STORE = 0x10, /* Item is storebought !!!! */ IDENT_FULL_KNOWN = 0x20, /* Item information is known */ IDENT_BROKEN = 0x80, /* Item is permanently worthless */ -} sof_type; +}; diff --git a/src/object-enchant/tr-types.h b/src/object-enchant/tr-types.h index e1423d7e9..52b8ea294 100644 --- a/src/object-enchant/tr-types.h +++ b/src/object-enchant/tr-types.h @@ -3,7 +3,7 @@ /*! * todo TRが何の略か分かる人、補足求む */ -typedef enum tr_type { +enum tr_type { TR_STR = 0, /* STR += "pval" */ TR_INT = 1, /* INT += "pval" */ TR_WIS = 2, /* WIS += "pval" */ @@ -157,4 +157,4 @@ typedef enum tr_type { TR_DARK_SOURCE = 146, TR_SUPPORTIVE = 147, TR_FLAG_MAX = 148, -} tr_type; +}; diff --git a/src/object-enchant/trc-types.h b/src/object-enchant/trc-types.h index 7d02e61a8..73a6742e4 100644 --- a/src/object-enchant/trc-types.h +++ b/src/object-enchant/trc-types.h @@ -1,7 +1,7 @@ #pragma once /* TRCが何の略かは分からない (type / ??? / curse)*/ -typedef enum trc_curse_type { +enum trc_curse_type { TRC_CURSED = 0x00000001L, TRC_HEAVY_CURSE = 0x00000002L, TRC_PERMA_CURSE = 0x00000004L, @@ -24,9 +24,9 @@ typedef enum trc_curse_type { TRC_DRAIN_HP = 0x00080000L, TRC_DRAIN_MANA = 0x00100000L, TRC_CALL_UNDEAD = 0x00200000L, -} trc_curse_type; +}; -typedef enum trc_special_type { +enum trc_special_type { TRC_TELEPORT_SELF = 0x00000001L, TRC_CHAINSWORD = 0x00000002L -} trc_special_type; +}; diff --git a/src/object-enchant/trg-types.h b/src/object-enchant/trg-types.h index 2c2987b2d..65ae18400 100644 --- a/src/object-enchant/trg-types.h +++ b/src/object-enchant/trg-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum trg_type { +enum trg_type { TRG_INSTA_ART = 0x00000001L, /* Item must be an artifact */ TRG_QUESTITEM = 0x00000002L, /* quest level item -KMW- */ TRG_XTRA_POWER = 0x00000004L, /* Extra power */ @@ -19,4 +19,4 @@ typedef enum trg_type { TRG_RANDOM_CURSE2 = 0x00008000L, /* Item is Random Cursed */ TRG_XTRA_DICE = 0x00010000L, /* Extra dice */ TRG_POWERFUL = 0x00020000L, /* Item has good value even if Cursed */ -} trg_type; +}; diff --git a/src/object-hook/hook-magic.c b/src/object-hook/hook-magic.c index 914f97ce9..683ef968f 100644 --- a/src/object-hook/hook-magic.c +++ b/src/object-hook/hook-magic.c @@ -105,7 +105,7 @@ bool item_tester_learn_spell(player_type *player_ptr, object_type *o_ptr) } } - if ((o_ptr->tval < TV_LIFE_BOOK) || (o_ptr->tval > (TV_LIFE_BOOK + MAX_REALM - 1))) + if ((o_ptr->tval < TV_LIFE_BOOK) || (o_ptr->tval > (TV_LIFE_BOOK + static_cast(MAX_REALM) - 1))) return FALSE; if ((o_ptr->tval == TV_MUSIC_BOOK) && (player_ptr->pclass == CLASS_BARD)) diff --git a/src/object-use/quaff-execution.c b/src/object-use/quaff-execution.c index e7dcd2526..ca5cfdaf3 100644 --- a/src/object-use/quaff-execution.c +++ b/src/object-use/quaff-execution.c @@ -80,7 +80,7 @@ static bool booze(player_type *creature_ptr) else wiz_dark(creature_ptr); - (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + (void)teleport_player_aux(creature_ptr, 100, FALSE, static_cast(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE)); wiz_dark(creature_ptr); msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head...")); msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing or how you got here!")); @@ -515,7 +515,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item) break; case SV_POTION_NEW_LIFE: - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); get_max_stats(creature_ptr); creature_ptr->update |= PU_BONUS; lose_all_mutations(creature_ptr); diff --git a/src/object-use/read-execution.c b/src/object-use/read-execution.c index 6ca2239a9..d88ec16f9 100644 --- a/src/object-use/read-execution.c +++ b/src/object-use/read-execution.c @@ -137,7 +137,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) } case SV_SCROLL_SUMMON_MONSTER: { for (k = 0; k < randint1(3); k++) { - if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, + if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_NONE, PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)) { ident = TRUE; } @@ -157,7 +157,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) } case SV_SCROLL_SUMMON_PET: { if (summon_specific( - creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, PM_ALLOW_GROUP | PM_FORCE_PET)) + creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_NONE, PM_ALLOW_GROUP | PM_FORCE_PET)) ident = TRUE; break; @@ -197,14 +197,14 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) break; } case SV_SCROLL_IDENTIFY: { - if (!ident_spell(creature_ptr, FALSE, 0)) + if (!ident_spell(creature_ptr, FALSE, TV_NONE)) used_up = FALSE; ident = TRUE; break; } case SV_SCROLL_STAR_IDENTIFY: { - if (!identify_fully(creature_ptr, FALSE, 0)) + if (!identify_fully(creature_ptr, FALSE, TV_NONE)) used_up = FALSE; ident = TRUE; diff --git a/src/object/item-use-flags.h b/src/object/item-use-flags.h index ed2e7f39c..75b7e63ba 100644 --- a/src/object/item-use-flags.h +++ b/src/object/item-use-flags.h @@ -3,11 +3,11 @@ /* * get_item()関数でアイテムの選択を行うフラグ / Bit flags for the "get_item" function */ -typedef enum item_use_flag { +enum item_use_flag { USE_EQUIP = 0x01, /*!< アイテム表示/選択範囲: 装備品からの選択を許可する / Allow equip items */ USE_INVEN = 0x02, /*!< アイテム表示/選択範囲: 所持品からの選択を許可する / Allow inven items */ USE_FLOOR = 0x04, /*!< アイテム表示/選択範囲: 床下のアイテムからの選択を許可する / Allow floor items */ USE_FORCE = 0x08, /*!< 特殊: wキーで錬気術への切り替えを許可する */ IGNORE_BOTHHAND_SLOT = 0x10, /*!< アイテム表示/選択範囲: 両手持ちスロットを選択に含めない */ USE_FULL = 0x20, /*!< アイテム表示/選択範囲: 空欄まですべて表示する*/ -} item_use_flag; +}; diff --git a/src/object/object-mark-types.h b/src/object/object-mark-types.h index fb2f0b7a9..60c7cb9df 100644 --- a/src/object/object-mark-types.h +++ b/src/object/object-mark-types.h @@ -10,10 +10,10 @@ #pragma once -typedef enum om_type { +enum om_type { OM_FOUND = 0x01, /*!< アイテムを一度でも視界に収めたことがあるか */ OM_NOMSG = 0x02, /* temporary flag to suppress messages */ OM_NO_QUERY = 0x04, /* Query for auto-pick was already answered as 'No' */ OM_AUTODESTROY = 0x08, /* Destroy later to avoid illegal inventry shift */ OM_TOUCHED = 0x10, /* Object was touched by player */ -} om_type; +}; diff --git a/src/object/tval-types.h b/src/object/tval-types.h index 2fd2ca20d..92beacc83 100644 --- a/src/object/tval-types.h +++ b/src/object/tval-types.h @@ -14,7 +14,7 @@ #pragma once -typedef enum tval_type { +enum tval_type { TV_NONE = 0, TV_SKELETON = 1, /* Skeletons ('s'), not specified */ TV_BOTTLE = 2, /* Empty bottles ('!') */ @@ -70,7 +70,7 @@ typedef enum tval_type { TV_HISSATSU_BOOK = 106, TV_HEX_BOOK = 107, TV_GOLD = 127, /* Gold can only be picked up by players */ -} tval_type; +}; #define TV_EQUIP_BEGIN TV_SHOT #define TV_EQUIP_END TV_CARD diff --git a/src/object/warning.c b/src/object/warning.c index 32d858f28..2771ee7d8 100644 --- a/src/object/warning.c +++ b/src/object/warning.c @@ -55,7 +55,7 @@ object_type *choose_warning_item(player_type *creature_ptr) /* Search Inventory */ int number = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { BIT_FLAGS flgs[TR_FLAG_SIZE]; object_type *o_ptr = &creature_ptr->inventory_list[i]; diff --git a/src/pet/pet-util.h b/src/pet/pet-util.h index b05d7d999..4a5a49c5c 100644 --- a/src/pet/pet-util.h +++ b/src/pet/pet-util.h @@ -1,6 +1,6 @@ #pragma once -typedef enum pet_command { +enum pet_command { PET_DISMISS = 1, /*!< ペットに関するコマンド: ペットを離す */ PET_TARGET = 2, /*!< ペットに関するコマンド: ペットのターゲットを指定 */ PET_STAY_CLOSE = 3, /*!< ペットに関するコマンド: 近くにいろ */ @@ -17,18 +17,18 @@ typedef enum pet_command { PET_RIDING = 14, /*!< ペットに関するコマンド: ペットに乗る */ PET_NAME = 15, /*!< ペットに関するコマンド: ペットに名前をつける */ PET_TWO_HANDS = 16, /*!< ペットに関するコマンド: 騎乗中に両手で武器を使うかどうか */ -} pet_command; +}; -typedef enum pet_follow_distance { +enum pet_follow_distance { PET_CLOSE_DIST = 1, /*!<ペットの行動範囲…近くにいろ */ PET_FOLLOW_DIST = 6, /*!<ペットの行動範囲…ついて来い */ PET_SEEK_DIST = 10, /*!<ペットの行動範囲…特になし? */ PET_DESTROY_DIST = 255, /*!<ペットの行動範囲…敵を見つけて倒せ */ PET_SPACE_DIST = -10, /*!<ペットの行動範囲…少し離れていろ */ PET_AWAY_DIST = -25, /*!<ペットの行動範囲…離れていろ */ -} pet_follow_distance; +}; -typedef enum pet_permission { +enum pet_permission { PF_OPEN_DOORS = 0x0001, /*!< ペットの行動許可…ドアを開けてよい */ PF_PICKUP_ITEMS = 0x0002, /*!< ペットの行動許可…アイテムを拾ってよい */ PF_TELEPORT = 0x0004, /*!< ペットの行動許可…テレポート魔法を使ってよい */ @@ -36,7 +36,7 @@ typedef enum pet_permission { PF_SUMMON_SPELL = 0x0010, /*!< ペットの行動許可…召喚魔法を使ってよい */ PF_BALL_SPELL = 0x0020, /*!< ペットの行動許可…ボール魔法でプレイヤーを巻き込んでよい */ PF_TWO_HANDS = 0x0040, /*!< プレイヤーの騎乗フラグ…武器を片手で持つ */ -} pet_permission; +}; #include "system/angband.h" #include "grid/grid.h" diff --git a/src/player-attack/player-attack-util.h b/src/player-attack/player-attack-util.h index 3586a0e3d..d8088bb54 100644 --- a/src/player-attack/player-attack-util.h +++ b/src/player-attack/player-attack-util.h @@ -7,14 +7,14 @@ #include "system/object-type-definition.h" #include "system/monster-type-definition.h" -typedef enum chaotic_effect { +enum chaotic_effect { CE_NONE = 0, CE_VAMPIRIC = 1, CE_QUAKE = 2, CE_CONFUSION = 3, CE_TELE_AWAY = 4, CE_POLYMORPH = 5, -} chaotic_effect; +}; typedef struct player_attack_type { s16b hand; diff --git a/src/player-attack/player-attack.c b/src/player-attack/player-attack.c index fbd6e4cae..36b9d6a4e 100644 --- a/src/player-attack/player-attack.c +++ b/src/player-attack/player-attack.c @@ -128,7 +128,7 @@ static void get_bare_knuckle_exp(player_type *attacker_ptr, player_attack_type * */ static void get_weapon_exp(player_type *attacker_ptr, player_attack_type *pa_ptr) { - tval_type tval = attacker_ptr->inventory_list[INVEN_MAIN_HAND + pa_ptr->hand].tval - TV_WEAPON_BEGIN; + int tval = attacker_ptr->inventory_list[INVEN_MAIN_HAND + pa_ptr->hand].tval - TV_WEAPON_BEGIN; OBJECT_SUBTYPE_VALUE sval = attacker_ptr->inventory_list[INVEN_MAIN_HAND + pa_ptr->hand].sval; int now_exp = attacker_ptr->weapon_exp[tval][sval]; if (now_exp >= s_info[attacker_ptr->pclass].w_max[tval][sval]) @@ -499,6 +499,6 @@ void massacre(player_type *caster_ptr) g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x]; m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if (g_ptr->m_idx && (m_ptr->ml || cave_has_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT))) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); } } diff --git a/src/player-info/base-status-types.h b/src/player-info/base-status-types.h index 9e2cb6227..c5e951af4 100644 --- a/src/player-info/base-status-types.h +++ b/src/player-info/base-status-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum base_status_type { +enum base_status_type { A_STR = 0, A_INT = 1, A_WIS = 2, @@ -8,4 +8,4 @@ typedef enum base_status_type { A_CON = 4, A_CHR = 5, A_MAX = 6, -} base_status_type; +}; diff --git a/src/player/attack-defense-types.h b/src/player/attack-defense-types.h index ac00dd474..e4adfa950 100644 --- a/src/player/attack-defense-types.h +++ b/src/player/attack-defense-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum special_attack_type { +enum special_attack_type { ATTACK_CONFUSE = 0x00000001, /*!< プレイヤーのステータス:混乱打撃 */ ATTACK_XXX1 = 0x00000002, /*!< プレイヤーのステータス:未使用1 */ ATTACK_XXX2 = 0x00000004, /*!< プレイヤーのステータス:未使用2 */ @@ -12,9 +12,9 @@ typedef enum special_attack_type { ATTACK_POIS = 0x00000100, /*!< プレイヤーのステータス:魔法剣/毒殺 */ ATTACK_HOLY = 0x00000200, /*!< プレイヤーのステータス:対邪?(未使用) */ ATTACK_SUIKEN = 0x00000400, /*!< プレイヤーのステータス:酔拳 */ -} special_attack_type; +}; -typedef enum special_defense_type { +enum special_defense_type { ACTION_NONE = 0, /*!< 持続行動: なし */ ACTION_SEARCH = 1, /*!< 持続行動: 探索 */ ACTION_REST = 2, /*!< 持続行動: 休憩 */ @@ -25,4 +25,4 @@ typedef enum special_defense_type { ACTION_SING = 7, /*!< 持続行動: 歌 */ ACTION_HAYAGAKE = 8, /*!< 持続行動: 早駆け */ ACTION_SPELL = 9, /*!< 持続行動: 呪術 */ -} special_defense_type; +}; diff --git a/src/player/patron.c b/src/player/patron.c index 1fdd0f323..1d55a8db0 100644 --- a/src/player/patron.c +++ b/src/player/patron.c @@ -291,7 +291,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_print(_("「我が下僕たちよ、かの傲慢なる者を倒すべし!」", "'My pets, destroy the arrogant mortal!'")); for (int i = 0, summon_num = randint1(5) + 1; i < summon_num; i++) { - (void)summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, + (void)summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } reward = _("モンスターを召喚された。", "summoning hostile monsters"); @@ -342,7 +342,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_print(_("「汝、謙虚たることを学ぶべし!」", "'Thou needst a lesson in humility, mortal!'")); msg_print(_("あなたは以前より弱くなった!", "You feel less powerful!")); - for (base_status_type stat = 0; stat < A_MAX; stat++) { + for (int stat = 0; stat < A_MAX; stat++) { (void)dec_stat(creature_ptr, stat, 10 + randint1(15), TRUE); } reward = _("全能力値が下がった。", "decreasing all stats"); @@ -361,7 +361,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_print(_("「我がささやかなる賜物を受けとるがよい!」", "'Receive this modest gift from me!'")); - for (base_status_type stat = 0; stat < A_MAX; stat++) { + for (int stat = 0; stat < A_MAX; stat++) { (void)do_inc_stat(creature_ptr, stat); } reward = _("全能力値が上がった。", "increasing all stats"); @@ -455,7 +455,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) } break; default: - for (base_status_type stat = 0; stat < A_MAX; stat++) { + for (int stat = 0; stat < A_MAX; stat++) { (void)dec_stat(creature_ptr, stat, 10 + randint1(15), TRUE); } reward = _("全能力値が下がった。", "decreasing all stats"); @@ -469,13 +469,13 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_print(_("「死ぬがよい、下僕よ!」", "'Die, mortal!'")); take_hit(creature_ptr, DAMAGE_LOSELIFE, creature_ptr->lev * 4, wrath_reason, -1); - for (base_status_type stat = 0; stat < A_MAX; stat++) { + for (int stat = 0; stat < A_MAX; stat++) { (void)dec_stat(creature_ptr, stat, 10 + randint1(15), FALSE); } activate_hi_summon(creature_ptr, creature_ptr->y, creature_ptr->x, FALSE); (void)activate_ty_curse(creature_ptr, FALSE, &count); if (one_in_(2)) { - inventory_slot_type slot = 0; + inventory_slot_type slot = INVEN_NONE; if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)) { slot = INVEN_MAIN_HAND; @@ -542,7 +542,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) case REW_SER_MONS: msg_format(_("%sは褒美として使いをよこした!", "%s rewards you with a servant!"), chaos_patrons[creature_ptr->chaos_patron]); - if (!summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, 0, PM_FORCE_PET)) + if (!summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_NONE, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("モンスターがペットになった。", "a servant"); diff --git a/src/player/player-classes-types.h b/src/player/player-classes-types.h index 8df6543ad..5a3cee398 100644 --- a/src/player/player-classes-types.h +++ b/src/player/player-classes-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum player_class_type { +enum player_class_type { CLASS_WARRIOR = 0, CLASS_MAGE = 1, CLASS_PRIEST = 2, @@ -30,4 +30,4 @@ typedef enum player_class_type { CLASS_NINJA = 26, CLASS_SNIPER = 27, MAX_CLASS = 28, /*!< 職業の最大定義数 Maximum number of player "class" types (see "table.c", etc) */ -} player_class_type; +}; diff --git a/src/player/player-damage.c b/src/player/player-damage.c index 2c86c5ef9..391cf84e3 100644 --- a/src/player/player-damage.c +++ b/src/player/player-damage.c @@ -263,6 +263,8 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int */ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concptr hit_from, int monspell) { + (void)monspell; // unused + int old_chp = creature_ptr->chp; char death_message[1024]; diff --git a/src/player/player-personalities-types.h b/src/player/player-personalities-types.h index e04984e67..8c3692144 100644 --- a/src/player/player-personalities-types.h +++ b/src/player/player-personalities-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum player_personality_type { +enum player_personality_type { PERSONALITY_ORDINARY = 0, PERSONALITY_MIGHTY = 1, PERSONALITY_SHREWD = 2, @@ -15,4 +15,4 @@ typedef enum player_personality_type { PERSONALITY_MUNCHKIN = 11, PERSONALITY_CHARGEMAN = 12, MAX_PERSONALITIES = 13, -} player_personality_type; +}; diff --git a/src/player/player-race-types.h b/src/player/player-race-types.h index f58f5de85..e79419469 100644 --- a/src/player/player-race-types.h +++ b/src/player/player-race-types.h @@ -3,7 +3,7 @@ /*! * @details 既にplayer_raceが存在するので_typeと付けた */ -typedef enum player_race_type { +enum player_race_type { RACE_HUMAN = 0, RACE_HALF_ELF = 1, RACE_ELF = 2, @@ -43,4 +43,4 @@ typedef enum player_race_type { RACE_ANDROID = 36, RACE_MERFOLK = 37, MAX_RACES = 38, -} player_race_type; +}; diff --git a/src/player/player-realm.h b/src/player/player-realm.h index 46750c2c8..68cef0020 100644 --- a/src/player/player-realm.h +++ b/src/player/player-realm.h @@ -3,7 +3,7 @@ #include "system/angband.h" /* 職業ごとの選択可能な魔法領域 / Possible realms that can be chosen. */ -typedef enum choosable_realm { +enum choosable_realm { CH_NONE = 0x00, CH_LIFE = 0x01, CH_SORCERY = 0x02, @@ -19,7 +19,7 @@ typedef enum choosable_realm { CH_MUSIC = 0x8000, CH_HISSATSU = 0x10000, CH_HEX = 0x20000, -} choosable_realm; +}; extern const u32b realm_choices1[]; extern const u32b realm_choices2[]; diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index bb3921dd3..5a95cfecb 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -75,7 +75,7 @@ BIT_FLAGS check_equipment_flags(player_type *creature_ptr, tr_type tr_flag) object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; BIT_FLAGS result = 0L; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -83,7 +83,7 @@ BIT_FLAGS check_equipment_flags(player_type *creature_ptr, tr_type tr_flag) object_flags(creature_ptr, o_ptr, flgs); if (has_flag(flgs, tr_flag)) - set_bits(result, convert_inventory_slot_type_to_flag_cause(i)); + set_bits(result, convert_inventory_slot_type_to_flag_cause(static_cast(i))); } return result; } @@ -697,7 +697,7 @@ BIT_FLAGS has_reflect(player_type *creature_ptr) return result; } -BIT_FLAGS has_see_nocto(player_type *creature_ptr) { return creature_ptr->pclass == CLASS_NINJA ? FLAG_CAUSE_CLASS : 0L; } +BIT_FLAGS has_see_nocto(player_type *creature_ptr) { return (creature_ptr->pclass == CLASS_NINJA) ? FLAG_CAUSE_CLASS : FLAG_CAUSE_NONE; } BIT_FLAGS has_warning(player_type *creature_ptr) { @@ -705,7 +705,7 @@ BIT_FLAGS has_warning(player_type *creature_ptr) object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -714,7 +714,7 @@ BIT_FLAGS has_warning(player_type *creature_ptr) if (has_flag(flgs, TR_WARNING)) { if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$'))) - set_bits(result, convert_inventory_slot_type_to_flag_cause(i)); + set_bits(result, convert_inventory_slot_type_to_flag_cause(static_cast(i))); } } return result; @@ -1063,7 +1063,7 @@ BIT_FLAGS has_levitation(player_type *creature_ptr) if (creature_ptr->riding) { monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; - result = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? FLAG_CAUSE_RIDING : 0; + result = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? FLAG_CAUSE_RIDING : FLAG_CAUSE_NONE; } return result; } @@ -1166,7 +1166,7 @@ void update_curses(player_type *creature_ptr) if (creature_ptr->pseikaku == PERSONALITY_SEXY) creature_ptr->cursed |= (TRC_AGGRAVATE); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -1237,7 +1237,7 @@ void update_extra_blows(player_type *creature_ptr) BIT_FLAGS flgs[TR_FLAG_SIZE]; creature_ptr->extra_blows[0] = creature_ptr->extra_blows[1] = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -2015,7 +2015,7 @@ bool has_not_ninja_weapon(player_type *creature_ptr, int i) if (!has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) { return FALSE; } - tval_type tval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].tval - TV_WEAPON_BEGIN; + int tval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].tval - TV_WEAPON_BEGIN; OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].sval; return creature_ptr->pclass == CLASS_NINJA && !((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_SUB_HAND - i].tval != TV_SHIELD)); @@ -2026,7 +2026,7 @@ bool has_not_monk_weapon(player_type *creature_ptr, int i) if (!has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) { return FALSE; } - tval_type tval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].tval - TV_WEAPON_BEGIN; + int tval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].tval - TV_WEAPON_BEGIN; OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_MAIN_HAND + i].sval; return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && !(s_info[creature_ptr->pclass].w_max[tval][sval]); } diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index 198547d48..fdf2dcfd1 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -1,7 +1,8 @@ #include "player/player-status.h" #include "object-enchant/tr-types.h" -enum flag_cause { +enum flag_cause : uint32_t { + FLAG_CAUSE_NONE = 0x0U, FLAG_CAUSE_INVEN_MAIN_HAND = 0x01U << 0, /*!< アイテムスロット…利手 */ FLAG_CAUSE_INVEN_SUB_HAND = 0x01U << 1, /*!< アイテムスロット…逆手 */ FLAG_CAUSE_INVEN_BOW = 0x01U << 2, /*!< アイテムスロット…射撃 */ @@ -26,7 +27,7 @@ enum flag_cause { FLAG_CAUSE_MAX = 0x01U << 21 }; -typedef enum melee_type { +enum melee_type { MELEE_TYPE_BAREHAND_TWO = 0, MELEE_TYPE_BAREHAND_MAIN = 1, MELEE_TYPE_BAREHAND_SUB = 2, @@ -35,7 +36,7 @@ typedef enum melee_type { MELEE_TYPE_WEAPON_TWOHAND = 5, MELEE_TYPE_WEAPON_DOUBLE = 6, MELEE_TYPE_SHIELD_DOUBLE = 7 -} melee_type; +}; enum aggravate_state { AGGRAVATE_NONE = 0x00000000L, diff --git a/src/player/player-status-resist.h b/src/player/player-status-resist.h index 5bbcf35c7..55f2e192f 100644 --- a/src/player/player-status-resist.h +++ b/src/player/player-status-resist.h @@ -3,12 +3,12 @@ #include "system/angband.h" #include "player/player-status.h" -typedef enum rate_calc_type_mode { +enum rate_calc_type_mode { CALC_RAND = 0, CALC_AVERAGE = 1, CALC_MIN = 2, CALC_MAX = 3, -} rate_calc_type_mode; +}; PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr); diff --git a/src/player/player-status-table.c b/src/player/player-status-table.c index a477defd4..ad448cf9d 100644 --- a/src/player/player-status-table.c +++ b/src/player/player-status-table.c @@ -3,7 +3,7 @@ /*! * @brief 能力値テーブル / Abbreviations of healthy stats */ -const concptr stat_names[A_MAX] = { +extern const concptr stat_names[A_MAX] = { #ifdef JP "腕力 :", "知能 :", "賢さ :", "器用 :", "耐久 :", "魅力 :" #else @@ -14,7 +14,7 @@ const concptr stat_names[A_MAX] = { /*! * @brief 能力値テーブル(能力低下時) / Abbreviations of damaged stats */ -const concptr stat_names_reduced[A_MAX] = { +extern const concptr stat_names_reduced[A_MAX] = { #ifdef JP "腕力x:", "知能x:", "賢さx:", "器用x:", "耐久x:", "魅力x:" #else @@ -26,7 +26,7 @@ const concptr stat_names_reduced[A_MAX] = { * @brief 基本必要経験値テーブル / * Base experience levels, may be adjusted up for race and/or class */ -const s32b player_exp[PY_MAX_LEVEL] = { 10, 25, 45, 70, 100, 140, 200, 280, 380, /*10*/ +extern const s32b player_exp[PY_MAX_LEVEL] = { 10, 25, 45, 70, 100, 140, 200, 280, 380, /*10*/ 500, 650, 850, 1100, 1400, 1800, 2300, 2900, 3600, 4400, /*20*/ 5400, 6800, 8400, 10200, 12500, 17500, 25000, 35000L, 50000L, 75000L, /*30*/ 100000L, 150000L, 200000L, 275000L, 350000L, 450000L, 550000L, 700000L, 850000L, 1000000L, /*40*/ @@ -36,7 +36,7 @@ const s32b player_exp[PY_MAX_LEVEL] = { 10, 25, 45, 70, 100, 140, 200, 280, 380, /*! * @brief 基本必要強化値テーブル(アンドロイド専用) */ -const s32b player_exp_a[PY_MAX_LEVEL] = { 20, 50, 100, 170, 280, 430, 650, 950, 1400, /*10*/ +extern const s32b player_exp_a[PY_MAX_LEVEL] = { 20, 50, 100, 170, 280, 430, 650, 950, 1400, /*10*/ 1850, 2300, 2900, 3600, 4400, 5400, 6800, 8400, 10400, 12500, /*20*/ 17500, 25000, 35000, 50000L, 75000L, 100000L, 150000L, 200000L, 275000L, 350000L, /*30*/ 450000L, 550000L, 650000L, 800000L, 950000L, 1100000L, 1250000L, 1400000L, 1550000L, 1700000L, /*40*/ @@ -47,7 +47,7 @@ const s32b player_exp_a[PY_MAX_LEVEL] = { 20, 50, 100, 170, 280, 430, 650, 950, * 知力/賢さによるレベル毎の習得可能魔法数テーブル * Stat Table (INT/WIS) -- Number of half-spells per level */ -const byte adj_mag_study[] = { +extern const byte adj_mag_study[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* 10 */, 1 /* 11 */, 2 /* 12 */, 2 /* 13 */, 2 /* 14 */, 2 /* 15 */, 2 /* 16 */, 2 /* 17 */, 2 /* 18/00-18/09 */, 2 /* 18/10-18/19 */, 2 /* 18/20-18/29 */, 2 /* 18/30-18/39 */, 2 /* 18/40-18/49 */, 3 /* 18/50-18/59 */, 3 /* 18/60-18/69 */, 3 /* 18/70-18/79 */, 3 /* 18/80-18/89 */, 4 /* 18/90-18/99 */, 4 /* 18/100-18/109 */, 4 /* 18/110-18/119 */, 5 /* 18/120-18/129 */, @@ -59,7 +59,7 @@ const byte adj_mag_study[] = { * 知力/賢さによるMP修正テーブル * Stat Table (INT/WIS) -- extra 1/4-mana-points per level */ -const byte adj_mag_mana[] = { +extern const byte adj_mag_mana[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 2 /* 9 */, 3 /* 10 */, 4 /* 11 */, 5 /* 12 */, 5 /* 13 */, 6 /* 14 */, 7 /* 15 */, 8 /* 16 */, 9 /* 17 */, 10 /* 18/00-18/09 */, 11 /* 18/10-18/19 */, 11 /* 18/20-18/29 */, 12 /* 18/30-18/39 */, 12 /* 18/40-18/49 */, 13 /* 18/50-18/59 */, 14 /* 18/60-18/69 */, 15 /* 18/70-18/79 */, 16 /* 18/80-18/89 */, 17 /* 18/90-18/99 */, 18 /* 18/100-18/109 */, 19 /* 18/110-18/119 */, @@ -71,7 +71,7 @@ const byte adj_mag_mana[] = { * 知力/賢さによる最低魔法失敗率テーブル * Stat Table (INT/WIS) -- Minimum failure rate (percentage) */ -const byte adj_mag_fail[] = { +extern const byte adj_mag_fail[] = { 99 /* 3 */, 99 /* 4 */, 99 /* 5 */, 99 /* 6 */, 99 /* 7 */, 50 /* 8 */, 30 /* 9 */, 20 /* 10 */, 15 /* 11 */, 12 /* 12 */, 11 /* 13 */, 10 /* 14 */, 9 /* 15 */, 8 /* 16 */, 7 /* 17 */, 6 /* 18/00-18/09 */, 6 /* 18/10-18/19 */, 5 /* 18/20-18/29 */, 5 /* 18/30-18/39 */, 5 /* 18/40-18/49 */, 4 /* 18/50-18/59 */, 4 /* 18/60-18/69 */, 4 /* 18/70-18/79 */, 4 /* 18/80-18/89 */, 3 /* 18/90-18/99 */, 3 /* 18/100-18/109 */, 2 /* 18/110-18/119 */, @@ -83,7 +83,7 @@ const byte adj_mag_fail[] = { * 知力/賢さによる魔法失敗率修正テーブル * Stat Table (INT/WIS) -- Various things */ -const byte adj_mag_stat[] = { +extern const byte adj_mag_stat[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* 10 */, 1 /* 11 */, 1 /* 12 */, 1 /* 13 */, 1 /* 14 */, 2 /* 15 */, 2 /* 16 */, 2 /* 17 */, 3 /* 18/00-18/09 */, 3 /* 18/10-18/19 */, 3 /* 18/20-18/29 */, 3 /* 18/30-18/39 */, 3 /* 18/40-18/49 */, 4 /* 18/50-18/59 */, 4 /* 18/60-18/69 */, 5 /* 18/70-18/79 */, 6 /* 18/80-18/89 */, 7 /* 18/90-18/99 */, 8 /* 18/100-18/109 */, 9 /* 18/110-18/119 */, 10 /* 18/120-18/129 */, @@ -95,7 +95,7 @@ const byte adj_mag_stat[] = { * 魅力による店での取引修正テーブル * Stat Table (CHR) -- payment percentages */ -const byte adj_chr_gold[] = { +extern const byte adj_chr_gold[] = { 130 /* 3 */, 125 /* 4 */, 122 /* 5 */, 120 /* 6 */, 118 /* 7 */, 116 /* 8 */, 114 /* 9 */, 112 /* 10 */, 110 /* 11 */, 108 /* 12 */, 106 /* 13 */, 104 /* 14 */, 103 /* 15 */, 102 /* 16 */, 101 /* 17 */, 100 /* 18/00-18/09 */, 99 /* 18/10-18/19 */, 98 /* 18/20-18/29 */, 97 /* 18/30-18/39 */, 96 /* 18/40-18/49 */, 95 /* 18/50-18/59 */, 94 /* 18/60-18/69 */, 93 /* 18/70-18/79 */, 92 /* 18/80-18/89 */, 91 /* 18/90-18/99 */, 90 /* 18/100-18/109 */, @@ -107,7 +107,7 @@ const byte adj_chr_gold[] = { * 知力による魔道具使用修正テーブル * Stat Table (INT) -- Magic devices */ -const byte adj_int_dev[] = { +extern const byte adj_int_dev[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* 10 */, 1 /* 11 */, 1 /* 12 */, 1 /* 13 */, 1 /* 14 */, 2 /* 15 */, 2 /* 16 */, 2 /* 17 */, 3 /* 18/00-18/09 */, 3 /* 18/10-18/19 */, 4 /* 18/20-18/29 */, 4 /* 18/30-18/39 */, 5 /* 18/40-18/49 */, 5 /* 18/50-18/59 */, 6 /* 18/60-18/69 */, 6 /* 18/70-18/79 */, 7 /* 18/80-18/89 */, 7 /* 18/90-18/99 */, 8 /* 18/100-18/109 */, 9 /* 18/110-18/119 */, 10 /* 18/120-18/129 */, @@ -119,7 +119,7 @@ const byte adj_int_dev[] = { * 賢さによる魔法防御修正テーブル * Stat Table (WIS) -- Saving throw */ -const byte adj_wis_sav[] = { +extern const byte adj_wis_sav[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* 10 */, 1 /* 11 */, 1 /* 12 */, 1 /* 13 */, 1 /* 14 */, 2 /* 15 */, 2 /* 16 */, 2 /* 17 */, 3 /* 18/00-18/09 */, 3 /* 18/10-18/19 */, 3 /* 18/20-18/29 */, 3 /* 18/30-18/39 */, 3 /* 18/40-18/49 */, 4 /* 18/50-18/59 */, 4 /* 18/60-18/69 */, 5 /* 18/70-18/79 */, 5 /* 18/80-18/89 */, 6 /* 18/90-18/99 */, 7 /* 18/100-18/109 */, 8 /* 18/110-18/119 */, 9 /* 18/120-18/129 */, @@ -131,7 +131,7 @@ const byte adj_wis_sav[] = { * 器用さによるトラップ解除修正テーブル * Stat Table (DEX) -- disarming */ -const byte adj_dex_dis[] = { +extern const byte adj_dex_dis[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 0 /* 8 */, 0 /* 9 */, 0 /* 10 */, 0 /* 11 */, 0 /* 12 */, 1 /* 13 */, 1 /* 14 */, 1 /* 15 */, 2 /* 16 */, 2 /* 17 */, 4 /* 18/00-18/09 */, 4 /* 18/10-18/19 */, 4 /* 18/20-18/29 */, 4 /* 18/30-18/39 */, 5 /* 18/40-18/49 */, 5 /* 18/50-18/59 */, 5 /* 18/60-18/69 */, 6 /* 18/70-18/79 */, 6 /* 18/80-18/89 */, 7 /* 18/90-18/99 */, 8 /* 18/100-18/109 */, 8 /* 18/110-18/119 */, 8 /* 18/120-18/129 */, @@ -143,7 +143,7 @@ const byte adj_dex_dis[] = { * 知力によるトラップ解除修正テーブル * Stat Table (INT) -- disarming */ -const byte adj_int_dis[] = { +extern const byte adj_int_dis[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* 10 */, 1 /* 11 */, 1 /* 12 */, 1 /* 13 */, 1 /* 14 */, 2 /* 15 */, 2 /* 16 */, 2 /* 17 */, 3 /* 18/00-18/09 */, 3 /* 18/10-18/19 */, 3 /* 18/20-18/29 */, 4 /* 18/30-18/39 */, 4 /* 18/40-18/49 */, 5 /* 18/50-18/59 */, 6 /* 18/60-18/69 */, 7 /* 18/70-18/79 */, 8 /* 18/80-18/89 */, 9 /* 18/90-18/99 */, 10 /* 18/100-18/109 */, 10 /* 18/110-18/119 */, 11 /* 18/120-18/129 */, @@ -155,7 +155,7 @@ const byte adj_int_dis[] = { * 器用さによるAC修正テーブル * Stat Table (DEX) -- bonus to ac (plus 128) */ -const byte adj_dex_ta[] = { +extern const byte adj_dex_ta[] = { 128 + -4 /* 3 */, 128 + -3 /* 4 */, 128 + -2 /* 5 */, 128 + -1 /* 6 */, 128 + 0 /* 7 */, 128 + 0 /* 8 */, 128 + 0 /* 9 */, 128 + 0 /* 10 */, 128 + 0 /* 11 */, 128 + 0 /* 12 */, 128 + 0 /* 13 */, 128 + 0 /* 14 */, 128 + 1 /* 15 */, 128 + 1 /* 16 */, 128 + 1 /* 17 */, 128 + 2 /* 18/00-18/09 */, 128 + 2 /* 18/10-18/19 */, 128 + 2 /* 18/20-18/29 */, 128 + 2 /* 18/30-18/39 */, 128 + 2 /* 18/40-18/49 */, 128 + 3 /* 18/50-18/59 */, @@ -169,7 +169,7 @@ const byte adj_dex_ta[] = { * 腕力によるダメージ修正テーブル * Stat Table (STR) -- bonus to dam (plus 128) */ -const byte adj_str_td[] = { +extern const byte adj_str_td[] = { 128 + -2 /* 3 */, 128 + -2 /* 4 */, 128 + -1 /* 5 */, 128 + -1 /* 6 */, 128 + 0 /* 7 */, 128 + 0 /* 8 */, 128 + 0 /* 9 */, 128 + 0 /* 10 */, 128 + 0 /* 11 */, 128 + 0 /* 12 */, 128 + 0 /* 13 */, 128 + 0 /* 14 */, 128 + 0 /* 15 */, 128 + 1 /* 16 */, 128 + 2 /* 17 */, 128 + 2 /* 18/00-18/09 */, 128 + 2 /* 18/10-18/19 */, 128 + 3 /* 18/20-18/29 */, 128 + 3 /* 18/30-18/39 */, 128 + 3 /* 18/40-18/49 */, 128 + 3 /* 18/50-18/59 */, @@ -183,7 +183,7 @@ const byte adj_str_td[] = { * 器用度による命中修正テーブル * Stat Table (DEX) -- bonus to hit (plus 128) */ -const byte adj_dex_th[] = { +extern const byte adj_dex_th[] = { 128 + -3 /* 3 */, 128 + -2 /* 4 */, 128 + -2 /* 5 */, 128 + -1 /* 6 */, 128 + -1 /* 7 */, 128 + 0 /* 8 */, 128 + 0 /* 9 */, 128 + 0 /* 10 */, 128 + 0 /* 11 */, 128 + 0 /* 12 */, 128 + 0 /* 13 */, 128 + 0 /* 14 */, 128 + 0 /* 15 */, 128 + 1 /* 16 */, 128 + 2 /* 17 */, 128 + 3 /* 18/00-18/09 */, 128 + 3 /* 18/10-18/19 */, 128 + 3 /* 18/20-18/29 */, 128 + 3 /* 18/30-18/39 */, 128 + 3 /* 18/40-18/49 */, 128 + 4 /* 18/50-18/59 */, @@ -197,7 +197,7 @@ const byte adj_dex_th[] = { * 腕力による命中修正テーブル * Stat Table (STR) -- bonus to hit (plus 128) */ -const byte adj_str_th[] = { +extern const byte adj_str_th[] = { 128 + -3 /* 3 */, 128 + -2 /* 4 */, 128 + -1 /* 5 */, 128 + -1 /* 6 */, 128 + 0 /* 7 */, 128 + 0 /* 8 */, 128 + 0 /* 9 */, 128 + 0 /* 10 */, 128 + 0 /* 11 */, 128 + 0 /* 12 */, 128 + 0 /* 13 */, 128 + 0 /* 14 */, 128 + 0 /* 15 */, 128 + 0 /* 16 */, 128 + 0 /* 17 */, 128 + 1 /* 18/00-18/09 */, 128 + 1 /* 18/10-18/19 */, 128 + 1 /* 18/20-18/29 */, 128 + 1 /* 18/30-18/39 */, 128 + 1 /* 18/40-18/49 */, 128 + 1 /* 18/50-18/59 */, @@ -211,7 +211,7 @@ const byte adj_str_th[] = { * 腕力による基本所持重量値テーブル * Stat Table (STR) -- weight limit in deca-pounds */ -const byte adj_str_wgt[] = { +extern const byte adj_str_wgt[] = { 10 /* 3 */, 11 /* 4 */, 12 /* 5 */, 13 /* 6 */, 14 /* 7 */, 15 /* 8 */, 16 /* 9 */, 17 /* 10 */, 18 /* 11 */, 19 /* 12 */, 20 /* 13 */, 21 /* 14 */, 22 /* 15 */, 23 /* 16 */, 24 /* 17 */, 25 /* 18/00-18/09 */, 26 /* 18/10-18/19 */, 27 /* 18/20-18/29 */, 28 /* 18/30-18/39 */, 29 /* 18/40-18/49 */, 30 /* 18/50-18/59 */, 31 /* 18/60-18/69 */, 31 /* 18/70-18/79 */, 32 /* 18/80-18/89 */, 32 /* 18/90-18/99 */, 33 /* 18/100-18/109 */, @@ -223,7 +223,7 @@ const byte adj_str_wgt[] = { * 腕力による武器重量限界値テーブル * Stat Table (STR) -- weapon weight limit in pounds */ -const byte adj_str_hold[] = { +extern const byte adj_str_hold[] = { 4 /* 3 */, 5 /* 4 */, 6 /* 5 */, 7 /* 6 */, 8 /* 7 */, 9 /* 8 */, 10 /* 9 */, 11 /* 10 */, 12 /* 11 */, 13 /* 12 */, 14 /* 13 */, 15 /* 14 */, 16 /* 15 */, 17 /* 16 */, 18 /* 17 */, 19 /* 18/00-18/09 */, 20 /* 18/10-18/19 */, 21 /* 18/20-18/29 */, 22 /* 18/30-18/39 */, 23 /* 18/40-18/49 */, 24 /* 18/50-18/59 */, 25 /* 18/60-18/69 */, 26 /* 18/70-18/79 */, 27 /* 18/80-18/89 */, 28 /* 18/90-18/99 */, 30 /* 18/100-18/109 */, @@ -235,7 +235,7 @@ const byte adj_str_hold[] = { * 腕力による採掘能力修正値テーブル * Stat Table (STR) -- digging value */ -const byte adj_str_dig[] = { +extern const byte adj_str_dig[] = { 0 /* 3 */, 0 /* 4 */, 1 /* 5 */, 2 /* 6 */, 3 /* 7 */, 4 /* 8 */, 4 /* 9 */, 5 /* 10 */, 5 /* 11 */, 6 /* 12 */, 6 /* 13 */, 7 /* 14 */, 7 /* 15 */, 8 /* 16 */, 8 /* 17 */, 9 /* 18/00-18/09 */, 10 /* 18/10-18/19 */, 12 /* 18/20-18/29 */, 15 /* 18/30-18/39 */, 20 /* 18/40-18/49 */, 25 /* 18/50-18/59 */, 30 /* 18/60-18/69 */, 35 /* 18/70-18/79 */, 40 /* 18/80-18/89 */, 45 /* 18/90-18/99 */, 50 /* 18/100-18/109 */, 55 /* 18/110-18/119 */, @@ -247,7 +247,7 @@ const byte adj_str_dig[] = { * 器用さによる盗難防止&体当たり成功判定修正テーブル * Stat Table (DEX) -- chance of avoiding "theft" and "falling" */ -const byte adj_dex_safe[] = { +extern const byte adj_dex_safe[] = { 0 /* 3 */, 1 /* 4 */, 2 /* 5 */, 3 /* 6 */, 4 /* 7 */, 5 /* 8 */, 5 /* 9 */, 6 /* 10 */, 6 /* 11 */, 7 /* 12 */, 7 /* 13 */, 8 /* 14 */, 8 /* 15 */, 9 /* 16 */, 9 /* 17 */, 10 /* 18/00-18/09 */, 10 /* 18/10-18/19 */, 15 /* 18/20-18/29 */, 15 /* 18/30-18/39 */, 20 /* 18/40-18/49 */, 25 /* 18/50-18/59 */, 30 /* 18/60-18/69 */, 35 /* 18/70-18/79 */, 40 /* 18/80-18/89 */, 45 /* 18/90-18/99 */, 50 /* 18/100-18/109 */, 60 /* 18/110-18/119 */, @@ -259,7 +259,7 @@ const byte adj_dex_safe[] = { * 耐久による基本HP自然治癒値テーブル / * Stat Table (CON) -- base regeneration rate */ -const byte adj_con_fix[] = { +extern const byte adj_con_fix[] = { 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, 0 /* 7 */, 0 /* 8 */, 0 /* 9 */, 0 /* 10 */, 0 /* 11 */, 0 /* 12 */, 0 /* 13 */, 1 /* 14 */, 1 /* 15 */, 1 /* 16 */, 1 /* 17 */, 2 /* 18/00-18/09 */, 2 /* 18/10-18/19 */, 2 /* 18/20-18/29 */, 2 /* 18/30-18/39 */, 2 /* 18/40-18/49 */, 3 /* 18/50-18/59 */, 3 /* 18/60-18/69 */, 3 /* 18/70-18/79 */, 3 /* 18/80-18/89 */, 3 /* 18/90-18/99 */, 4 /* 18/100-18/109 */, 4 /* 18/110-18/119 */, 5 /* 18/120-18/129 */, @@ -271,7 +271,7 @@ const byte adj_con_fix[] = { * 耐久による基本HP自然治癒値テーブル / * Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128) */ -const byte adj_con_mhp[] = { +extern const byte adj_con_mhp[] = { 128 + -8 /* 3 */, 128 + -6 /* 4 */, 128 + -4 /* 5 */, 128 + -2 /* 6 */, 128 + -1 /* 7 */, 128 + 0 /* 8 */, 128 + 0 /* 9 */, 128 + 0 /* 10 */, 128 + 0 /* 11 */, 128 + 0 /* 12 */, 128 + 0 /* 13 */, 128 + 1 /* 14 */, 128 + 1 /* 15 */, 128 + 2 /* 16 */, 128 + 3 /* 17 */, 128 + 4 /* 18/00-18/09 */, 128 + 5 /* 18/10-18/19 */, 128 + 6 /* 18/20-18/29 */, 128 + 7 /* 18/30-18/39 */, 128 + 8 /* 18/40-18/49 */, 128 + 9 /* 18/50-18/59 */, @@ -285,7 +285,7 @@ const byte adj_con_mhp[] = { * 魅力による魅了能力修正テーブル / * Stat Table (CHR) -- charm */ -const byte adj_chr_chm[] = { +extern const byte adj_chr_chm[] = { 0 /* 3 */, 0 /* 4 */, 1 /* 5 */, 2 /* 6 */, 3 /* 7 */, 4 /* 8 */, 4 /* 9 */, 5 /* 10 */, 5 /* 11 */, 6 /* 12 */, 6 /* 13 */, 7 /* 14 */, 7 /* 15 */, 8 /* 16 */, 8 /* 17 */, 9 /* 18/00-18/09 */, 10 /* 18/10-18/19 */, 12 /* 18/20-18/29 */, 15 /* 18/30-18/39 */, 18 /* 18/40-18/49 */, 21 /* 18/50-18/59 */, 24 /* 18/60-18/69 */, 28 /* 18/70-18/79 */, 32 /* 18/80-18/89 */, 36 /* 18/90-18/99 */, 39 /* 18/100-18/109 */, 42 /* 18/110-18/119 */, diff --git a/src/player/player-status.c b/src/player/player-status.c index 3ed16825d..520fb3144 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -289,7 +289,7 @@ WEIGHT calc_inventory_weight(player_type *creature_ptr) WEIGHT weight = 0; object_type *o_ptr; - for (inventory_slot_type i = 0; i < INVEN_TOTAL; i++) { + for (int i = 0; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -1113,7 +1113,7 @@ s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr) int extra_shots = 0; BIT_FLAGS flgs[TR_FLAG_SIZE]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *q_ptr; q_ptr = &creature_ptr->inventory_list[i]; if (!q_ptr->k_idx) @@ -1138,7 +1138,7 @@ s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr) num = 100; num += (extra_shots * 100); - tval_type tval_ammo = bow_tval_ammo(o_ptr); + tval_type tval_ammo = static_cast(bow_tval_ammo(o_ptr)); if ((creature_ptr->pclass == CLASS_RANGER) && (tval_ammo == TV_ARROW)) { num += (creature_ptr->lev * 4); } @@ -1195,7 +1195,7 @@ static ACTION_SKILL_POWER calc_intra_vision(player_type *creature_ptr) pow += 3; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -1294,7 +1294,7 @@ static ACTION_SKILL_POWER calc_player_stealth_by_equipment(player_type *creature { ACTION_SKILL_POWER result = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -1471,7 +1471,7 @@ static ACTION_SKILL_POWER calc_device_ability(player_type *creature_ptr) pow = tmp_rp_ptr->r_dev + c_ptr->c_dev + a_ptr->a_dev; pow += ((c_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50)); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -1569,7 +1569,7 @@ static ACTION_SKILL_POWER calc_search(player_type *creature_ptr) pow = tmp_rp_ptr->r_srh + c_ptr->c_srh + a_ptr->a_srh; pow += (c_ptr->x_srh * creature_ptr->lev / 10); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -1617,7 +1617,7 @@ static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr) pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos; pow += (c_ptr->x_fos * creature_ptr->lev / 10); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -1751,7 +1751,7 @@ static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr) if (creature_ptr->pclass == CLASS_BERSERKER) pow += (100 + creature_ptr->lev * 8); - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -1952,7 +1952,7 @@ static s16b calc_strength_addition(player_type *creature_ptr) pow++; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2026,7 +2026,7 @@ s16b calc_intelligence_addition(player_type *creature_ptr) const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku]; pow = tmp_rp_ptr->r_adj[A_INT] + c_ptr->c_adj[A_INT] + a_ptr->a_adj[A_INT]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2088,7 +2088,7 @@ static s16b calc_wisdom_addition(player_type *creature_ptr) const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku]; pow = tmp_rp_ptr->r_adj[A_WIS] + c_ptr->c_adj[A_WIS] + a_ptr->a_adj[A_WIS]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2161,7 +2161,7 @@ static s16b calc_dexterity_addition(player_type *creature_ptr) pow--; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2246,7 +2246,7 @@ static s16b calc_constitution_addition(player_type *creature_ptr) pow++; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2328,7 +2328,7 @@ static s16b calc_charisma_addition(player_type *creature_ptr) const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku]; pow = tmp_rp_ptr->r_adj[A_CHR] + c_ptr->c_adj[A_CHR] + a_ptr->a_adj[A_CHR]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2391,7 +2391,7 @@ static s16b calc_to_magic_chance(player_type *creature_ptr) if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN) chance += 5; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &creature_ptr->inventory_list[i]; @@ -2415,7 +2415,7 @@ static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr) if (creature_ptr->yoiyami) return 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) @@ -2460,7 +2460,7 @@ static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_real_value) ac -= 50; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; object_flags(creature_ptr, o_ptr, flags); @@ -2539,7 +2539,7 @@ static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_real_value) ac += 30; } - for (inventory_slot_type i = INVEN_MAIN_HAND; i <= INVEN_FEET; i++) { + for (int i = INVEN_MAIN_HAND; i <= INVEN_FEET; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -2662,7 +2662,7 @@ static SPEED calc_speed_by_secial_weapon_set(player_type *creature_ptr) static SPEED calc_player_speed_by_equipment(player_type *creature_ptr) { SPEED result = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; BIT_FLAGS flgs[TR_FLAG_SIZE]; object_flags(creature_ptr, o_ptr, flgs); @@ -3290,7 +3290,7 @@ static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool i } } - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { int bonus_to_d = 0; o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_MAIN_HAND && has_melee_weapon(creature_ptr, i)) @@ -3440,7 +3440,7 @@ static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_r BIT_FLAGS flgs[TR_FLAG_SIZE]; object_flags(creature_ptr, o_ptr, flgs); - tval_type tval = o_ptr->tval - TV_WEAPON_BEGIN; + int tval = o_ptr->tval - TV_WEAPON_BEGIN; OBJECT_SUBTYPE_VALUE sval = o_ptr->sval; /* Traind bonuses */ @@ -3519,7 +3519,7 @@ static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_r } /* Bonuses from inventory */ - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; /* Ignore empty hands, handed weapons, bows and capture balls */ @@ -3658,7 +3658,7 @@ static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_real_value) } // 武器以外の装備による修正 - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { int bonus_to_h; o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_MAIN_HAND && has_melee_weapon(creature_ptr, i)) @@ -3688,7 +3688,7 @@ static s16b calc_to_damage_misc(player_type *creature_ptr) s16b to_dam = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -3724,7 +3724,7 @@ static s16b calc_to_hit_misc(player_type *creature_ptr) s16b to_hit = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; @@ -4467,5 +4467,5 @@ static player_hand main_attack_hand(player_type *creature_ptr) case MELEE_TYPE_SHIELD_DOUBLE: return PLAYER_HAND_MAIN; } - return 0; + return PLAYER_HAND_MAIN; } diff --git a/src/player/player-status.h b/src/player/player-status.h index d11351257..27f826e10 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -52,7 +52,11 @@ enum empty_hand_status { }; /*!< Weapon hand status */ -typedef enum player_hand { PLAYER_HAND_MAIN = 0x0000, PLAYER_HAND_SUB = 0x0001, PLAYER_HAND_OTHER = 0x0002 } player_hand; +enum player_hand { + PLAYER_HAND_MAIN = 0x0000, + PLAYER_HAND_SUB = 0x0001, + PLAYER_HAND_OTHER = 0x0002 +}; /* * Player sex constants (hard-coded by save-files, arrays, etc) @@ -479,7 +483,6 @@ extern WEIGHT calc_inventory_weight(player_type *creature_ptr); extern s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr); BIT_FLAGS player_flags_speed(player_type *creature_ptr); BIT_FLAGS player_flags_stealth(player_type *creature_ptr); -static void update_bonuses(player_type *creature_ptr); extern WEIGHT calc_weight_limit(player_type *creature_ptr); extern bool has_melee_weapon(player_type *creature_ptr, int i); diff --git a/src/player/process-death.c b/src/player/process-death.c index 1d7bedc6d..10123f9f5 100644 --- a/src/player/process-death.c +++ b/src/player/process-death.c @@ -296,7 +296,7 @@ static bool show_dead_player_items(player_type *creature_ptr) { if (creature_ptr->equip_cnt) { term_clear(); - (void)show_equipment(creature_ptr, 0, USE_FULL, 0); + (void)show_equipment(creature_ptr, 0, USE_FULL, TV_NONE); prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0); if (inkey() == ESCAPE) return TRUE; @@ -304,7 +304,7 @@ static bool show_dead_player_items(player_type *creature_ptr) if (creature_ptr->inven_cnt) { term_clear(); - (void)show_inventory(creature_ptr, 0, USE_FULL, 0); + (void)show_inventory(creature_ptr, 0, USE_FULL, TV_NONE); prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0); if (inkey() == ESCAPE) @@ -424,4 +424,4 @@ void show_death_info(player_type *creature_ptr, update_playtime_pf update_playti return; show_dead_home_items(creature_ptr); -} \ No newline at end of file +} diff --git a/src/player/race-resistances.c b/src/player/race-resistances.c index c1145687e..6d50bc662 100644 --- a/src/player/race-resistances.c +++ b/src/player/race-resistances.c @@ -71,7 +71,7 @@ void known_obj_immunity(player_type *creature_ptr, BIT_FLAGS *flags) for (int i = 0; i < TR_FLAG_SIZE; i++) flags[i] = 0L; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { u32b o_flags[TR_FLAG_SIZE]; object_type *o_ptr; diff --git a/src/player/special-defense-types.h b/src/player/special-defense-types.h index 6582d8f18..eca9ca906 100644 --- a/src/player/special-defense-types.h +++ b/src/player/special-defense-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum special_defence { +enum special_defence { DEFENSE_ACID = 0x00000001, /*!< プレイヤーのステータス:酸免疫 */ DEFENSE_ELEC = 0x00000002, /*!< プレイヤーのステータス:電撃免疫 */ DEFENSE_FIRE = 0x00000004, /*!< プレイヤーのステータス:火炎免疫 */ @@ -16,7 +16,7 @@ typedef enum special_defence { KATA_MUSOU = 0x00001000, /*!< プレイヤーのステータス:無想 */ NINJA_KAWARIMI = 0x00002000, /*!< プレイヤーのステータス:変わり身 */ NINJA_S_STEALTH = 0x00004000, /*!< プレイヤーのステータス:超隠密 */ -} special_defence; +}; #define MAX_KAMAE 4 /*!< 修行僧の構え最大数 */ #define KAMAE_MASK (KAMAE_GENBU | KAMAE_BYAKKO | KAMAE_SEIRYU | KAMAE_SUZAKU) /*!< 修行僧の構えビット配列 */ diff --git a/src/player/temporary-resistances.c b/src/player/temporary-resistances.c index 0be222218..4ad75a497 100644 --- a/src/player/temporary-resistances.c +++ b/src/player/temporary-resistances.c @@ -42,8 +42,8 @@ void tim_player_flags(player_type *creature_ptr, BIT_FLAGS *flags) if (is_oppose_pois(creature_ptr)) add_flag(flags, TR_RES_POIS); - for (tr_type test_flag = 0; test_flag < TR_FLAG_MAX; test_flag++) { - if (any_bits(get_player_flags(creature_ptr, test_flag), tmp_effect_flag)) + for (int test_flag = 0; test_flag < TR_FLAG_MAX; test_flag++) { + if (any_bits(get_player_flags(creature_ptr, static_cast(test_flag)), tmp_effect_flag)) add_flag(flags, test_flag); } } diff --git a/src/racial/racial-android.c b/src/racial/racial-android.c index 5ed4eeeb1..1ce996416 100644 --- a/src/racial/racial-android.c +++ b/src/racial/racial-android.c @@ -59,7 +59,7 @@ void calc_android_exp(player_type *creature_ptr) if (creature_ptr->is_dead || (creature_ptr->prace != RACE_ANDROID)) return; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; object_type forge; object_type *q_ptr = &forge; diff --git a/src/racial/racial-switcher.c b/src/racial/racial-switcher.c index e158a103f..9a15128e7 100644 --- a/src/racial/racial-switcher.c +++ b/src/racial/racial-switcher.c @@ -164,7 +164,7 @@ bool switch_class_racial_execution(player_type *creature_ptr, const s32b command return TRUE; } - return (command != -4) || identify_fully(creature_ptr, FALSE, 0); + return (command != -4) || identify_fully(creature_ptr, FALSE, TV_NONE); case CLASS_IMITATOR: handle_stuff(creature_ptr); return do_cmd_mane(creature_ptr, TRUE); @@ -235,9 +235,9 @@ bool switch_class_racial_execution(player_type *creature_ptr, const s32b command return recall_player(creature_ptr, randint0(21) + 15); case CLASS_SMITH: if (creature_ptr->lev <= 29) - return ident_spell(creature_ptr, TRUE, 0); + return ident_spell(creature_ptr, TRUE, TV_NONE); - return identify_fully(creature_ptr, TRUE, 0); + return identify_fully(creature_ptr, TRUE, TV_NONE); case CLASS_MIRROR_MASTER: if (command == -3) { remove_all_mirrors(creature_ptr, TRUE); diff --git a/src/realm/realm-arcane.c b/src/realm/realm-arcane.c index b27e26663..7c9893416 100644 --- a/src/realm/realm-arcane.c +++ b/src/realm/realm-arcane.c @@ -407,7 +407,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mod { if (cast) { - if (!ident_spell(caster_ptr, FALSE, 0)) + if (!ident_spell(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-craft.c b/src/realm/realm-craft.c index 59743d926..4dde4c09e 100644 --- a/src/realm/realm-craft.c +++ b/src/realm/realm-craft.c @@ -494,7 +494,7 @@ concptr do_craft_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast) { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-death.c b/src/realm/realm-death.c index 93841c9e0..0b8ac2528 100644 --- a/src/realm/realm-death.c +++ b/src/realm/realm-death.c @@ -613,10 +613,10 @@ concptr do_death_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast) { if (randint1(50) > plev) { - if (!ident_spell(caster_ptr, FALSE, 0)) + if (!ident_spell(caster_ptr, FALSE, TV_NONE)) return NULL; } else { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-hex-numbers.h b/src/realm/realm-hex-numbers.h index 4fac5e5ad..4bddbe8c1 100644 --- a/src/realm/realm-hex-numbers.h +++ b/src/realm/realm-hex-numbers.h @@ -1,6 +1,6 @@ #pragma once -typedef enum realm_hex_type { +enum realm_hex_type { /* 1st book */ HEX_BLESS = 0, HEX_CURE_LIGHT = 1, @@ -37,4 +37,4 @@ typedef enum realm_hex_type { HEX_SHADOW_MOVE = 29, HEX_ANTI_MAGIC = 30, HEX_REVENGE = 31, -} realm_hex_type; +}; diff --git a/src/realm/realm-hex.c b/src/realm/realm-hex.c index a50e05edf..a808c5259 100644 --- a/src/realm/realm-hex.c +++ b/src/realm/realm-hex.c @@ -189,7 +189,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) q = _("どれを呪いますか?", "Which weapon do you curse?"); s = _("武器を装備していない。", "You're not wielding a weapon."); - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), TV_NONE); if (!o_ptr) return FALSE; @@ -496,7 +496,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) q = _("どれを呪いますか?", "Which piece of armour do you curse?"); s = _("防具を装備していない。", "You're not wearing any armor."); - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), TV_NONE); if (!o_ptr) return FALSE; @@ -697,7 +697,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) q = _("どの装備品から吸収しますか?", "Which cursed equipment do you drain mana from?"); s = _("呪われたアイテムを装備していない。", "You have no cursed equipment."); - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/realm/realm-hissatsu.c b/src/realm/realm-hissatsu.c index b552f49df..b606450f0 100644 --- a/src/realm/realm-hissatsu.c +++ b/src/realm/realm-hissatsu.c @@ -107,21 +107,21 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m y = caster_ptr->y + ddy_cdd[cdir]; x = caster_ptr->x + ddx_cdd[cdir]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = caster_ptr->y + ddy_cdd[(cdir + 7) % 8]; x = caster_ptr->x + ddx_cdd[(cdir + 7) % 8]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = caster_ptr->y + ddy_cdd[(cdir + 1) % 8]; x = caster_ptr->x + ddx_cdd[(cdir + 1) % 8]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); } @@ -248,7 +248,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m return NULL; } - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat)) @@ -336,7 +336,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m x = caster_ptr->x + ddx[dir]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; @@ -390,10 +390,10 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m if (cast) { if (plev > 44) { - if (!identify_fully(caster_ptr, TRUE, 0)) + if (!identify_fully(caster_ptr, TRUE, TV_NONE)) return NULL; } else { - if (!ident_spell(caster_ptr, TRUE, 0)) + if (!ident_spell(caster_ptr, TRUE, TV_NONE)) return NULL; } } @@ -894,10 +894,10 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type m x = caster_ptr->x + ddx[dir]; if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) { - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) { handle_stuff(caster_ptr); - do_cmd_attack(caster_ptr, y, x, 0); + do_cmd_attack(caster_ptr, y, x, HISSATSU_NONE); } } else { msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction")); diff --git a/src/realm/realm-life.c b/src/realm/realm-life.c index 9cfcf5d08..cd0c19d58 100644 --- a/src/realm/realm-life.c +++ b/src/realm/realm-life.c @@ -316,7 +316,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) { if (cast) { - if (!ident_spell(caster_ptr, FALSE, 0)) + if (!ident_spell(caster_ptr, FALSE, TV_NONE)) return NULL; } } @@ -542,7 +542,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode) { if (cast) { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-nature.c b/src/realm/realm-nature.c index 26ad0b2e4..ffa76db67 100644 --- a/src/realm/realm-nature.c +++ b/src/realm/realm-nature.c @@ -477,7 +477,7 @@ concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mod { if (cast) { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-song-numbers.h b/src/realm/realm-song-numbers.h index 76b77d19e..cba4e9138 100644 --- a/src/realm/realm-song-numbers.h +++ b/src/realm/realm-song-numbers.h @@ -1,6 +1,6 @@ #pragma once -typedef enum realm_song_type { +enum realm_song_type { MUSIC_NONE = 0, MUSIC_SLOW = 1, MUSIC_BLESS = 2, @@ -25,6 +25,6 @@ typedef enum realm_song_type { MUSIC_H_LIFE = 21, MUSIC_INVULN = 22, MUSIC_PSI = 23, -} realm_song_type; +}; #define MUSIC_DETECT 101 diff --git a/src/realm/realm-sorcery.c b/src/realm/realm-sorcery.c index 2628fcf6a..1872b5467 100644 --- a/src/realm/realm-sorcery.c +++ b/src/realm/realm-sorcery.c @@ -223,7 +223,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mo { if (cast) { - if (!ident_spell(caster_ptr, FALSE, 0)) + if (!ident_spell(caster_ptr, FALSE, TV_NONE)) return NULL; } } @@ -335,7 +335,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mo { if (cast) { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } diff --git a/src/realm/realm-trump.c b/src/realm/realm-trump.c index 29c8dfd95..7ea0a8675 100644 --- a/src/realm/realm-trump.c +++ b/src/realm/realm-trump.c @@ -178,7 +178,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast || fail) { - int type = (!fail ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL); + summon_type type = (!fail ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL); msg_print(_("あなたは動物のカードに集中する...", "You concentrate on the trump of an animal...")); if (trump_summoning(caster_ptr, 1, !fail, caster_ptr->y, caster_ptr->x, 0, type, 0L)) { if (fail) { @@ -219,7 +219,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast || fail) { POSITION x, y; - int type; + summon_type type; if (cast) { if (!target_set(caster_ptr, TARGET_KILL)) @@ -436,12 +436,12 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast || fail) { - int type; + summon_type type; msg_print(_("あなたはモンスターのカードに集中する...", "You concentrate on several trumps at once...")); if (caster_ptr->pclass == CLASS_BEASTMASTER) type = SUMMON_LIVING; else - type = 0; + type = SUMMON_NONE; if (trump_summoning(caster_ptr, (1 + (plev - 15) / 10), !fail, caster_ptr->y, caster_ptr->x, 0, type, 0L)) { if (fail) { @@ -538,7 +538,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast) { - if (!identify_fully(caster_ptr, FALSE, 0)) + if (!identify_fully(caster_ptr, FALSE, TV_NONE)) return NULL; } } @@ -658,7 +658,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode { if (cast) { - int type; + summon_type type; if (caster_ptr->pclass == CLASS_BEASTMASTER) type = SUMMON_HI_DRAGON_LIVING; diff --git a/src/realm/realm-types.h b/src/realm/realm-types.h index 51c20fbe7..54a6c19a1 100644 --- a/src/realm/realm-types.h +++ b/src/realm/realm-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum magic_realm_type { +enum magic_realm_type { REALM_NONE = 0, REALM_LIFE = 1, REALM_SORCERY = 2, @@ -18,4 +18,4 @@ typedef enum magic_realm_type { REALM_HISSATSU = 17, REALM_HEX = 18, MAX_REALM = 18, -} magic_realm_type; +}; diff --git a/src/room/lake-types.h b/src/room/lake-types.h index f9b512739..6a8f10f7e 100644 --- a/src/room/lake-types.h +++ b/src/room/lake-types.h @@ -1,7 +1,7 @@ #pragma once /* 池型地形の生成ID / Room types for generate_lake() */ -typedef enum lake_type { +enum lake_type { LAKE_T_LAVA = 1, /*!< 池型地形ID: 溶岩 */ LAKE_T_WATER = 2, /*!< 池型地形ID: 池 */ LAKE_T_CAVE = 3, /*!< 池型地形ID: 空洞 */ @@ -9,4 +9,4 @@ typedef enum lake_type { LAKE_T_AIR_VAULT = 5, /*!< 池型地形ID: 風属性VAULT */ LAKE_T_WATER_VAULT = 6, /*!< 池型地形ID: 水属性VAULT */ LAKE_T_FIRE_VAULT = 7, /*!< 池型地形ID: 火属性VAULT */ -} lake_type; +}; diff --git a/src/room/room-types.h b/src/room/room-types.h index d29f3a9fd..8a067e82c 100644 --- a/src/room/room-types.h +++ b/src/room/room-types.h @@ -1,7 +1,7 @@ #pragma once /* 部屋型ID / Room types for room_build() */ -typedef enum room_type { +enum room_type { ROOM_T_NORMAL = 0, /*!<部屋型ID:基本長方形 / Simple (33x11) */ ROOM_T_OVERLAP = 1, /*!<部屋型ID:長方形二つ重ね / Overlapping (33x11) */ ROOM_T_CROSS = 2, /*!<部屋型ID:十字 / Crossed (33x11) */ @@ -20,4 +20,4 @@ typedef enum room_type { ROOM_T_ARCADE = 15, /*!<部屋型ID:商店 / Arcade */ ROOM_T_FIXED = 16, /*!<部屋型ID:固定部屋 / Fixed room */ ROOM_T_MAX = 17, /*!<部屋型ID最大数 */ -} room_type; +}; diff --git a/src/save/save.h b/src/save/save.h index 9f5efa527..22e433fa4 100644 --- a/src/save/save.h +++ b/src/save/save.h @@ -3,10 +3,10 @@ #include "floor/floor-save.h" #include "system/angband.h" -typedef enum save_type { +enum save_type { SAVE_TYPE_CLOSE_GAME = 0, SAVE_TYPE_CONTINUE_GAME = 1, SAVE_TYPE_DEBUG = 2 -}save_type; +}; bool save_player(player_type *player_ptr, save_type type); diff --git a/src/specific-object/chest.c b/src/specific-object/chest.c index 96574d679..895b660a7 100644 --- a/src/specific-object/chest.c +++ b/src/specific-object/chest.c @@ -213,7 +213,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id if (randint1(100)current_floor_ptr->dun_level) activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE); else - (void)summon_specific(target_ptr, 0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(target_ptr, 0, y, x, mon_level, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } } @@ -349,4 +349,3 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id o_ptr->pval = 0; } } - diff --git a/src/specific-object/torch.c b/src/specific-object/torch.c index 893538ac1..1360dbddb 100644 --- a/src/specific-object/torch.c +++ b/src/specific-object/torch.c @@ -72,7 +72,7 @@ void torch_lost_fuel(object_type *o_ptr) void update_lite_radius(player_type *creature_ptr) { creature_ptr->cur_lite = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; BIT_FLAGS flgs[TR_FLAG_SIZE]; diff --git a/src/spell-kind/blood-curse.c b/src/spell-kind/blood-curse.c index 0d973899c..8bc628ec8 100644 --- a/src/spell-kind/blood-curse.c +++ b/src/spell-kind/blood-curse.c @@ -95,7 +95,7 @@ void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx) mode |= (PM_NO_PET | PM_FORCE_FRIENDLY); count += summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, - (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level), 0, mode); + (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level), SUMMON_NONE, mode); if (!one_in_(6)) break; } diff --git a/src/spell-kind/magic-item-recharger.c b/src/spell-kind/magic-item-recharger.c index 60b89dae0..a0d08913e 100644 --- a/src/spell-kind/magic-item-recharger.c +++ b/src/spell-kind/magic-item-recharger.c @@ -54,7 +54,7 @@ bool recharge(player_type *caster_ptr, int power) OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/spell-kind/spells-curse-removal.c b/src/spell-kind/spells-curse-removal.c index cec7a79bc..f6d94c8a3 100644 --- a/src/spell-kind/spells-curse-removal.c +++ b/src/spell-kind/spells-curse-removal.c @@ -19,7 +19,7 @@ static int exe_curse_removal(player_type *creature_ptr, int all) { int cnt = 0; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr = &creature_ptr->inventory_list[i]; if (!o_ptr->k_idx) continue; diff --git a/src/spell-kind/spells-enchant.c b/src/spell-kind/spells-enchant.c index fcf9f6f53..fb99d1c8c 100644 --- a/src/spell-kind/spells-enchant.c +++ b/src/spell-kind/spells-enchant.c @@ -31,7 +31,7 @@ bool artifact_scroll(player_type *caster_ptr) concptr s = _("強化できるアイテムがない。", "You have nothing to enchant."); object_type *o_ptr; OBJECT_IDX item; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; @@ -128,7 +128,7 @@ bool mundane_spell(player_type *owner_ptr, bool only_equip) concptr q = _("どれを使いますか?", "Use which item? "); concptr s = _("使えるものがありません。", "You have nothing you can use."); - o_ptr = choose_object(owner_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(owner_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/spell-kind/spells-perception.c b/src/spell-kind/spells-perception.c index e3f5954fc..36c66d509 100644 --- a/src/spell-kind/spells-perception.c +++ b/src/spell-kind/spells-perception.c @@ -119,7 +119,7 @@ bool ident_spell(player_type *caster_ptr, bool only_equip, tval_type item_tester concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; @@ -172,7 +172,7 @@ bool identify_fully(player_type *caster_ptr, bool only_equip, tval_type item_tes OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/spell-kind/spells-random.c b/src/spell-kind/spells-random.c index 8ec9d3303..7f43c3839 100644 --- a/src/spell-kind/spells-random.c +++ b/src/spell-kind/spells-random.c @@ -159,7 +159,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count) case 8: case 9: case 18: - (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); if (!one_in_(6)) break; /* Fall through */ @@ -315,7 +315,7 @@ void wild_magic(player_type *caster_ptr, int spell) case 34: case 35: for (int counter = 0; counter < 8; counter++) { - (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, static_cast(type), (PM_ALLOW_GROUP | PM_NO_PET)); } break; diff --git a/src/spell-kind/spells-teleport.c b/src/spell-kind/spells-teleport.c index 4e5b75650..8b4dc575d 100644 --- a/src/spell-kind/spells-teleport.c +++ b/src/spell-kind/spells-teleport.c @@ -371,7 +371,7 @@ bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantu */ void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode) { - if (!teleport_player_aux(creature_ptr, dis, FALSE, mode)) + if (!teleport_player_aux(creature_ptr, dis, FALSE, static_cast(mode))) return; /* Monsters with teleport ability may follow the player */ diff --git a/src/spell-realm/spells-nature.c b/src/spell-realm/spells-nature.c index 2030d3b5d..6332bc98e 100644 --- a/src/spell-realm/spells-nature.c +++ b/src/spell-realm/spells-nature.c @@ -22,7 +22,7 @@ bool rustproof(player_type *caster_ptr) concptr q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? "); concptr s = _("錆止めできるものがありません。", "You have nothing to rustproof."); OBJECT_IDX item; - object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0); + object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, TV_NONE); if (o_ptr == NULL) return FALSE; diff --git a/src/spell-realm/spells-sorcery.c b/src/spell-realm/spells-sorcery.c index 2bdf9e45e..a3c34c8e1 100644 --- a/src/spell-realm/spells-sorcery.c +++ b/src/spell-realm/spells-sorcery.c @@ -29,7 +29,7 @@ bool alchemy(player_type *caster_ptr) concptr s = _("金に変えられる物がありません。", "You have nothing to turn to gold."); OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return FALSE; diff --git a/src/spell-realm/spells-trump.c b/src/spell-realm/spells-trump.c index 9cd00e83a..b848a7d61 100644 --- a/src/spell-realm/spells-trump.c +++ b/src/spell-realm/spells-trump.c @@ -95,7 +95,7 @@ void cast_shuffle(player_type *caster_ptr) if (die < 30) { msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster.")); trump_summoning( - caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); + caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), static_cast(SUMMON_UNIQUE + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); return; } @@ -195,7 +195,7 @@ void cast_shuffle(player_type *caster_ptr) if (die < 111) { msg_print(_("《審判》だ。", "It's Judgement.")); - roll_hitdice(caster_ptr, 0L); + roll_hitdice(caster_ptr, SPOP_NONE); lose_all_mutations(caster_ptr); return; } diff --git a/src/spell/spell-types.h b/src/spell/spell-types.h index 8d2de85d3..ee26bbe4b 100644 --- a/src/spell/spell-types.h +++ b/src/spell/spell-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum spells_type +enum spells_type { GF_NONE = 0, GF_ELEC = 1, /*!< 魔法効果: 電撃*/ @@ -103,4 +103,4 @@ typedef enum spells_type GF_STASIS_EVIL = 115, /*!< 魔法効果: 邪悪拘束*/ GF_WOUNDS = 116, /*!< 魔法効果: 創傷*/ MAX_GF = 117, /*!< 欠番を無視した最大サイズ (直上の値+1) */ -} spells_type; +}; diff --git a/src/spell/spells-object.c b/src/spell/spells-object.c index 133408825..054880b51 100644 --- a/src/spell/spells-object.c +++ b/src/spell/spells-object.c @@ -79,7 +79,7 @@ static amuse_type amuse_info[] { TV_SWORD, SV_BROKEN_DAGGER, 3, AMS_FIXED_ART }, // Broken Dagger of Magician { TV_SWORD, SV_BROKEN_DAGGER, 10, AMS_NOTHING }, { TV_SWORD, SV_BROKEN_SWORD, 5, AMS_NOTHING }, { TV_SCROLL, SV_SCROLL_AMUSEMENT, 10, AMS_NOTHING }, - { 0, 0, 0, 0 } }; + { TV_NONE, 0, 0, 0 } }; /*! * @brief 誰得ドロップを行う。 @@ -188,7 +188,7 @@ void acquirement(player_type *caster_ptr, POSITION y1, POSITION x1, int num, boo { object_type *i_ptr; object_type object_type_body; - BIT_FLAGS mode = AM_GOOD | (great || special ? AM_GREAT : 0L) | (special ? AM_SPECIAL : 0L); + BIT_FLAGS mode = AM_GOOD | (great || special ? AM_GREAT : AM_NONE) | (special ? AM_SPECIAL : AM_NONE); /* Acquirement */ while (num--) { @@ -362,7 +362,7 @@ void brand_bolts(player_type *caster_ptr) bool perilous_secrets(player_type *user_ptr) { - if (!ident_spell(user_ptr, FALSE, 0)) + if (!ident_spell(user_ptr, FALSE, TV_NONE)) return FALSE; if (mp_ptr->spell_book) { @@ -564,7 +564,7 @@ bool enchant_spell(player_type *caster_ptr, HIT_PROB num_hit, HIT_POINT num_dam, OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_NONE); if (!o_ptr) return FALSE; @@ -617,7 +617,7 @@ void brand_weapon(player_type *caster_ptr, int brand_type) OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | IGNORE_BOTHHAND_SLOT, 0); + o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | IGNORE_BOTHHAND_SLOT, TV_NONE); if (!o_ptr) return; diff --git a/src/spell/spells-summon.c b/src/spell/spells-summon.c index 50b85a626..f738e4bf7 100644 --- a/src/spell/spells-summon.c +++ b/src/spell/spells-summon.c @@ -44,7 +44,7 @@ * @param mode モンスター生成条件フラグ * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。 */ -bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode) +bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, summon_type type, BIT_FLAGS mode) { /* Default level */ PLAYER_LEVEL plev = caster_ptr->lev; @@ -120,7 +120,7 @@ bool cast_summon_demon(player_type *caster_ptr, int power) bool cast_summon_undead(player_type *creature_ptr, int power) { bool pet = one_in_(3); - int type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD); + summon_type type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD); BIT_FLAGS mode = 0L; if (!pet || ((creature_ptr->lev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP; @@ -227,7 +227,7 @@ bool cast_summon_greater_demon(player_type *caster_ptr) concptr s = _("捧げられる死体を持っていない。", "You have nothing to scrifice."); OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_NONE); if (!o_ptr) return FALSE; PLAYER_LEVEL plev = caster_ptr->lev; @@ -437,7 +437,7 @@ int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can default: if (!can_pet) mode |= PM_ALLOW_UNIQUE; - count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode); + count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), SUMMON_NONE, mode); } } diff --git a/src/spell/spells-summon.h b/src/spell/spells-summon.h index d49f6dc82..66c22eb58 100644 --- a/src/spell/spells-summon.h +++ b/src/spell/spells-summon.h @@ -2,7 +2,9 @@ #include "system/angband.h" -bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode); +enum summon_type : int; + +bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, summon_type type, BIT_FLAGS mode); bool cast_summon_demon(player_type *creature_ptr, int power); bool cast_summon_undead(player_type *creature_ptr, int power); bool cast_summon_hound(player_type *creature_ptr, int power); diff --git a/src/spell/spells-util.h b/src/spell/spells-util.h index c99b67087..6d391e1a1 100644 --- a/src/spell/spells-util.h +++ b/src/spell/spells-util.h @@ -5,22 +5,23 @@ #define DETECT_RAD_ALL 255 #define MAX_SPELLS 108 -typedef enum spell_type { SPELL_NAME = 0, SPELL_DESC = 1, SPELL_INFO = 2, SPELL_CAST = 3, SPELL_FAIL = 4, SPELL_STOP = 5, SPELL_CONT = 6 } spell_type; +enum spell_type { SPELL_NAME = 0, SPELL_DESC = 1, SPELL_INFO = 2, SPELL_CAST = 3, SPELL_FAIL = 4, SPELL_STOP = 5, SPELL_CONT = 6 }; -typedef enum spell_operation { - SPOP_DISPLAY_MES = 0x0001, // !< スペル処理オプション … メッセージを表示する - SPOP_NO_UPDATE = 0x0002, // !< スペル処理オプション … ステータス更新を解決後行う - SPOP_DEBUG = 0x8000 // !< スペル処理オプション … デバッグ処理あり -} spell_operation; +enum spell_operation : uint16_t { + SPOP_NONE = 0x0000U, + SPOP_DISPLAY_MES = 0x0001U, // !< スペル処理オプション … メッセージを表示する + SPOP_NO_UPDATE = 0x0002U, // !< スペル処理オプション … ステータス更新を解決後行う + SPOP_DEBUG = 0x8000U // !< スペル処理オプション … デバッグ処理あり +}; -typedef enum teleport_flags { +enum teleport_flags { TELEPORT_SPONTANEOUS = 0x0000, TELEPORT_NONMAGICAL = 0x0001, TELEPORT_PASSIVE = 0x0002, TELEPORT_DEC_VALOUR = 0x0004 -} teleport_flags; +}; -typedef enum autogenesis_magical_effect { +enum autogenesis_magical_effect { PROJECT_WHO_UNCTRL_POWER = -1, /*!< 魔法効果の自然発生要因: 名状し難い力の解放 */ PROJECT_WHO_GLASS_SHARDS = -2 /*!< 魔法効果の自然発生要因: 破壊されたガラス地形の破片 */ -} autogenesis_magical_effect; +}; diff --git a/src/spell/summon-types.h b/src/spell/summon-types.h index 3e2b77c93..c5433a747 100644 --- a/src/spell/summon-types.h +++ b/src/spell/summon-types.h @@ -1,7 +1,7 @@ #pragma once /* summon_specificで取り扱われる、召喚の種別定義 / Legal restrictions for "summon_specific()" */ -typedef enum summon_type { +enum summon_type : int { SUMMON_NONE = 0, SUMMON_ANT = 11, /*!< 召喚タイプ: アリ */ SUMMON_SPIDER = 12, /*!< 召喚タイプ: 蜘蛛 */ @@ -52,4 +52,4 @@ typedef enum summon_type { SUMMON_APOCRYPHA_FOLLOWERS = 68, /*!< 召喚タイプ: 信者 */ SUMMON_APOCRYPHA_DRAGONS = 69, /*!< 召喚タイプ: 強力な古代ドラゴン */ SUMMON_VESPOID = 70, /*!< 召喚タイプ: ランゴスタ */ -} summon_type; +}; diff --git a/src/status/shape-changer.c b/src/status/shape-changer.c index b2fb82ecd..73527328b 100644 --- a/src/status/shape-changer.c +++ b/src/status/shape-changer.c @@ -84,7 +84,7 @@ void change_race(player_type *creature_ptr, player_race_type new_race, concptr e else creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); check_experience(creature_ptr); creature_ptr->redraw |= (PR_BASIC); creature_ptr->update |= (PU_BONUS); @@ -177,7 +177,7 @@ void do_poly_self(player_type *creature_ptr) power -= 10; get_max_stats(creature_ptr); - roll_hitdice(creature_ptr, 0L); + roll_hitdice(creature_ptr, SPOP_NONE); } while ((power > randint0(15)) && one_in_(3)) { diff --git a/src/store/sell-order.c b/src/store/sell-order.c index d0cfe6ba0..c94d73d82 100644 --- a/src/store/sell-order.c +++ b/src/store/sell-order.c @@ -206,7 +206,7 @@ void store_sell(player_type *owner_ptr) OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(owner_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0); + o_ptr = choose_object(owner_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, TV_NONE); if (!o_ptr) return; diff --git a/src/sv-definition/sv-amulet-types.h b/src/sv-definition/sv-amulet-types.h index d26b0d6b7..4bf8d3b73 100644 --- a/src/sv-definition/sv-amulet-types.h +++ b/src/sv-definition/sv-amulet-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_AMULET */ -typedef enum sv_amulet_type { +enum sv_amulet_type { SV_AMULET_DOOM = 0, SV_AMULET_TELEPORT = 1, SV_AMULET_ADORNMENT = 2, @@ -27,4 +27,4 @@ typedef enum sv_amulet_type { SV_AMULET_WISDOM = 22, SV_AMULET_MAGIC_MASTERY = 23, SV_AMULET_NIGHT = 24, -} sv_amulet_type; +}; diff --git a/src/sv-definition/sv-armor-types.h b/src/sv-definition/sv-armor-types.h index b79a09183..9d34a2d1e 100644 --- a/src/sv-definition/sv-armor-types.h +++ b/src/sv-definition/sv-armor-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_SOFT_ARMOR */ -typedef enum sv_soft_armor_type { +enum sv_soft_armor_type { SV_T_SHIRT = 0, SV_FILTHY_RAG = 1, SV_ROBE = 2, @@ -20,10 +20,10 @@ typedef enum sv_soft_armor_type { SV_ABUNAI_MIZUGI = 50, SV_YOIYAMI_ROBE = 60, SV_NAMAKE_ARMOR = 63, -} sv_soft_armor_type; +}; /* The "sval" codes for TV_HARD_ARMOR */ -typedef enum sv_hard_armor_type { +enum sv_hard_armor_type { SV_RUSTY_CHAIN_MAIL = 1, /* 14- */ SV_RING_MAIL = 2, /* 12 */ SV_METAL_SCALE_MAIL = 3, /* 13 */ @@ -44,10 +44,10 @@ typedef enum sv_hard_armor_type { SV_MITHRIL_CHAIN_MAIL = 20, /* 28+ */ SV_MITHRIL_PLATE_MAIL = 25, /* 35+ */ SV_ADAMANTITE_PLATE_MAIL = 30, /* 40+ */ -} sv_hard_armor_type; +}; /* The "sval" codes for TV_DRAG_ARMOR */ -typedef enum sv_dragon_armor_type { +enum sv_dragon_armor_type { SV_DRAGON_BLACK = 1, SV_DRAGON_BLUE = 2, SV_DRAGON_WHITE = 3, @@ -61,5 +61,5 @@ typedef enum sv_dragon_armor_type { SV_DRAGON_CHAOS = 18, SV_DRAGON_BALANCE = 20, SV_DRAGON_POWER = 30, -} sv_dragon_armor_type; +}; \ No newline at end of file diff --git a/src/sv-definition/sv-bow-types.h b/src/sv-definition/sv-bow-types.h index 283296e50..9d4d2f653 100644 --- a/src/sv-definition/sv-bow-types.h +++ b/src/sv-definition/sv-bow-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_BOW (note information in "sval") */ -typedef enum sv_bow_type { +enum sv_bow_type { SV_SLING = 2, /* (x2) */ SV_SHORT_BOW = 12, /* (x2) */ SV_LONG_BOW = 13, /* (x3) */ @@ -10,4 +10,4 @@ typedef enum sv_bow_type { SV_CRIMSON = 50, /* (x0) */ SV_HARP = 51, /* (x0) */ SV_NAMAKE_BOW = 63, /* (x3) */ -} sv_bow_type; +}; diff --git a/src/sv-definition/sv-digging-types.h b/src/sv-definition/sv-digging-types.h index e0402edf3..2e526e06f 100644 --- a/src/sv-definition/sv-digging-types.h +++ b/src/sv-definition/sv-digging-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_DIGGING */ -typedef enum sv_digging_type { +enum sv_digging_type { SV_SHOVEL = 1, SV_GNOMISH_SHOVEL = 2, SV_DWARVEN_SHOVEL = 3, @@ -9,4 +9,4 @@ typedef enum sv_digging_type { SV_ORCISH_PICK = 5, SV_DWARVEN_PICK = 6, SV_MATTOCK = 7, -} sv_digging_type; +}; diff --git a/src/sv-definition/sv-food-types.h b/src/sv-definition/sv-food-types.h index 156e6c6dd..7575be947 100644 --- a/src/sv-definition/sv-food-types.h +++ b/src/sv-definition/sv-food-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_FOOD */ -typedef enum sv_food_type { +enum sv_food_type { SV_FOOD_POISON = 0, SV_FOOD_BLINDNESS = 1, SV_FOOD_PARANOIA = 2, @@ -30,4 +30,4 @@ typedef enum sv_food_type { SV_FOOD_WAYBREAD = 37, SV_FOOD_PINT_OF_ALE = 38, SV_FOOD_PINT_OF_WINE = 39, -} sv_food_type; +}; diff --git a/src/sv-definition/sv-lite-types.h b/src/sv-definition/sv-lite-types.h index 1339b6c4c..d15059ef9 100644 --- a/src/sv-definition/sv-lite-types.h +++ b/src/sv-definition/sv-lite-types.h @@ -1,7 +1,7 @@ #pragma once /* The sval codes for TV_LITE */ -typedef enum sv_lite_type { +enum sv_lite_type { SV_LITE_TORCH = 0, SV_LITE_LANTERN = 1, SV_LITE_FEANOR = 2, @@ -12,4 +12,4 @@ typedef enum sv_lite_type { SV_LITE_LORE = 7, SV_LITE_PALANTIR = 8, SV_LITE_FLY_STONE = 9, -} sv_lite_type; +}; diff --git a/src/sv-definition/sv-potion-types.h b/src/sv-definition/sv-potion-types.h index b0285d972..8731f643a 100644 --- a/src/sv-definition/sv-potion-types.h +++ b/src/sv-definition/sv-potion-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_POTION */ -typedef enum sv_potion_type { +enum sv_potion_type { SV_POTION_WATER = 0, SV_POTION_APPLE_JUICE = 1, SV_POTION_SLIME_MOLD = 2, @@ -69,4 +69,4 @@ typedef enum sv_potion_type { SV_POTION_NEO_TSUYOSHI = 64, SV_POTION_TSUYOSHI = 65, SV_POTION_POLYMORPH = 66, -} sv_potion_type; +}; diff --git a/src/sv-definition/sv-protector-types.h b/src/sv-definition/sv-protector-types.h index b80e9f8a7..c2522c08c 100644 --- a/src/sv-definition/sv-protector-types.h +++ b/src/sv-definition/sv-protector-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_SHIELD */ -typedef enum sv_shield_type { +enum sv_shield_type { SV_SMALL_LEATHER_SHIELD = 2, SV_SMALL_METAL_SHIELD = 3, SV_LARGE_LEATHER_SHIELD = 4, @@ -10,10 +10,10 @@ typedef enum sv_shield_type { SV_KNIGHT_SHIELD = 7, SV_MIRROR_SHIELD = 10, SV_YATA_MIRROR = 50, -} sv_shield_type; +}; /* The "sval" codes for TV_HELM */ -typedef enum sv_helm_type { +enum sv_helm_type { SV_HARD_LEATHER_CAP = 2, SV_METAL_CAP = 3, SV_JINGASA = 4, /* 4 */ @@ -21,37 +21,37 @@ typedef enum sv_helm_type { SV_STEEL_HELM = 6, SV_DRAGON_HELM = 7, SV_KABUTO = 8, /* 7 */ -} sv_helm_type; +}; /* The "sval" codes for TV_CROWN */ -typedef enum sv_crown_type { +enum sv_crown_type { SV_IRON_CROWN = 10, SV_GOLDEN_CROWN = 11, SV_JEWELED_CROWN = 12, SV_CHAOS = 50, -} sv_crown_type; +}; /* The "sval" codes for TV_BOOTS */ -typedef enum sv_boots_type { +enum sv_boots_type { SV_PAIR_OF_SOFT_LEATHER_BOOTS = 2, SV_PAIR_OF_HARD_LEATHER_BOOTS = 3, SV_PAIR_OF_DRAGON_GREAVE = 4, SV_PAIR_OF_METAL_SHOD_BOOTS = 6, -} sv_boots_type; +}; /* The "sval" codes for TV_CLOAK */ -typedef enum sv_cloak_type { +enum sv_cloak_type { SV_CLOAK = 1, SV_ELVEN_CLOAK = 2, SV_FUR_CLOAK = 3, SV_ETHEREAL_CLOAK = 5, SV_SHADOW_CLOAK = 6, -} sv_cloak_type; +}; /* The "sval" codes for TV_GLOVES */ -typedef enum sv_gloves_type { +enum sv_gloves_type { SV_SET_OF_LEATHER_GLOVES = 1, SV_SET_OF_GAUNTLETS = 2, SV_SET_OF_DRAGON_GLOVES = 3, SV_SET_OF_CESTI = 5, -} sv_gloves_type; +}; diff --git a/src/sv-definition/sv-ring-types.h b/src/sv-definition/sv-ring-types.h index 1cd7d9c88..ab78db0b8 100644 --- a/src/sv-definition/sv-ring-types.h +++ b/src/sv-definition/sv-ring-types.h @@ -1,7 +1,7 @@ #pragma once /* The sval codes for TV_RING */ -typedef enum sv_ring_type { +enum sv_ring_type { SV_RING_WOE = 0, SV_RING_AGGRAVATION = 1, SV_RING_WEAKNESS = 2, @@ -57,4 +57,4 @@ typedef enum sv_ring_type { SV_RING_DEC_MANA = 53, SV_RING_WARNING = 54, SV_RING_MUSCLE = 55, -} sv_ring_type; +}; diff --git a/src/sv-definition/sv-rod-types.h b/src/sv-definition/sv-rod-types.h index f3437bcce..305a91bbe 100644 --- a/src/sv-definition/sv-rod-types.h +++ b/src/sv-definition/sv-rod-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_ROD */ -typedef enum sv_rod_type { +enum sv_rod_type { SV_ROD_DETECT_TRAP = 0, SV_ROD_DETECT_DOOR = 1, SV_ROD_IDENTIFY = 2, @@ -33,4 +33,4 @@ typedef enum sv_rod_type { SV_ROD_HAVOC = 28, SV_ROD_STONE_TO_MUD = 29, SV_ROD_AGGRAVATE = 30, -} sv_rod_type; +}; diff --git a/src/sv-definition/sv-scroll-types.h b/src/sv-definition/sv-scroll-types.h index e0cf359eb..5870222c4 100644 --- a/src/sv-definition/sv-scroll-types.h +++ b/src/sv-definition/sv-scroll-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_SCROLL */ -typedef enum sv_scroll_type { +enum sv_scroll_type { SV_SCROLL_DARKNESS = 0, SV_SCROLL_AGGRAVATE_MONSTER = 1, SV_SCROLL_CURSE_ARMOR = 2, @@ -59,4 +59,4 @@ typedef enum sv_scroll_type { SV_SCROLL_SUMMON_KIN = 54, SV_SCROLL_AMUSEMENT = 55, SV_SCROLL_STAR_AMUSEMENT = 56, -} sv_scroll_type; +}; diff --git a/src/sv-definition/sv-staff-types.h b/src/sv-definition/sv-staff-types.h index 49c54e851..f4d059cbc 100644 --- a/src/sv-definition/sv-staff-types.h +++ b/src/sv-definition/sv-staff-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_STAFF */ -typedef enum sv_staff_type { +enum sv_staff_type { SV_STAFF_DARKNESS = 0, SV_STAFF_SLOWNESS = 1, SV_STAFF_HASTE_MONSTERS = 2, @@ -35,4 +35,4 @@ typedef enum sv_staff_type { SV_STAFF_ANIMATE_DEAD = 30, SV_STAFF_MSTORM = 31, SV_STAFF_NOTHING = 32, -} sv_staff_type; +}; diff --git a/src/sv-definition/sv-wand-types.h b/src/sv-definition/sv-wand-types.h index 517d69dd7..4a29b4cbe 100644 --- a/src/sv-definition/sv-wand-types.h +++ b/src/sv-definition/sv-wand-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" codes for TV_WAND */ -typedef enum sv_wand_type { +enum sv_wand_type { SV_WAND_HEAL_MONSTER = 0, SV_WAND_HASTE_MONSTER = 1, SV_WAND_CLONE_MONSTER = 2, @@ -34,4 +34,4 @@ typedef enum sv_wand_type { SV_WAND_ROCKETS = 29, SV_WAND_STRIKING = 30, SV_WAND_GENOCIDE = 31, -} sv_wand_type; +}; diff --git a/src/sv-definition/sv-weapon-types.h b/src/sv-definition/sv-weapon-types.h index aab61312e..5c0b10e6a 100644 --- a/src/sv-definition/sv-weapon-types.h +++ b/src/sv-definition/sv-weapon-types.h @@ -1,7 +1,7 @@ #pragma once /* The "sval" values for TV_HAFTED */ -typedef enum sv_hafted_type { +enum sv_hafted_type { SV_CLUB = 1, /* 1d4 */ SV_WHIP = 2, /* 1d6 */ SV_QUARTERSTAFF = 3, /* 1d9 */ @@ -22,10 +22,10 @@ typedef enum sv_hafted_type { SV_WIZSTAFF = 21, /* 1d2 */ SV_GROND = 50, /* 3d9 */ SV_NAMAKE_HAMMER = 63, /* 1d77 */ -} sv_hafted_type; +}; /* The "sval" values for TV_POLEARM */ -typedef enum sv_polearm_type { +enum sv_polearm_type { SV_HATCHET = 1, /* 1d5 */ SV_SPEAR = 2, /* 1d6 */ SV_SICKLE = 3, /* 2d3 */ @@ -52,10 +52,10 @@ typedef enum sv_polearm_type { SV_SCYTHE_OF_SLICING = 30, /* 8d4 */ SV_TSURIZAO = 40, /* 1d1 */ SV_DEATH_SCYTHE = 50, /* 10d10 */ -} sv_polearm_type; +}; /* The "sval" codes for TV_SWORD */ -typedef enum sv_sword_type { +enum sv_sword_type { SV_BROKEN_DAGGER = 1, /* 1d1 */ SV_BROKEN_SWORD = 2, /* 1d2 */ SV_DAGGER = 4, /* 1d4 */ @@ -88,4 +88,4 @@ typedef enum sv_sword_type { SV_DIAMOND_EDGE = 31, /* 7d5 */ SV_POISON_NEEDLE = 32, /* 1d1 */ SV_HAYABUSA = 33, /* 1d6 */ -} sv_sword_type; +}; diff --git a/src/system/angband-version.c b/src/system/angband-version.c index 551b38b5e..a4312bdf2 100644 --- a/src/system/angband-version.c +++ b/src/system/angband-version.c @@ -6,7 +6,7 @@ void put_version(char *buf) if (IS_ALPHA_VERSION) { sprintf(buf, _("変愚蛮怒 %d.%d.%dAlpha%d", "Hengband %d.%d.%dAlpha%d"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH, H_VER_EXTRA); } else { - char *mode = IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"); + concptr mode = IS_STABLE_VERSION ? _("安定版", "Stable") : _("開発版", "Developing"); sprintf(buf, _("変愚蛮怒 %d.%d.%d.%d(%s)", "Hengband %d.%d.%d.%d(%s)"), H_VER_MAJOR, H_VER_MINOR, H_VER_PATCH, H_VER_EXTRA, mode); } -} \ No newline at end of file +} diff --git a/src/system/game-option-types.h b/src/system/game-option-types.h index 9a5bbb8c9..d9143faab 100644 --- a/src/system/game-option-types.h +++ b/src/system/game-option-types.h @@ -1,6 +1,6 @@ #pragma once -typedef enum game_option_types { +enum game_option_types { OPT_PAGE_INPUT, OPT_PAGE_MAPSCREEN, OPT_PAGE_TEXT, @@ -10,4 +10,4 @@ typedef enum game_option_types { OPT_PAGE_AUTODESTROY, OPT_PAGE_PLAYRECORD, OPT_PAGE_HIDE, -} game_option_types; +}; diff --git a/src/system/h-type.h b/src/system/h-type.h index a875a522c..95c621255 100644 --- a/src/system/h-type.h +++ b/src/system/h-type.h @@ -63,11 +63,13 @@ typedef int errr; /* 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 */ +#ifndef __cplusplus #if __STDC_VERSION__ >= 199901L #include #else typedef char bool; /*!< bool型をcharとして定義 / Note that a bool is smaller than a full "int" / Simple True/False type */ #endif +#endif typedef unsigned int uint; /* uint型をintとして定義 / An unsigned, "standard" integer (often pre-defined) */ /* The largest possible unsigned integer */ @@ -251,10 +253,10 @@ typedef uint (*func_hsh)(vptr, uint); /* A key extractor takes a thing and returns (a pointer to) some key */ typedef vptr (*func_key)(vptr); -typedef enum process_result { +enum process_result { PROCESS_FALSE = 0, PROCESS_TRUE = 1, PROCESS_CONTINUE = 2, -} process_result; +}; #endif diff --git a/src/system/system-variables.h b/src/system/system-variables.h index 9355007a1..f2935daa9 100644 --- a/src/system/system-variables.h +++ b/src/system/system-variables.h @@ -5,14 +5,14 @@ #define MAX_NAZGUL_NUM 5 #define SCREEN_BUF_MAX_SIZE (1024 * 1024) /*!< Max size of screen dump buffer */ -typedef enum init_flags_type { +enum init_flags_type { INIT_NAME_ONLY = 0x01, INIT_SHOW_TEXT = 0x02, INIT_ASSIGN = 0x04, INIT_CREATE_DUNGEON = 0x08, INIT_ONLY_FEATURES = 0x10, INIT_ONLY_BUILDINGS = 0x20, -} init_flags_type; +}; extern init_flags_type init_flags; extern concptr ANGBAND_SYS; diff --git a/src/target/target-describer.c b/src/target/target-describer.c index c1df3fdb9..70739e796 100644 --- a/src/target/target-describer.c +++ b/src/target/target-describer.c @@ -129,7 +129,7 @@ static void describe_scan_result(player_type *subject_ptr, eg_type *eg_ptr) if (!easy_floor) return; - eg_ptr->floor_num = scan_floor_items(subject_ptr, eg_ptr->floor_list, eg_ptr->y, eg_ptr->x, SCAN_FLOOR_ONLY_MARKED, 0); + eg_ptr->floor_num = scan_floor_items(subject_ptr, eg_ptr->floor_list, eg_ptr->y, eg_ptr->x, SCAN_FLOOR_ONLY_MARKED, TV_NONE); if (eg_ptr->floor_num > 0) eg_ptr->x_info = _("x物 ", "x,"); } @@ -335,7 +335,7 @@ static char describe_footing_many_items(player_type *subject_ptr, eg_type *eg_pt while (TRUE) { screen_save(); show_gold_on_floor = TRUE; - (void)show_floor_items(subject_ptr, 0, eg_ptr->y, eg_ptr->x, min_width, 0); + (void)show_floor_items(subject_ptr, 0, eg_ptr->y, eg_ptr->x, min_width, TV_NONE); show_gold_on_floor = FALSE; #ifdef JP sprintf(eg_ptr->out_val, "%s %d個のアイテム%s%s [Enterで次へ, %s]", eg_ptr->s1, (int)eg_ptr->floor_num, eg_ptr->s2, eg_ptr->s3, eg_ptr->info); diff --git a/src/target/target-describer.h b/src/target/target-describer.h index 0caa281c7..24202132d 100644 --- a/src/target/target-describer.h +++ b/src/target/target-describer.h @@ -4,5 +4,5 @@ extern bool show_gold_on_floor; -typedef enum target_type target_type; +enum target_type : uint8_t; char examine_grid(player_type *subject_ptr, const POSITION y, const POSITION x, target_type mode, concptr info); diff --git a/src/target/target-setter.c b/src/target/target-setter.c index efaca3415..d7685983d 100644 --- a/src/target/target-setter.c +++ b/src/target/target-setter.c @@ -448,7 +448,7 @@ static void sweep_target_grids(player_type *creature_ptr, ts_type *ts_ptr) describe_grid_wizard(creature_ptr, ts_ptr); /* Describe and Prompt (enable "TARGET_LOOK") */ - while ((ts_ptr->query = examine_grid(creature_ptr, ts_ptr->y, ts_ptr->x, ts_ptr->mode | TARGET_LOOK, ts_ptr->info)) == 0) + while ((ts_ptr->query = examine_grid(creature_ptr, ts_ptr->y, ts_ptr->x, static_cast(ts_ptr->mode | TARGET_LOOK), ts_ptr->info)) == 0) ; ts_ptr->distance = 0; diff --git a/src/target/target-setter.h b/src/target/target-setter.h index 87bffdc13..cf97b40cf 100644 --- a/src/target/target-setter.h +++ b/src/target/target-setter.h @@ -2,5 +2,5 @@ #include "system/angband.h" -typedef enum target_type target_type; +enum target_type : uint8_t; bool target_set(player_type *creature_ptr, target_type mode); diff --git a/src/target/target-types.h b/src/target/target-types.h index 82ebb3e7c..06ac6c396 100644 --- a/src/target/target-types.h +++ b/src/target/target-types.h @@ -1,9 +1,9 @@ #pragma once /* target_set用関数の利用用途フラグ / Bit flags for the "target_set" function */ -typedef enum target_type { +enum target_type : uint8_t { TARGET_KILL = 0x01, /*!< モンスターへの狙いをつける(視界内モンスターのみクエリ対象) / Target monsters */ TARGET_LOOK = 0x02, /*!< "L"ookコマンド向けの既存情報確認向け(全ての有為な情報をクエリ対象) / Describe grid fully */ TARGET_XTRA = 0x04, /*!< 現在未使用 / Currently unused flag */ TARGET_GRID = 0x08, /*!< 全てのマス対象にする(現在未使用) / Select from all grids */ -} target_type; +}; diff --git a/src/term/readdib.c b/src/term/readdib.c index 2fa32a385..873b7d342 100644 --- a/src/term/readdib.c +++ b/src/term/readdib.c @@ -52,7 +52,7 @@ void global_free(DIBINIT *pInfo, INT_PTR *fh, BOOL unlock_needed); static DWORD PASCAL lread(int fh, void *pv, DWORD ul) { DWORD ulT = ul; - BYTE *hp = pv; + BYTE *hp = static_cast(pv); while (ul > (DWORD)MAXREAD) { @@ -120,7 +120,7 @@ static HPALETTE PASCAL MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) */ else { - return(GetStockObject(DEFAULT_PALETTE)); + return static_cast(GetStockObject(DEFAULT_PALETTE)); } } @@ -333,8 +333,8 @@ BOOL ReadDIB(HWND hWnd, LPSTR lpFileName, DIBINIT *pInfo) GlobalUnlock(pInfo->hDIB); hDC = GetDC(hWnd); - if (!MakeBitmapAndPalette(hDC, pInfo->hDIB, &((HPALETTE)pInfo->hPalette), - &((HBITMAP)pInfo->hBitmap))) + if (!MakeBitmapAndPalette(hDC, pInfo->hDIB, reinterpret_cast(&pInfo->hPalette), + reinterpret_cast(&pInfo->hBitmap))) { ReleaseDC(hWnd,hDC); global_free(pInfo, &fh, FALSE); diff --git a/src/term/term-color-types.h b/src/term/term-color-types.h index 7c5f014b4..1870bc575 100644 --- a/src/term/term-color-types.h +++ b/src/term/term-color-types.h @@ -6,7 +6,7 @@ * The "(R,G,B)" codes are given in "fourths" of the "maximal" value, * and should "gamma corrected" on most (non-Macintosh) machines. */ -typedef enum term_color_type { +enum term_color_type { TERM_DARK = 0, /*!< 'd' - 黒 0,0,0 */ TERM_WHITE = 1, /*!< 'w' - 白 4,4,4 */ TERM_SLATE = 2, /*!< 's' - 灰 2,2,2 */ @@ -23,4 +23,4 @@ typedef enum term_color_type { TERM_L_GREEN = 13, /*!< 'G' - 明るい緑 0,4,0 */ TERM_L_BLUE = 14, /*!< 'B' - 明るい青 0,4,4 */ TERM_L_UMBER = 15, /*!< 'U' - 明るい琥珀 3,2,1 */ -} term_color_type; +}; diff --git a/src/term/z-term.c b/src/term/z-term.c index 431602f9c..ebb62d64c 100644 --- a/src/term/z-term.c +++ b/src/term/z-term.c @@ -1295,7 +1295,7 @@ errr term_fresh_force(void) errr term_set_cursor(int v) { /* Already done */ - if (Term->scr->cv == v) + if (Term->scr->cv == (bool)v) return 1; /* Change */ diff --git a/src/view/display-characteristic.c b/src/view/display-characteristic.c index bc68da817..9a5135e93 100644 --- a/src/view/display-characteristic.c +++ b/src/view/display-characteristic.c @@ -101,7 +101,7 @@ static bool decide_light_equipment_color(TERM_LEN row, TERM_LEN *col, int flag1, */ static void decide_vulnerability_color(u16b mode, TERM_LEN row, TERM_LEN *col, int flag1, BIT_FLAGS *flags, byte *header_color, bool vuln, bool riding) { - byte color = (riding ? TERM_L_GREEN : TERM_WHITE); + term_color_type color = (riding ? TERM_L_GREEN : TERM_WHITE); color = (vuln ? TERM_RED : color); if (has_flag(flags, flag1)) { c_put_str(color, (mode & DP_IMM) ? "*" : "+", row, *col); @@ -127,13 +127,13 @@ static void decide_vulnerability_color(u16b mode, TERM_LEN row, TERM_LEN *col, i static void decide_colors(player_type *creature_ptr, u16b mode, TERM_LEN row, TERM_LEN *col, int flag1, byte *header_color, bool vuln, bool riding) { int max_i = (mode & DP_WP) ? INVEN_SUB_HAND + 1 : INVEN_TOTAL; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < max_i; i++) { + for (int i = INVEN_MAIN_HAND; i < max_i; i++) { BIT_FLAGS flags[TR_FLAG_SIZE]; object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; object_flags_known(creature_ptr, o_ptr, flags); if (!(mode & DP_IMM)) { - byte color = (riding ? TERM_L_GREEN : TERM_SLATE); + term_color_type color = (riding ? TERM_L_GREEN : TERM_SLATE); color = (vuln ? TERM_RED : color); c_put_str(color, ".", row, *col); @@ -163,7 +163,7 @@ static void decide_colors(player_type *creature_ptr, u16b mode, TERM_LEN row, TE static void display_one_characteristic( TERM_LEN row, TERM_LEN col, concptr header, byte header_color, int header_col, int flag1, bool vuln, bool riding, all_player_flags *f) { - byte color = (riding ? TERM_L_GREEN : TERM_SLATE); + term_color_type color = (riding ? TERM_L_GREEN : TERM_SLATE); color = (vuln ? TERM_RED : color); c_put_str(color, ".", row, col); diff --git a/src/view/display-inventory.c b/src/view/display-inventory.c index 0fc14a9fa..afba2258e 100644 --- a/src/view/display-inventory.c +++ b/src/view/display-inventory.c @@ -128,7 +128,7 @@ COMMAND_CODE show_inventory(player_type *owner_ptr, int target_item, BIT_FLAGS m */ void display_inventory(player_type *owner_ptr, tval_type tval) { - register int i, n, z = 0; + int i, n, z = 0; object_type *o_ptr; TERM_COLOR attr = TERM_WHITE; char tmp_val[80]; diff --git a/src/view/display-player-stat-info.c b/src/view/display-player-stat-info.c index 55fb0e81c..8b146d9d6 100644 --- a/src/view/display-player-stat-info.c +++ b/src/view/display-player-stat-info.c @@ -200,7 +200,7 @@ static void compensate_stat_by_weapon(char *c, TERM_COLOR *a, object_type *o_ptr */ static void display_equipments_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int *col) { - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; object_flags_known(creature_ptr, o_ptr, flags); diff --git a/src/view/display-player.c b/src/view/display-player.c index 150c25623..be51d7816 100644 --- a/src/view/display-player.c +++ b/src/view/display-player.c @@ -356,7 +356,7 @@ void display_player(player_type *creature_ptr, int mode) void display_player_equippy(player_type *creature_ptr, TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode) { int max_i = (mode & DP_WP) ? INVEN_SUB_HAND + 1 : INVEN_TOTAL; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < max_i; i++) + for (int i = INVEN_MAIN_HAND; i < max_i; i++) { object_type *o_ptr; o_ptr = &creature_ptr->inventory_list[i]; diff --git a/src/view/display-self-info.c b/src/view/display-self-info.c index f77ba5162..55266b408 100644 --- a/src/view/display-self-info.c +++ b/src/view/display-self-info.c @@ -21,7 +21,7 @@ void display_life_rating(player_type *creature_ptr, self_info_type *self_ptr) void display_max_base_status(player_type *creature_ptr, self_info_type *self_ptr) { self_ptr->info[self_ptr->line++] = _("能力の最大値", "Limits of maximum stats"); - for (base_status_type v_nr = 0; v_nr < A_MAX; v_nr++) { + for (int v_nr = 0; v_nr < A_MAX; v_nr++) { char stat_desc[80]; sprintf(stat_desc, "%s 18/%d", stat_names[v_nr], creature_ptr->stat_max_max[v_nr] - 18); strcpy(self_ptr->s_string[v_nr], stat_desc); diff --git a/src/view/status-bars-table.h b/src/view/status-bars-table.h index ff75980b5..ebbfb0a0e 100644 --- a/src/view/status-bars-table.h +++ b/src/view/status-bars-table.h @@ -9,7 +9,7 @@ typedef struct stat_bar { } stat_bar; /* 画面下部に表示する状態表示定義ID / Data structure for status bar */ -typedef enum bar_definition_type { +enum bar_definition_type { BAR_TSUYOSHI = 0, /*!< 下部ステータス表示: オクレ兄さん状態 */ BAR_HALLUCINATION = 1, /*!< 下部ステータス表示: 幻覚 */ BAR_BLINDNESS = 2, /*!< 下部ステータス表示: 盲目 */ @@ -78,7 +78,7 @@ typedef enum bar_definition_type { BAR_CURE = 65, /*!< 下部ステータス表示: 回復 */ BAR_ESP_EVIL = 66, /*!< 下部ステータス表示: 邪悪感知 */ BAR_NIGHTSIGHT = 67, /*!< 下部ステータス表示: 暗視 */ -} bar_definition_type; +}; #define MAX_STAT_BARS 69 diff --git a/src/window/display-sub-windows.c b/src/window/display-sub-windows.c index 2f5c79aa5..0727cd61b 100644 --- a/src/window/display-sub-windows.c +++ b/src/window/display-sub-windows.c @@ -219,7 +219,7 @@ static void display_equipment(player_type *owner_ptr, tval_type tval) TERM_COLOR attr = TERM_WHITE; char tmp_val[80]; GAME_TEXT o_name[MAX_NLEN]; - for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { + for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { object_type *o_ptr; o_ptr = &owner_ptr->inventory_list[i]; tmp_val[0] = tmp_val[1] = tmp_val[2] = ' '; diff --git a/src/wizard/cmd-wizard.c b/src/wizard/cmd-wizard.c index d295b0259..60cc0f9fa 100644 --- a/src/wizard/cmd-wizard.c +++ b/src/wizard/cmd-wizard.c @@ -142,7 +142,7 @@ void do_cmd_debug(player_type *creature_ptr) break; case 'f': - identify_fully(creature_ptr, FALSE, 0); + identify_fully(creature_ptr, FALSE, TV_NONE); break; case 'F': wiz_create_feature(creature_ptr); @@ -154,13 +154,13 @@ void do_cmd_debug(player_type *creature_ptr) acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, FALSE, FALSE, TRUE); break; case 'h': - roll_hitdice(creature_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG); + roll_hitdice(creature_ptr, static_cast(SPOP_DISPLAY_MES | SPOP_DEBUG)); break; case 'H': wiz_summon_horde(creature_ptr); break; case 'i': - (void)ident_spell(creature_ptr, FALSE, 0); + (void)ident_spell(creature_ptr, FALSE, TV_NONE); break; case 'j': wiz_jump_to_dungeon(creature_ptr); diff --git a/src/wizard/monster-info-spoiler.h b/src/wizard/monster-info-spoiler.h index b1d4eea34..976f84563 100644 --- a/src/wizard/monster-info-spoiler.h +++ b/src/wizard/monster-info-spoiler.h @@ -3,6 +3,7 @@ #include "system/angband.h" #include "wizard/spoiler-util.h" +enum race_flags8 : uint32_t; spoiler_output_status spoil_mon_desc_all(concptr fname); -spoiler_output_status spoil_mon_desc(concptr fname, bool show_all, BIT_FLAGS RF8_flags); +spoiler_output_status spoil_mon_desc(concptr fname, bool show_all, race_flags8 RF8_flags); spoiler_output_status spoil_mon_info(concptr fname); diff --git a/src/wizard/spoiler-table.c b/src/wizard/spoiler-table.c index 70b46b03f..7efabddf2 100644 --- a/src/wizard/spoiler-table.c +++ b/src/wizard/spoiler-table.c @@ -25,7 +25,7 @@ grouper group_item[MAX_GROUPER_ITEM] = { { TV_SHOT, _("射撃物", "Ammo") }, { { TV_SKELETON, _("その他", "Misc") }, { TV_BOTTLE, NULL }, { TV_JUNK, NULL }, { TV_SPIKE, NULL }, { TV_FLASK, NULL }, { TV_PARCHMENT, NULL }, - { 0, "" } }; + { TV_NONE, "" } }; /* The artifacts categorized by type */ grouper group_artifact[MAX_GROUPER_ARTIFACT] = { @@ -52,7 +52,7 @@ grouper group_artifact[MAX_GROUPER_ARTIFACT] = { { TV_LITE, _("光源", "Light Sources") }, { TV_AMULET, _("アミュレット", "Amulets") }, { TV_RING, _("指輪", "Rings") }, - { 0, NULL }, + { TV_NONE, NULL }, }; flag_desc stat_flags_desc[MAX_STAT_FLAGS_DESCRIPTION] = { { TR_STR, _("腕力", "STR") }, { TR_INT, _("知能", "INT") }, { TR_WIS, _("賢さ", "WIS") }, diff --git a/src/wizard/spoiler-table.h b/src/wizard/spoiler-table.h index 8e1de1c05..d0134f517 100644 --- a/src/wizard/spoiler-table.h +++ b/src/wizard/spoiler-table.h @@ -29,8 +29,8 @@ typedef struct grouper { * the flag whose value is "1UL << N", but that requires hard-coding. */ typedef struct flag_desc { - const tr_type flag; - concptr const desc; + tr_type flag; + concptr desc; } flag_desc; extern grouper group_item[MAX_GROUPER_ITEM]; diff --git a/src/wizard/spoiler-util.h b/src/wizard/spoiler-util.h index 3f2e231f8..ac0e8cc54 100644 --- a/src/wizard/spoiler-util.h +++ b/src/wizard/spoiler-util.h @@ -47,9 +47,9 @@ void spoiler_blanklines(int n); void spoiler_underline(concptr str); void spoil_out(concptr str); -typedef enum spoiler_output_status { +enum spoiler_output_status { SPOILER_OUTPUT_CANCEL, SPOILER_OUTPUT_SUCCESS, SPOILER_OUTPUT_FAIL_FOPEN, SPOILER_OUTPUT_FAIL_FCLOSE -} spoiler_output_status; +}; diff --git a/src/wizard/wizard-item-modifier.c b/src/wizard/wizard-item-modifier.c index 287e48c3c..34f929f8f 100644 --- a/src/wizard/wizard-item-modifier.c +++ b/src/wizard/wizard-item-modifier.c @@ -441,11 +441,11 @@ void wiz_modify_item(player_type *creature_ptr) concptr s = "You have nothing to play with."; OBJECT_IDX item; object_type *o_ptr; - o_ptr = choose_object(creature_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0); + o_ptr = choose_object(creature_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, TV_NONE); if (!o_ptr) return; - screen_save(creature_ptr); + screen_save(); object_type forge; object_type *q_ptr; @@ -482,7 +482,7 @@ void wiz_modify_item(player_type *creature_ptr) } } - screen_load(creature_ptr); + screen_load(); if (changed) { msg_print("Changes accepted."); @@ -493,4 +493,4 @@ void wiz_modify_item(player_type *creature_ptr) } else { msg_print("Changes ignored."); } -} \ No newline at end of file +} diff --git a/src/wizard/wizard-special-process.c b/src/wizard/wizard-special-process.c index b6288e412..0031b9a27 100644 --- a/src/wizard/wizard-special-process.c +++ b/src/wizard/wizard-special-process.c @@ -130,7 +130,7 @@ KIND_OBJECT_IDX wiz_create_itemtype(void) if ((num < 0) || (num >= max_num)) return 0; - tval_type tval = tvals[num].tval; + tval_type tval = static_cast(tvals[num].tval); concptr tval_desc = tvals[num].desc; term_clear(); num = 0; @@ -178,9 +178,9 @@ KIND_OBJECT_IDX wiz_create_itemtype(void) */ void wiz_create_item(player_type *caster_ptr) { - screen_save(caster_ptr); + screen_save(); OBJECT_IDX k_idx = wiz_create_itemtype(); - screen_load(caster_ptr); + screen_load(); if (!k_idx) return; @@ -459,7 +459,7 @@ void wiz_reset_class(player_type *creature_ptr) if (tmp_int < 0 || tmp_int >= MAX_CLASS) return; - creature_ptr->pclass = (byte)tmp_int; + creature_ptr->pclass = static_cast(tmp_int); creature_ptr->window_flags |= PW_PLAYER; creature_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS; handle_stuff(creature_ptr); diff --git a/src/wizard/wizard-spells.c b/src/wizard/wizard-spells.c index 58971fef0..b5f0c3943 100644 --- a/src/wizard/wizard-spells.c +++ b/src/wizard/wizard-spells.c @@ -125,7 +125,7 @@ void wiz_learn_blue_magic_all(player_type *caster_ptr) { BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L; for (int j = 1; j < A_MAX; j++) { - set_rf_masks(&f4, &f5, &f6, j); + set_rf_masks(&f4, &f5, &f6, static_cast(j)); int i; for (i = 0; i < 32; i++) { @@ -155,7 +155,7 @@ void wiz_learn_blue_magic_all(player_type *caster_ptr) void wiz_summon_random_enemy(player_type *caster_ptr, int num) { for (int i = 0; i < num; i++) - (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, 0, PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); + (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_NONE, PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); } /*! diff --git a/src/wizard/wizard-spells.h b/src/wizard/wizard-spells.h index 9e08dbd91..a8013692c 100644 --- a/src/wizard/wizard-spells.h +++ b/src/wizard/wizard-spells.h @@ -21,7 +21,7 @@ typedef union spell_functions { typedef struct debug_spell_command { int type; - char *command_name; + concptr command_name; spell_functions command_function; } debug_spell_command; -- 2.11.0