From e6889c95914a62cd9e4402605389722f52610b5e Mon Sep 17 00:00:00 2001 From: Hilde Iren Lagnason Bye Date: Wed, 31 Mar 2021 12:10:57 +0200 Subject: [PATCH] Run action_dice_roll_odds() only when relevant. The function action_prob_pre_action_dice_roll() will only use the result of is_effect_val_known() when the value of EFT_ACTION_ODDS_PCT is known. See osdn #41928 --- common/actions.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/actions.c b/common/actions.c index 8670a3efd7..07652e29db 100644 --- a/common/actions.c +++ b/common/actions.c @@ -5344,14 +5344,14 @@ action_prob_pre_action_dice_roll(const struct player *act_player, const struct player *tgt_player, const struct action *paction) { - int unconverted = action_dice_roll_odds(act_player, act_unit, tgt_city, - tgt_player, paction); - struct act_prob result = { .min = unconverted * ACTPROB_VAL_1_PCT, - .max = unconverted * ACTPROB_VAL_1_PCT }; - if (is_effect_val_known(EFT_ACTION_ODDS_PCT, act_player, tgt_player, tgt_player, tgt_city, NULL, NULL, act_unit, NULL, NULL)) { + int unconverted = action_dice_roll_odds(act_player, act_unit, tgt_city, + tgt_player, paction); + struct act_prob result = { .min = unconverted * ACTPROB_VAL_1_PCT, + .max = unconverted * ACTPROB_VAL_1_PCT }; + return result; } else { /* Could be improved to return a more exact probability in some cases. -- 2.30.2