From e9c7ecd63bb3b17a57b4bbdb77a6438995475ff8 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 26 Sep 2026 01:48:41 +0300
Subject: [PATCH 69/69] random_movements(): Use
 select_actres_action_unit_on_tile() for regular move

See RM #2171

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/unittools.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/server/unittools.c b/server/unittools.c
index 2909ce2056..4955657951 100644
--- a/server/unittools.c
+++ b/server/unittools.c
@@ -5155,30 +5155,15 @@ void random_movements(struct player *pplayer)
               if (unit_perform_action(pplayer, id, tile_index(dest), NO_TARGET,
                                       "", act, ACT_REQ_RULES)) {
                 moved = TRUE;
-                break;
               }
             }
 
             if (!moved) {
-              if (is_action_enabled_unit_on_tile(nmap, ACTION_UNIT_MOVE, punit, dest,
-                                                 nullptr)) {
+              act = select_actres_action_unit_on_tile(nmap, ACTRES_UNIT_MOVE,
+                                                      punit, dest);
+              if (act != ACTION_NONE) {
                 if (unit_perform_action(pplayer, id, tile_index(dest),
-                                        NO_TARGET, "", ACTION_UNIT_MOVE,
-                                        ACT_REQ_RULES)) {
-                  moved = TRUE;
-                }
-              } else if (is_action_enabled_unit_on_tile(nmap, ACTION_UNIT_MOVE2,
-                                                        punit, dest, nullptr)) {
-                if (unit_perform_action(pplayer, id, tile_index(dest),
-                                        NO_TARGET, "", ACTION_UNIT_MOVE2,
-                                        ACT_REQ_RULES)) {
-                  moved = TRUE;
-                }
-              } else if (is_action_enabled_unit_on_tile(nmap, ACTION_UNIT_MOVE3,
-                                                        punit, dest, nullptr)) {
-                if (unit_perform_action(pplayer, id, tile_index(dest),
-                                        NO_TARGET, "", ACTION_UNIT_MOVE3,
-                                        ACT_REQ_RULES)) {
+                                        NO_TARGET, "", act, ACT_REQ_RULES)) {
                   moved = TRUE;
                 }
               }
-- 
2.53.0

