From 568120dbcc346c781f73f9b18b0619c519c89066 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 24 Oct 2026 23:20:50 +0300
Subject: [PATCH 50/50] 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 cb90c8a041..54fc970f61 100644
--- a/client/mapview_common.c
+++ b/client/mapview_common.c
@@ -1591,15 +1591,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 = NULL;
 
-    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 != NULL && punit != NULL
-        && punit->id == anim->id) {
-      punit = NULL;
+      if (punit->id == anim->id) {
+        punit = nullptr;
+      }
     }
 
     put_one_element(pcanvas, map_zoom, layer, ptile, NULL, NULL, punit,
-- 
2.53.0

