From: Hourier Date: Thu, 29 Apr 2021 05:49:40 +0000 (+0900) Subject: [Refactor] #963 Renamed player_type.align to alignment X-Git-Tag: vmacos3.0.0-alpha52~213^2~5^2~11 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a50af875f52bfdad2d3d276d7b8a1d6fae3fcf1f;p=hengbandforosx%2Fhengbandosx.git [Refactor] #963 Renamed player_type.align to alignment --- diff --git a/src/io-dump/character-dump.cpp b/src/io-dump/character-dump.cpp index 19a41f721..2523144ab 100644 --- a/src/io-dump/character-dump.cpp +++ b/src/io-dump/character-dump.cpp @@ -1,6 +1,5 @@ #include -#include "io-dump/character-dump.h" #include "artifact/fixed-art-types.h" #include "cmd-building/cmd-building.h" #include "dungeon/dungeon.h" @@ -10,6 +9,7 @@ #include "game-option/birth-options.h" #include "game-option/game-play-options.h" #include "inventory/inventory-slot-types.h" +#include "io-dump/character-dump.h" #include "io-dump/player-status-dump.h" #include "io-dump/special-class-dump.h" #include "io/mutations-dump.h" @@ -26,8 +26,8 @@ #include "monster/smart-learn-types.h" #include "object/object-info.h" #include "pet/pet-util.h" -#include "player-info/avatar.h" #include "player-info/alignment.h" +#include "player-info/avatar.h" #include "player/player-status-flags.h" #include "player/player-status-table.h" #include "player/race-info-table.h" @@ -453,7 +453,7 @@ static void dump_aux_virtues(player_type *creature_ptr, FILE *fff) } std::unique_ptr alignment(new PlayerAlignment(creature_ptr)); - std::string alg = alignment->your_alignment(); + std::string alg = alignment->get_alignment(); fprintf(fff, _("\n属性 : %s\n", "\nYour alignment : %s\n"), alg.c_str()); fprintf(fff, "\n"); dump_virtues(creature_ptr, fff); diff --git a/src/knowledge/knowledge-self.cpp b/src/knowledge/knowledge-self.cpp index 2c66aa24b..c0a5d4e97 100644 --- a/src/knowledge/knowledge-self.cpp +++ b/src/knowledge/knowledge-self.cpp @@ -6,15 +6,15 @@ #include -#include "knowledge-self.h" #include "birth/birth-explanations-table.h" #include "core/show-file.h" #include "flavor/flavor-describer.h" #include "floor/floor-town.h" #include "info-reader/fixed-map-parser.h" #include "io-dump/dump-util.h" -#include "player-info/avatar.h" +#include "knowledge-self.h" #include "player-info/alignment.h" +#include "player-info/avatar.h" #include "player/player-class.h" #include "player/player-status-table.h" #include "player/race-info-table.h" @@ -39,7 +39,7 @@ void do_cmd_knowledge_virtues(player_type *creature_ptr) return; std::unique_ptr alignment(new PlayerAlignment(creature_ptr)); - std::string alg = alignment->your_alignment(); + std::string alg = alignment->get_alignment(); fprintf(fff, _("現在の属性 : %s\n\n", "Your alignment : %s\n\n"), alg.c_str()); dump_virtues(creature_ptr, fff); angband_fclose(fff); diff --git a/src/monster-floor/monster-summon.cpp b/src/monster-floor/monster-summon.cpp index b252f2dec..98c99ef39 100644 --- a/src/monster-floor/monster-summon.cpp +++ b/src/monster-floor/monster-summon.cpp @@ -50,7 +50,7 @@ static bool summon_specific_okay(player_type *player_ptr, MONRACE_IDX r_idx) if (monster_has_hostile_align(player_ptr, m_ptr, 0, 0, r_ptr)) return FALSE; } else if (summon_specific_who < 0) { - if (monster_has_hostile_align(player_ptr, NULL, 10, -10, r_ptr) && !one_in_(ABS(player_ptr->align) / 2 + 1)) + if (monster_has_hostile_align(player_ptr, NULL, 10, -10, r_ptr) && !one_in_(ABS(player_ptr->alignment) / 2 + 1)) return FALSE; } diff --git a/src/monster/monster-info.cpp b/src/monster/monster-info.cpp index 84c5295e2..a90f20164 100644 --- a/src/monster/monster-info.cpp +++ b/src/monster/monster-info.cpp @@ -212,9 +212,9 @@ bool monster_has_hostile_align(player_type *player_ptr, monster_type *m_ptr, int sub_align1 = m_ptr->sub_align; } else /* For player */ { - if (player_ptr->align >= pa_good) + if (player_ptr->alignment >= pa_good) sub_align1 |= SUB_ALIGN_GOOD; - if (player_ptr->align <= pa_evil) + if (player_ptr->alignment <= pa_evil) sub_align1 |= SUB_ALIGN_EVIL; } diff --git a/src/monster/monster-processor.cpp b/src/monster/monster-processor.cpp index 3bfd266d4..467409713 100644 --- a/src/monster/monster-processor.cpp +++ b/src/monster/monster-processor.cpp @@ -323,9 +323,9 @@ void process_angar(player_type *target_ptr, MONSTER_IDX m_idx, bool see_m) GAME_TEXT m_name[MAX_NLEN]; monster_desc(target_ptr, m_name, m_ptr, is_pet(m_ptr) ? MD_ASSUME_VISIBLE : 0); - /* When riding a hostile align pet */ + /* When riding a hostile alignment pet */ if (target_ptr->riding == m_idx) { - if (abs(target_ptr->align / 10) < randint0(target_ptr->skill_exp[GINOU_RIDING])) + if (abs(target_ptr->alignment / 10) < randint0(target_ptr->skill_exp[GINOU_RIDING])) return; msg_format(_("%^sが突然暴れだした!", "%^s suddenly begins unruly!"), m_name); diff --git a/src/player-info/alignment.cpp b/src/player-info/alignment.cpp index 2bd4210a1..b21cc0b35 100644 --- a/src/player-info/alignment.cpp +++ b/src/player-info/alignment.cpp @@ -14,17 +14,17 @@ PlayerAlignment::PlayerAlignment(player_type *creature_ptr) */ concptr PlayerAlignment::alignment_label() { - if (this->creature_ptr->align > 150) + if (this->creature_ptr->alignment > 150) return _("大善", "Lawful"); - else if (this->creature_ptr->align > 50) + else if (this->creature_ptr->alignment > 50) return _("中善", "Good"); - else if (this->creature_ptr->align > 10) + else if (this->creature_ptr->alignment > 10) return _("小善", "Neutral Good"); - else if (this->creature_ptr->align > -11) + else if (this->creature_ptr->alignment > -11) return _("中立", "Neutral"); - else if (this->creature_ptr->align > -51) + else if (this->creature_ptr->alignment > -51) return _("小悪", "Neutral Evil"); - else if (this->creature_ptr->align > -151) + else if (this->creature_ptr->alignment > -151) return _("中悪", "Evil"); else return _("大悪", "Chaotic"); @@ -35,11 +35,11 @@ concptr PlayerAlignment::alignment_label() * @param creature_ptr 算出するクリーチャーの参照ポインタ。 * @return アライメントの表記を返す。 */ -concptr PlayerAlignment::your_alignment(bool with_value) +concptr PlayerAlignment::get_alignment(bool with_value) { auto s = alignment_label(); if (with_value || show_actual_value) - return format(_("%s(%ld)", "%s (%ld)"), s, static_cast(this->creature_ptr->align)); + return format(_("%s(%ld)", "%s (%ld)"), s, static_cast(this->creature_ptr->alignment)); return s; } diff --git a/src/player-info/alignment.h b/src/player-info/alignment.h index a1cb98c65..322155d9e 100644 --- a/src/player-info/alignment.h +++ b/src/player-info/alignment.h @@ -8,7 +8,7 @@ public: PlayerAlignment(player_type *creature_ptr); PlayerAlignment() = delete; virtual ~PlayerAlignment() = default; - concptr your_alignment(bool with_value = false); + concptr get_alignment(bool with_value = false); private: player_type *creature_ptr; concptr alignment_label(); diff --git a/src/player/player-status-resist.cpp b/src/player/player-status-resist.cpp index 9a1c06870..a5173328b 100644 --- a/src/player/player-status-resist.cpp +++ b/src/player/player-status-resist.cpp @@ -436,9 +436,9 @@ PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_ { (void)mode; // unused PERCENTAGE per = 100; - if (creature_ptr->align > 10) + if (creature_ptr->alignment > 10) per /= 2; - else if (creature_ptr->align < -10) + else if (creature_ptr->alignment < -10) per *= 2; return per; } @@ -450,7 +450,7 @@ PERCENTAGE calc_hell_fire_damage_rate(player_type *creature_ptr, rate_calc_type_ { (void)mode; // unused PERCENTAGE per = 100; - if (creature_ptr->align > 10) + if (creature_ptr->alignment > 10) per *= 2; return per; } diff --git a/src/player/player-status.cpp b/src/player/player-status.cpp index ff97344c2..c5eacad52 100644 --- a/src/player/player-status.cpp +++ b/src/player/player-status.cpp @@ -461,7 +461,7 @@ static void update_bonuses(player_type *creature_ptr) static void update_alignment(player_type *creature_ptr) { - creature_ptr->align = 0; + creature_ptr->alignment = 0; floor_type *floor_ptr = creature_ptr->current_floor_ptr; for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--) { monster_type *m_ptr; @@ -475,27 +475,27 @@ static void update_alignment(player_type *creature_ptr) continue; if (any_bits(r_ptr->flags3, RF3_GOOD)) - creature_ptr->align += r_ptr->level; + creature_ptr->alignment += r_ptr->level; if (any_bits(r_ptr->flags3, RF3_EVIL)) - creature_ptr->align -= r_ptr->level; + creature_ptr->alignment -= r_ptr->level; } if (creature_ptr->mimic_form) { switch (creature_ptr->mimic_form) { case MIMIC_DEMON: - creature_ptr->align -= 200; + creature_ptr->alignment -= 200; break; case MIMIC_DEMON_LORD: - creature_ptr->align -= 200; + creature_ptr->alignment -= 200; break; } } else { switch (creature_ptr->prace) { case RACE_ARCHON: - creature_ptr->align += 200; + creature_ptr->alignment += 200; break; case RACE_BALROG: - creature_ptr->align -= 200; + creature_ptr->alignment -= 200; break; default: @@ -508,7 +508,7 @@ static void update_alignment(player_type *creature_ptr) continue; if (creature_ptr->inventory_list[INVEN_MAIN_HAND + i].name1 != ART_IRON_BALL) continue; - creature_ptr->align -= 1000; + creature_ptr->alignment -= 1000; } int j = 0; @@ -516,7 +516,7 @@ static void update_alignment(player_type *creature_ptr) for (int i = 0; i < 8; i++) { switch (creature_ptr->vir_types[i]) { case V_JUSTICE: - creature_ptr->align += creature_ptr->virtues[i] * 2; + creature_ptr->alignment += creature_ptr->virtues[i] * 2; break; case V_CHANCE: break; @@ -525,23 +525,23 @@ static void update_alignment(player_type *creature_ptr) neutral[j++] = i; break; case V_UNLIFE: - creature_ptr->align -= creature_ptr->virtues[i]; + creature_ptr->alignment -= creature_ptr->virtues[i]; break; default: - creature_ptr->align += creature_ptr->virtues[i]; + creature_ptr->alignment += creature_ptr->virtues[i]; break; } } for (int i = 0; i < j; i++) { - if (creature_ptr->align > 0) { - creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2; - if (creature_ptr->align < 0) - creature_ptr->align = 0; - } else if (creature_ptr->align < 0) { - creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2; - if (creature_ptr->align > 0) - creature_ptr->align = 0; + if (creature_ptr->alignment > 0) { + creature_ptr->alignment -= creature_ptr->virtues[neutral[i]] / 2; + if (creature_ptr->alignment < 0) + creature_ptr->alignment = 0; + } else if (creature_ptr->alignment < 0) { + creature_ptr->alignment += creature_ptr->virtues[neutral[i]] / 2; + if (creature_ptr->alignment > 0) + creature_ptr->alignment = 0; } } } diff --git a/src/room/space-finder.cpp b/src/room/space-finder.cpp index 723851ce8..95a0dd7b6 100644 --- a/src/room/space-finder.cpp +++ b/src/room/space-finder.cpp @@ -166,7 +166,7 @@ static bool find_space_aux(dun_data_type *dd_ptr, POSITION blocks_high, POSITION * the room calling this function.\n *\n * We allocate space in 11x11 blocks, but want to make sure that rooms\n - * align neatly on the standard screen. Therefore, we make them use\n + * alignment neatly on the standard screen. Therefore, we make them use\n * blocks in few 11x33 rectangles as possible.\n *\n * Be careful to include the edges of the room in height and width!\n diff --git a/src/specific-object/death-scythe.cpp b/src/specific-object/death-scythe.cpp index 6a2033bad..36a8444bd 100644 --- a/src/specific-object/death-scythe.cpp +++ b/src/specific-object/death-scythe.cpp @@ -87,7 +87,7 @@ static int calc_death_scythe_reflection_magnification(player_type *attacker_ptr) */ static void compensate_death_scythe_reflection_magnification(player_type *attacker_ptr, int *magnification, BIT_FLAGS *death_scythe_flags) { - if ((attacker_ptr->align < 0) && (*magnification < 20)) + if ((attacker_ptr->alignment < 0) && (*magnification < 20)) *magnification = 20; if (!(has_resist_acid(attacker_ptr) || is_oppose_acid(attacker_ptr) || has_immune_acid(attacker_ptr)) && (*magnification < 25)) diff --git a/src/spell/spell-info.cpp b/src/spell/spell-info.cpp index c90fcd9fa..dcd6c1d6c 100644 --- a/src/spell/spell-info.cpp +++ b/src/spell/spell-info.cpp @@ -174,18 +174,18 @@ PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_ PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; switch (use_realm) { case REALM_NATURE: - if ((caster_ptr->align > 50) || (caster_ptr->align < -50)) + if ((caster_ptr->alignment > 50) || (caster_ptr->alignment < -50)) chance += penalty; break; case REALM_LIFE: case REALM_CRUSADE: - if (caster_ptr->align < -20) + if (caster_ptr->alignment < -20) chance += penalty; break; case REALM_DEATH: case REALM_DAEMON: case REALM_HEX: - if (caster_ptr->align > 20) + if (caster_ptr->alignment > 20) chance += penalty; break; } diff --git a/src/system/player-type-definition.h b/src/system/player-type-definition.h index d0d918e6d..c1a3d04d9 100644 --- a/src/system/player-type-definition.h +++ b/src/system/player-type-definition.h @@ -301,7 +301,7 @@ typedef struct player_type { bool sutemi{}; bool counter{}; - ALIGNMENT align{}; /* Good/evil/neutral */ + ALIGNMENT alignment{}; /* Good/evil/neutral */ POSITION run_py{}; POSITION run_px{}; DIRECTION fishing_dir{}; diff --git a/src/view/display-player.cpp b/src/view/display-player.cpp index a75ea42d3..bc4dab718 100644 --- a/src/view/display-player.cpp +++ b/src/view/display-player.cpp @@ -135,7 +135,7 @@ static void display_phisique(player_type *creature_ptr) display_player_one_line(ENTRY_SOCIAL, format("%d", (int)creature_ptr->sc), TERM_L_BLUE); #endif std::unique_ptr alignment(new PlayerAlignment(creature_ptr)); - std::string alg = alignment->your_alignment(); + std::string alg = alignment->get_alignment(); display_player_one_line(ENTRY_ALIGN, format("%s", alg.c_str()), TERM_L_BLUE); } @@ -354,11 +354,10 @@ 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_BOW + 1 : INVEN_TOTAL; - for (int i = INVEN_MAIN_HAND; i < max_i; i++) - { - object_type *o_ptr; - o_ptr = &creature_ptr->inventory_list[i]; + int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL; + for (int i = INVEN_MAIN_HAND; i < max_i; i++) { + object_type *o_ptr; + o_ptr = &creature_ptr->inventory_list[i]; TERM_COLOR a = object_attr(o_ptr); SYMBOL_CODE c = object_char(o_ptr); diff --git a/src/view/display-self-info.cpp b/src/view/display-self-info.cpp index 34bc24d02..1c664077c 100644 --- a/src/view/display-self-info.cpp +++ b/src/view/display-self-info.cpp @@ -5,7 +5,6 @@ #include "player-info/self-info-util.h" #include "player/player-race.h" #include "player/player-status-table.h" -#include "player/player-status.h" #include "system/player-type-definition.h" #include "term/screen-processor.h" #include @@ -37,7 +36,7 @@ void display_virtue(player_type *creature_ptr, self_info_type *self_ptr) { self_ptr->info[self_ptr->line++] = ""; std::unique_ptr alignment(new PlayerAlignment(creature_ptr)); - std::string alg = alignment->your_alignment(true); + std::string alg = alignment->get_alignment(true); sprintf(self_ptr->plev_buf, _("現在の属性 : %s", "Your alignment : %s"), alg.c_str()); strcpy(self_ptr->buf[1], self_ptr->plev_buf); self_ptr->info[self_ptr->line++] = self_ptr->buf[1]; diff --git a/src/wizard/wizard-player-modifier.cpp b/src/wizard/wizard-player-modifier.cpp index b197f5cde..8d1967ede 100644 --- a/src/wizard/wizard-player-modifier.cpp +++ b/src/wizard/wizard-player-modifier.cpp @@ -72,7 +72,7 @@ void wizard_player_modifier(player_type *creature_ptr) case '\r': break; case 'a': - msg_format("Your alignment is %d.", creature_ptr->align); + msg_format("Your alignment is %d.", creature_ptr->alignment); break; case 'c': wiz_reset_class(creature_ptr);