From a96f6fdba873b7ee8aa8bae8a7c3288cdbc5fb08 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 23 Sep 2026 22:34:13 +0300
Subject: [PATCH 66/66] infracache.c: Replace NULL with nullptr

See RM #2282

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/advisors/infracache.c | 64 ++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/server/advisors/infracache.c b/server/advisors/infracache.c
index 6595753592..77b9243b8c 100644
--- a/server/advisors/infracache.c
+++ b/server/advisors/infracache.c
@@ -65,7 +65,7 @@ static adv_want adv_calc_cultivate(const struct city *pcity,
   adv_want goodness;
   struct terrain *old_terrain, *new_terrain;
 
-  fc_assert_ret_val(ptile != NULL, -1);
+  fc_assert_ret_val(ptile != nullptr, -1);
 
   old_terrain = tile_terrain(ptile);
   new_terrain = old_terrain->cultivate_result;
@@ -78,7 +78,7 @@ static adv_want adv_calc_cultivate(const struct city *pcity,
       return -1;
     }
     /* Irrigation would change the terrain type, clearing conflicting
-     * extras in the process.  Calculate the benefit of doing so. */
+     * extras in the process. Calculate the benefit of doing so. */
     vtile = tile_virtual_new(ptile);
 
     tile_change_terrain(vtile, new_terrain);
@@ -105,7 +105,7 @@ static adv_want adv_calc_plant(const struct city *pcity,
   adv_want goodness;
   struct terrain *old_terrain, *new_terrain;
 
-  fc_assert_ret_val(ptile != NULL, -1);
+  fc_assert_ret_val(ptile != nullptr, -1);
 
   old_terrain = tile_terrain(ptile);
   new_terrain = old_terrain->plant_result;
@@ -118,7 +118,7 @@ static adv_want adv_calc_plant(const struct city *pcity,
       return -1;
     }
     /* Mining would change the terrain type, clearing conflicting
-     * extras in the process.  Calculate the benefit of doing so. */
+     * extras in the process. Calculate the benefit of doing so. */
     vtile = tile_virtual_new(ptile);
 
     tile_change_terrain(vtile, new_terrain);
@@ -147,7 +147,7 @@ static adv_want adv_calc_transform(const struct city *pcity,
   struct terrain *old_terrain, *new_terrain;
   const struct civ_map *nmap = &(wld.map);
 
-  fc_assert_ret_val(ptile != NULL, -1);
+  fc_assert_ret_val(ptile != nullptr, -1);
 
   old_terrain = tile_terrain(ptile);
   new_terrain = old_terrain->transform_result;
@@ -191,7 +191,7 @@ static adv_want adv_calc_extra(const struct city *pcity,
 {
   adv_want goodness = -1;
 
-  fc_assert_ret_val(ptile != NULL, -1);
+  fc_assert_ret_val(ptile != nullptr, -1);
 
   if (player_can_build_extra(pextra, city_owner(pcity), ptile)) {
     struct tile *vtile = tile_virtual_new(ptile);
@@ -226,7 +226,7 @@ static adv_want adv_calc_rmextra(const struct city *pcity,
 {
   adv_want goodness = -1;
 
-  fc_assert_ret_val(ptile != NULL, -1);
+  fc_assert_ret_val(ptile != nullptr, -1);
 
   if (player_can_remove_extra(pextra, city_owner(pcity), ptile)) {
     struct tile *vtile = tile_virtual_new(ptile);
@@ -343,9 +343,9 @@ void adv_city_worker_act_set(struct city *pcity, int city_tile_index,
     adv_city_update(pcity);
   }
 
-  fc_assert_ret(NULL != pcity);
-  fc_assert_ret(NULL != pcity->server.adv);
-  fc_assert_ret(NULL != pcity->server.adv->act_cache);
+  fc_assert_ret(pcity != nullptr);
+  fc_assert_ret(pcity->server.adv != nullptr);
+  fc_assert_ret(pcity->server.adv->act_cache != nullptr);
   fc_assert_ret(pcity->server.adv->act_cache_radius_sq
                 == city_map_radius_sq_get(pcity));
   fc_assert_ret(city_tile_index < city_map_tiles_from_city(pcity));
@@ -361,9 +361,9 @@ adv_want adv_city_worker_act_get(const struct city *pcity,
                                  int city_tile_index,
                                  enum unit_activity act_id)
 {
-  fc_assert_ret_val(NULL != pcity, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv->act_cache, 0);
+  fc_assert_ret_val(pcity != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv->act_cache != nullptr, 0);
   fc_assert_ret_val(pcity->server.adv->act_cache_radius_sq
                      == city_map_radius_sq_get(pcity), 0);
   fc_assert_ret_val(city_tile_index < city_map_tiles_from_city(pcity), 0);
@@ -387,9 +387,9 @@ void adv_city_worker_extra_set(struct city *pcity, int city_tile_index,
     adv_city_update(pcity);
   }
 
-  fc_assert_ret(NULL != pcity);
-  fc_assert_ret(NULL != pcity->server.adv);
-  fc_assert_ret(NULL != pcity->server.adv->act_cache);
+  fc_assert_ret(pcity != nullptr);
+  fc_assert_ret(pcity->server.adv != nullptr);
+  fc_assert_ret(pcity->server.adv->act_cache != nullptr);
   fc_assert_ret(pcity->server.adv->act_cache_radius_sq
                 == city_map_radius_sq_get(pcity));
   fc_assert_ret(city_tile_index < city_map_tiles_from_city(pcity));
@@ -413,9 +413,9 @@ void adv_city_worker_rmextra_set(struct city *pcity, int city_tile_index,
     adv_city_update(pcity);
   }
 
-  fc_assert_ret(NULL != pcity);
-  fc_assert_ret(NULL != pcity->server.adv);
-  fc_assert_ret(NULL != pcity->server.adv->act_cache);
+  fc_assert_ret(pcity != nullptr);
+  fc_assert_ret(pcity->server.adv != nullptr);
+  fc_assert_ret(pcity->server.adv->act_cache != nullptr);
   fc_assert_ret(pcity->server.adv->act_cache_radius_sq
                 == city_map_radius_sq_get(pcity));
   fc_assert_ret(city_tile_index < city_map_tiles_from_city(pcity));
@@ -430,9 +430,9 @@ void adv_city_worker_rmextra_set(struct city *pcity, int city_tile_index,
 int adv_city_worker_extra_get(const struct city *pcity, int city_tile_index,
                               const struct extra_type *pextra)
 {
-  fc_assert_ret_val(NULL != pcity, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv->act_cache, 0);
+  fc_assert_ret_val(pcity != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv->act_cache != nullptr, 0);
   fc_assert_ret_val(pcity->server.adv->act_cache_radius_sq
                      == city_map_radius_sq_get(pcity), 0);
   fc_assert_ret_val(city_tile_index < city_map_tiles_from_city(pcity), 0);
@@ -447,9 +447,9 @@ int adv_city_worker_extra_get(const struct city *pcity, int city_tile_index,
 int adv_city_worker_rmextra_get(const struct city *pcity, int city_tile_index,
                                 const struct extra_type *pextra)
 {
-  fc_assert_ret_val(NULL != pcity, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv, 0);
-  fc_assert_ret_val(NULL != pcity->server.adv->act_cache, 0);
+  fc_assert_ret_val(pcity != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv != nullptr, 0);
+  fc_assert_ret_val(pcity->server.adv->act_cache != nullptr, 0);
   fc_assert_ret_val(pcity->server.adv->act_cache_radius_sq
                      == city_map_radius_sq_get(pcity), 0);
   fc_assert_ret_val(city_tile_index < city_map_tiles_from_city(pcity), 0);
@@ -464,18 +464,18 @@ void adv_city_update(struct city *pcity)
 {
   int radius_sq = city_map_radius_sq_get(pcity);
 
-  fc_assert_ret(NULL != pcity);
-  fc_assert_ret(NULL != pcity->server.adv);
+  fc_assert_ret(pcity != nullptr);
+  fc_assert_ret(pcity->server.adv != nullptr);
 
-  /* initialize act_cache if needed */
-  if (pcity->server.adv->act_cache == NULL
+  /* Initialize act_cache if needed */
+  if (pcity->server.adv->act_cache == nullptr
       || pcity->server.adv->act_cache_radius_sq == -1
       || pcity->server.adv->act_cache_radius_sq != radius_sq) {
     pcity->server.adv->act_cache
       = fc_realloc(pcity->server.adv->act_cache,
                    city_map_tiles(radius_sq)
                    * sizeof(*(pcity->server.adv->act_cache)));
-    /* initialize with 0 */
+    /* Initialize with 0 */
     memset(pcity->server.adv->act_cache, 0,
            city_map_tiles(radius_sq)
            * sizeof(*(pcity->server.adv->act_cache)));
@@ -490,7 +490,7 @@ void adv_city_alloc(struct city *pcity)
 {
   pcity->server.adv = fc_calloc(1, sizeof(*pcity->server.adv));
 
-  pcity->server.adv->act_cache = NULL;
+  pcity->server.adv->act_cache = nullptr;
   pcity->server.adv->act_cache_radius_sq = -1;
   /* Allocate memory for pcity->ai->act_cache */
   adv_city_update(pcity);
@@ -501,7 +501,7 @@ void adv_city_alloc(struct city *pcity)
 **************************************************************************/
 void adv_city_free(struct city *pcity)
 {
-  fc_assert_ret(NULL != pcity);
+  fc_assert_ret(pcity != nullptr);
 
   if (pcity->server.adv) {
     if (pcity->server.adv->act_cache) {
-- 
2.53.0

