From de820892b96561875ab056d37bc79497acda9e86 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 24 Oct 2026 23:20:50 +0300
Subject: [PATCH 90/90] Refactor put_one_tile()

Don't bother with animations at all, if punit is nullptr.
Moved separate if() block inside existing block where, and only where,
the condition is known to be true.

See RM #2413

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/mapview_common.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/client/mapview_common.c b/client/mapview_common.c
index a3911be7ef..f7425136f6 100644
--- a/client/mapview_common.c
+++ b/client/mapview_common.c
@@ -1601,15 +1601,13 @@ static void put_one_tile(struct canvas *pcanvas, enum mapview_layer layer,
   if (client_tile_get_known(ptile) != TILE_UNKNOWN
       || (editor_is_active() && editor_tile_is_selected(ptile))) {
     struct unit *punit = get_drawable_unit(tileset, ptile, citymode);
-    struct animation *anim = nullptr;
 
-    if (animation_list_size(animations) > 0) {
-      anim = animation_list_get(animations, 0);
-    }
+    if (punit != nullptr && animation_list_size(animations) > 0) {
+      struct animation *anim = animation_list_get(animations, 0);
 
-    if (anim != nullptr && punit != nullptr
-        && punit->id == anim->id) {
-      punit = nullptr;
+      if (punit->id == anim->id) {
+        punit = nullptr;
+      }
     }
 
     put_one_element(pcanvas, map_zoom, layer, ptile, nullptr, nullptr, punit,
-- 
2.53.0

