From d1fcbadedb78ad4fd03f0edde450065f22a9f43d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 10 Apr 2022 06:16:18 +0300 Subject: [PATCH 46/46] ap_dipl_battle_win(): Clip chance to legal range See osdn #44291 Signed-off-by: Marko Lindqvist --- common/actions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/actions.c b/common/actions.c index 923b31cfb7..f46b831dcc 100644 --- a/common/actions.c +++ b/common/actions.c @@ -5408,6 +5408,8 @@ static struct act_prob ap_dipl_battle_win(const struct unit *pattacker, ) / 100; } + chance = CLIP(0, chance, 100); + /* Convert to action probability */ out.min = chance * ACTPROB_VAL_1_PCT; out.max = chance * ACTPROB_VAL_1_PCT; -- 2.35.1