From e63616c927668804c3380e822b543502d5281f1a Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 1 May 2022 15:37:57 +0300
Subject: [PATCH 57/57] Fix entering huts when on goto

Reported by jdlh

See osdn #42133

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/unithand.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/server/unithand.c b/server/unithand.c
index 8afd40a564..72750e4def 100644
--- a/server/unithand.c
+++ b/server/unithand.c
@@ -5487,6 +5487,30 @@ bool unit_move_handling(struct unit *punit, struct tile *pdesttile,
     return unit_perform_action(pplayer, punit->id, tile_index(pdesttile),
                                NO_TARGET, "", ACTION_TRANSPORT_DISEMBARK4,
                                ACT_REQ_PLAYER);
+  } else if (is_action_enabled_unit_on_tile(ACTION_HUT_ENTER,
+                                            punit, pdesttile, NULL)) {
+    /* "Enter Hut". */
+    return unit_perform_action(pplayer, punit->id, tile_index(pdesttile),
+                               NO_TARGET, "", ACTION_HUT_ENTER,
+                               ACT_REQ_PLAYER);
+  } else if (is_action_enabled_unit_on_tile(ACTION_HUT_ENTER2,
+                                            punit, pdesttile, NULL)) {
+    /* "Enter Hut 2". */
+    return unit_perform_action(pplayer, punit->id, tile_index(pdesttile),
+                               NO_TARGET, "", ACTION_HUT_ENTER2,
+                               ACT_REQ_PLAYER);
+  } else if (is_action_enabled_unit_on_tile(ACTION_HUT_FRIGHTEN,
+                                            punit, pdesttile, NULL)) {
+    /* "Frighten Hut". */
+    return unit_perform_action(pplayer, punit->id, tile_index(pdesttile),
+                               NO_TARGET, "", ACTION_HUT_FRIGHTEN,
+                               ACT_REQ_PLAYER);
+  } else if (is_action_enabled_unit_on_tile(ACTION_HUT_FRIGHTEN2,
+                                            punit, pdesttile, NULL)) {
+    /* "Frighten Hut 2". */
+    return unit_perform_action(pplayer, punit->id, tile_index(pdesttile),
+                               NO_TARGET, "", ACTION_HUT_FRIGHTEN2,
+                               ACT_REQ_PLAYER);
   } else {
     /* TODO: Extend the action not enabled explanation system to cover all
      * existing reasons and switch to using it. See hrm Feature #920229 */
-- 
2.35.1