From 246f5c2a3c74c52e6f8c9997b14b4b50dbe8018d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 10 Jan 2022 05:50:54 +0200 Subject: [PATCH 42/42] Apply Move_Bonus correctly to a unit with base move rate less than min_speed If unit's base move rate is less than class min_speed, any modified move rate less than min_speed was set to that base move rate. That was applied even when the modification was a positive one. Reported by Dino the Dinosore See osdn #43587 Signed-off-by: Marko Lindqvist --- common/movement.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/movement.c b/common/movement.c index 81b8404544..8a00f0b881 100644 --- a/common/movement.c +++ b/common/movement.c @@ -51,6 +51,7 @@ int utype_move_rate(const struct unit_type *utype, const struct tile *ptile, const struct unit_class *uclass; const struct veteran_level *vlevel; int base_move_rate, move_rate; + int min_speed; fc_assert_ret_val(NULL != utype, 0); fc_assert_ret_val(NULL != pplayer, 0); @@ -74,8 +75,9 @@ int utype_move_rate(const struct unit_type *utype, const struct tile *ptile, /* Don't let the move_rate be less than min_speed unless the base_move_rate is * also less than min_speed. */ - if (move_rate < uclass->min_speed) { - move_rate = MIN(uclass->min_speed, base_move_rate); + min_speed = MIN(uclass->min_speed, base_move_rate); + if (move_rate < min_speed) { + move_rate = min_speed; } return move_rate; -- 2.34.1