From 7acb88e72ddcf173243b15f1755ece9d68d0e1b5 Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 11 Nov 2020 08:27:02 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40944=20player-status-resist.c=20?= =?utf8?q?=E3=81=AE=20for=E5=86=85=E5=A4=89=E6=95=B0=E5=AE=A3=E8=A8=80?= =?utf8?q?=E3=82=92=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=97=E5=86=85=E3=81=AB?= =?utf8?q?=E7=B4=8D=E3=82=81=E3=82=8B=EF=BC=8E=E3=80=80/=20Put=20the=20var?= =?utf8?q?iable=20declaration=20in=20player-status-resist.c=20into=20for?= =?utf8?q?=20scope.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player/player-status-resist.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/player/player-status-resist.c b/src/player/player-status-resist.c index 9c740d0a8..c9628a880 100644 --- a/src/player/player-status-resist.c +++ b/src/player/player-status-resist.c @@ -63,14 +63,13 @@ PERCENTAGE randrate(int dice, int fix, rate_calc_type_mode mode) PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr) { PERCENTAGE per = 100; - int i; if (has_immune_acid(creature_ptr)) { return 0; } BIT_FLAGS flgs = has_vuln_acid(creature_ptr); - for (i = 0; i < FLAG_CAUSE_MAX; i++) { + for (int i = 0; i < FLAG_CAUSE_MAX; i++) { if (flgs & (0x01 << i)) { if (i == FLAG_CAUSE_MUTATION) { per *= 2; @@ -94,14 +93,13 @@ PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr) PERCENTAGE calc_elec_damage_rate(player_type *creature_ptr) { PERCENTAGE per = 100; - int i; if (has_immune_elec(creature_ptr)) { return 0; } BIT_FLAGS flgs = has_vuln_elec(creature_ptr); - for (i = 0; i < FLAG_CAUSE_MAX; i++) { + for (int i = 0; i < FLAG_CAUSE_MAX; i++) { if (flgs & (0x01 << i)) { if (i == FLAG_CAUSE_MUTATION) { per *= 2; @@ -125,9 +123,8 @@ PERCENTAGE calc_elec_damage_rate(player_type *creature_ptr) PERCENTAGE calc_fire_damage_rate(player_type *creature_ptr) { PERCENTAGE per = 100; - int i; BIT_FLAGS flgs = has_vuln_fire(creature_ptr); - for (i = 0; i < FLAG_CAUSE_MAX; i++) { + for (int i = 0; i < FLAG_CAUSE_MAX; i++) { if (flgs & (0x01 << i)) { if (i == FLAG_CAUSE_MUTATION) { per *= 2; @@ -152,9 +149,8 @@ PERCENTAGE calc_fire_damage_rate(player_type *creature_ptr) PERCENTAGE calc_cold_damage_rate(player_type *creature_ptr) { PERCENTAGE per = 100; - int i; BIT_FLAGS flgs = has_vuln_cold(creature_ptr); - for (i = 0; i < FLAG_CAUSE_MAX; i++) { + for (int i = 0; i < FLAG_CAUSE_MAX; i++) { if (flgs & (0x01 << i)) { if (i == FLAG_CAUSE_MUTATION) { per *= 2; -- 2.11.0