From b275c82f12f619bee256cd2a4f3694b77d31ca11 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 10 Oct 2026 19:18:08 +0300
Subject: [PATCH 87/87] daisettler.c: Replace NULL with nullptr

See RM #2354

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/daisettler.c | 206 ++++++++++++++++++++--------------------
 1 file changed, 104 insertions(+), 102 deletions(-)

diff --git a/ai/default/daisettler.c b/ai/default/daisettler.c
index 03eef4ec7b..3ac6646ed4 100644
--- a/ai/default/daisettler.c
+++ b/ai/default/daisettler.c
@@ -225,7 +225,7 @@ static struct cityresult *cityresult_new(struct tile *ptile)
 {
   struct cityresult *result;
 
-  fc_assert_ret_val(ptile != NULL, NULL);
+  fc_assert_ret_val(ptile != nullptr, nullptr);
 
   result = fc_calloc(1, sizeof(*result));
   result->tile = ptile;
@@ -237,11 +237,11 @@ static struct cityresult *cityresult_new(struct tile *ptile)
   result->virt_boat = FALSE;
 
   /* City centre */
-  result->city_center.tdc = NULL;
+  result->city_center.tdc = nullptr;
 
   /* First worked tile */
-  result->best_other.tile = NULL;
-  result->best_other.tdc = NULL;
+  result->best_other.tile = nullptr;
+  result->best_other.tdc = nullptr;
   result->best_other.cindex = 0;
 
   result->remaining = 0;
@@ -256,8 +256,8 @@ static struct cityresult *cityresult_new(struct tile *ptile)
 *****************************************************************************/
 static void cityresult_destroy(struct cityresult *result)
 {
-  if (result != NULL) {
-    if (result->tdc_hash != NULL) {
+  if (result != nullptr) {
+    if (result->tdc_hash != nullptr) {
       tile_data_cache_hash_destroy(result->tdc_hash);
     }
     free(result);
@@ -278,23 +278,23 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
 {
   struct city *pcity = tile_city(center);
   struct government *curr_govt = government_of_player(pplayer);
-  struct player *saved_owner = NULL;
-  struct tile *saved_claimer = NULL;
+  struct player *saved_owner = nullptr;
+  struct tile *saved_claimer = nullptr;
   bool virtual_city = FALSE;
   bool handicap = has_handicap(pplayer, H_MAP);
-  struct adv_data *adv = adv_data_get(pplayer, NULL);
+  struct adv_data *adv = adv_data_get(pplayer, nullptr);
   struct cityresult *result;
   const struct civ_map *nmap = &(wld.map);
 
-  fc_assert_ret_val(adv != NULL, NULL);
-  fc_assert_ret_val(center != NULL, NULL);
+  fc_assert_ret_val(adv != nullptr, nullptr);
+  fc_assert_ret_val(center != nullptr, nullptr);
 
   pplayer->government = adv->goal.govt.gov;
 
   /* Create a city result and set default values. */
   result = cityresult_new(center);
 
-  if (pcity == NULL) {
+  if (pcity == nullptr) {
     pcity = create_city_virtual(pplayer, result->tile, "Virtuaville");
     saved_owner = tile_owner(result->tile);
     saved_claimer = tile_claimer(result->tile);
@@ -314,7 +314,7 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
 
     if (reserved < 0
         || (handicap && !map_is_known(ptile, pplayer))
-        || tile_worked(ptile) != NULL) {
+        || tile_worked(ptile) != nullptr) {
       /* Tile is reserved or we can't see it */
       ptdc = tile_data_cache_new();
       ptdc->shield = 0;
@@ -396,18 +396,18 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
   } city_tile_iterate_index_end;
 
   /* We need a city center. */
-  if (result->city_center.tdc == NULL) {
-    fc_assert(result->city_center.tdc != NULL);
+  if (result->city_center.tdc == nullptr) {
+    fc_assert(result->city_center.tdc != nullptr);
 
-    return NULL;
+    return nullptr;
   }
 
   if (virtual_city) {
     /* Baseline is a size one city (city center + best extra tile). */
     result->total = result->city_center.tdc->sum
-                    + (result->best_other.tdc != NULL
+                    + (result->best_other.tdc != nullptr
                        ? result->best_other.tdc->sum : 0);
-  } else if (result->best_other.tdc != NULL) {
+  } else if (result->best_other.tdc != nullptr) {
     /* Baseline is best extra tile only. This is why making new cities
      * is so darn good. */
     result->total = result->best_other.tdc->sum;
@@ -426,13 +426,13 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
     int shield = result->city_center.tdc->shield
                  + result->best_other.tdc->shield;
     result->waste = adv->shield_priority
-                    * city_waste(pcity, O_SHIELD, shield, NULL);
+                    * city_waste(pcity, O_SHIELD, shield, nullptr);
 
     if (game.info.fulltradesize == 1) {
       int trade = result->city_center.tdc->trade
                   + result->best_other.tdc->trade;
       result->corruption = adv->science_priority
-                           * city_waste(pcity, O_TRADE, trade, NULL);
+                           * city_waste(pcity, O_TRADE, trade, nullptr);
     } else {
       result->corruption = 0;
     }
@@ -441,10 +441,10 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
      * is possible (with notradesize) that we _gain_ value here. */
     city_size_add(pcity, 1);
     result->corruption = adv->science_priority
-      * (city_waste(pcity, O_TRADE, result->best_other.tdc->trade, NULL)
+      * (city_waste(pcity, O_TRADE, result->best_other.tdc->trade, nullptr)
          - pcity->waste[O_TRADE]);
     result->waste = adv->shield_priority
-      * (city_waste(pcity, O_SHIELD, result->best_other.tdc->shield, NULL)
+      * (city_waste(pcity, O_SHIELD, result->best_other.tdc->shield, nullptr)
          - pcity->waste[O_SHIELD]);
     city_size_add(pcity, -1);
   }
@@ -458,8 +458,8 @@ static struct cityresult *cityresult_fill(struct ai_type *ait,
     tile_set_owner(result->tile, saved_owner, saved_claimer);
   }
 
-  fc_assert_ret_val(result->city_center.tdc->sum >= 0, NULL);
-  fc_assert_ret_val(result->remaining >= 0, NULL);
+  fc_assert_ret_val(result->city_center.tdc->sum >= 0, nullptr);
+  fc_assert_ret_val(result->remaining >= 0, nullptr);
 
   return result;
 }
@@ -485,7 +485,7 @@ struct tile_data_cache *
 {
   struct tile_data_cache *ptdc_copy = tile_data_cache_new();
 
-  fc_assert_ret_val(ptdc, NULL);
+  fc_assert_ret_val(ptdc, nullptr);
 
   ptdc_copy->shield = ptdc->shield;
   ptdc_copy->trade = ptdc->trade;
@@ -503,7 +503,7 @@ struct tile_data_cache *
 *****************************************************************************/
 static void tile_data_cache_destroy(struct tile_data_cache *ptdc)
 {
-  if (ptdc != NULL) {
+  if (ptdc != nullptr) {
     free(ptdc);
   }
 }
@@ -515,26 +515,25 @@ static const struct tile_data_cache *tdc_plr_get(struct ai_type *ait,
                                                  struct player *plr,
                                                  int tindex)
 {
-  struct ai_plr *ai = dai_plr_data_get(ait, plr, NULL);
-
-  fc_assert_ret_val(ai != NULL, NULL);
-  fc_assert_ret_val(ai->settler != NULL, NULL);
-  fc_assert_ret_val(ai->settler->tdc_hash != NULL, NULL);
-
+  struct ai_plr *ai = dai_plr_data_get(ait, plr, nullptr);
   struct tile_data_cache *ptdc;
 
+  fc_assert_ret_val(ai != nullptr, nullptr);
+  fc_assert_ret_val(ai->settler != nullptr, nullptr);
+  fc_assert_ret_val(ai->settler->tdc_hash != nullptr, nullptr);
+
   tile_data_cache_hash_lookup(ai->settler->tdc_hash, tindex, &ptdc);
 
   if (!ptdc) {
 #ifdef FREECIV_DEBUG
     ai->settler->cache.miss++;
 #endif /* FREECIV_DEBUG */
-    return NULL;
+    return nullptr;
   } else if (ptdc->turn != game.info.turn) {
 #ifdef FREECIV_DEBUG
     ai->settler->cache.old++;
 #endif /* FREECIV_DEBUG */
-    return NULL;
+    return nullptr;
   } else {
 #ifdef FREECIV_DEBUG
     ai->settler->cache.hit++;
@@ -549,12 +548,12 @@ static const struct tile_data_cache *tdc_plr_get(struct ai_type *ait,
 static void tdc_plr_set(struct ai_type *ait, struct player *plr, int tindex,
                         const struct tile_data_cache *ptdc)
 {
-  struct ai_plr *ai = dai_plr_data_get(ait, plr, NULL);
+  struct ai_plr *ai = dai_plr_data_get(ait, plr, nullptr);
 
-  fc_assert_ret(ai != NULL);
-  fc_assert_ret(ai->settler != NULL);
-  fc_assert_ret(ai->settler->tdc_hash != NULL);
-  fc_assert_ret(ptdc != NULL);
+  fc_assert_ret(ai != nullptr);
+  fc_assert_ret(ai->settler != nullptr);
+  fc_assert_ret(ai->settler->tdc_hash != nullptr);
+  fc_assert_ret(ptdc != nullptr);
 
 #ifdef FREECIV_DEBUG
     ai->settler->cache.save++;
@@ -604,7 +603,7 @@ static adv_want result_defense_bonus(struct player *pplayer,
   struct city *vcity = create_city_virtual(pplayer, vtile, "");
 
   tile_set_worked(vtile, vcity); /* Link tile_city(vtile) to vcity. */
-  upgrade_city_extras(vcity, NULL); /* Give city free extras. */
+  upgrade_city_extras(vcity, nullptr); /* Give city free extras. */
   extra_type_iterate(pextra) {
     if (tile_has_extra(vtile, pextra)) {
       /* TODO: Do not use full bonus of those road types
@@ -645,7 +644,7 @@ static void print_cityresult(struct player *pplayer,
   int tiles = city_map_tiles(cr->city_radius_sq);
   struct tile_data_cache *ptdc;
 
-  fc_assert_ret(cr->tdc_hash != NULL);
+  fc_assert_ret(cr->tdc_hash != nullptr);
   fc_assert_ret(tiles > 0);
 
   city_map_reserved = fc_calloc(tiles, sizeof(*city_map_reserved));
@@ -707,62 +706,62 @@ static void print_cityresult(struct player *pplayer,
 
 /*************************************************************************//**
   Calculates the desire for founding a new city at 'ptile'. The citymap
-  ensures that we do not build cities too close to each other. Returns NULL
-  if no place was found.
+  ensures that we do not build cities too close to each other.
+  Returns nullptr if no place was found.
 *****************************************************************************/
 struct cityresult *city_desirability(struct ai_type *ait, struct player *pplayer,
                                      struct unit *punit, struct tile *ptile)
 {
   struct city *pcity = tile_city(ptile);
-  struct cityresult *cr = NULL;
+  struct cityresult *cr = nullptr;
   const struct civ_map *nmap = &(wld.map);
 
-  fc_assert_ret_val(punit, NULL);
-  fc_assert_ret_val(pplayer, NULL);
+  fc_assert_ret_val(punit, nullptr);
+  fc_assert_ret_val(pplayer, nullptr);
 
   if (!city_can_be_built_here(nmap, ptile, punit, FALSE)
       || (has_handicap(pplayer, H_MAP)
           && !map_is_known(ptile, pplayer))) {
-    return NULL;
+    return nullptr;
   }
 
   /* Check if another settler has taken a spot within mindist */
   square_iterate(&(wld.map), ptile, game.info.citymindist-1, tile1) {
     if (citymap_is_reserved(tile1)) {
-      return NULL;
+      return nullptr;
     }
   } square_iterate_end;
 
   if (adv_danger_at(punit, ptile)) {
-    return NULL;
+    return nullptr;
   }
 
   if (pcity && (city_size_get(pcity) + unit_pop_value(punit)
                 > game.info.add_to_size_limit)) {
     /* Can't exceed population limit. */
-    return NULL;
+    return nullptr;
   }
 
   if (!pcity && citymap_is_reserved(ptile)) {
-    return NULL; /* reserved, go away */
+    return nullptr; /* Reserved, go away */
   }
 
   /* If (x, y) is an existing city, consider immigration */
   if (pcity && city_owner(pcity) == pplayer) {
-    return NULL;
+    return nullptr;
   }
 
   cr = cityresult_fill(ait, pplayer, ptile); /* Burn CPU, burn! */
   if (!cr) {
     /* Failed to find a good spot */
-    return NULL;
+    return nullptr;
   }
 
   /*** Alright: Now consider building a new city ***/
 
   if (food_starvation(cr) || shield_starvation(cr)) {
     cityresult_destroy(cr);
-    return NULL;
+    return nullptr;
   }
 
   cr->total += result_defense_bonus(pplayer, cr);
@@ -771,7 +770,7 @@ struct cityresult *city_desirability(struct ai_type *ait, struct player *pplayer
   /* Add remaining points, which is our potential */
   cr->total += cr->remaining;
 
-  fc_assert_ret_val(cr->total >= 0, NULL); /* Does not free cr! */
+  fc_assert_ret_val(cr->total >= 0, nullptr); /* Does not free cr! */
 
   return cr;
 }
@@ -783,7 +782,7 @@ struct cityresult *city_desirability(struct ai_type *ait, struct player *pplayer
   The result is returned in "best".
 
   Return value is a 'struct cityresult' if found something better than what
-  was originally in "best" was found; else NULL.
+  was originally in "best" was found; else nullptr.
 
   TODO: Transparently check if we should add ourselves to an existing city.
 *****************************************************************************/
@@ -792,7 +791,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
                                               struct unit *punit,
                                               int boat_cost)
 {
-  struct cityresult *cr = NULL, *best = NULL;
+  struct cityresult *cr = nullptr, *best = nullptr;
   int best_turn = 0; /* Which turn we found the best fit */
   struct player *pplayer = unit_owner(punit);
   struct pf_map *pfm;
@@ -813,7 +812,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
     if (BORDERS_DISABLED != game.info.borders) {
       struct player *powner = tile_owner(ptile);
 
-      if (NULL != powner
+      if (powner != nullptr
           && powner != pplayer
           && pplayers_in_peace(powner, pplayer)) {
         /* Land theft does not make for good neighbors. */
@@ -825,7 +824,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
     cr = city_desirability(ait, pplayer, punit, ptile);
 
     /* Check if actually found something */
-    if (cr == NULL) {
+    if (cr == nullptr) {
       continue;
     }
 
@@ -847,7 +846,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
       cityresult_destroy(best);
       /* Save the new 'best' value. */
       best = cr;
-      cr = NULL;
+      cr = nullptr;
       best_turn = turns;
 
       log_debug("settler map search (search): (%d, %d) " ADV_WANT_PRINTF,
@@ -855,7 +854,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
     } else {
       /* Destroy the unused result. */
       cityresult_destroy(cr);
-      cr = NULL;
+      cr = nullptr;
     }
 
     /* Can we terminate early? We have a 'good enough' spot, and
@@ -891,7 +890,7 @@ static struct cityresult *settler_map_iterate(struct ai_type *ait,
   If (!look_for_boat && !use_virt_boat), will not consider placements
   overseas.
 
-  Returns the better cityresult or NULL if no result was found.
+  Returns the better cityresult or nullptr if no result was found.
 *****************************************************************************/
 static struct cityresult *find_best_city_placement(struct ai_type *ait,
                                                    struct unit *punit,
@@ -900,13 +899,13 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
 {
   struct pf_parameter parameter;
   struct player *pplayer = unit_owner(punit);
-  struct unit *ferry = NULL;
-  struct cityresult *cr1 = NULL, *cr2 = NULL;
+  struct unit *ferry = nullptr;
+  struct cityresult *cr1 = nullptr, *cr2 = nullptr;
   const struct civ_map *nmap = &(wld.map);
 
-  fc_assert_ret_val(is_ai(pplayer), NULL);
+  fc_assert_ret_val(is_ai(pplayer), nullptr);
   /* Only virtual units may use virtual boats: */
-  fc_assert_ret_val(0 == punit->id || !use_virt_boat, NULL);
+  fc_assert_ret_val(0 == punit->id || !use_virt_boat, nullptr);
 
   /* Phase 1: Consider building cities on our continent */
 
@@ -922,7 +921,7 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
   /* Phase 2: Consider travelling to another continent */
 
   if (look_for_boat) {
-    int ferry_id = aiferry_find_boat(ait, punit, 1, NULL);
+    int ferry_id = aiferry_find_boat(ait, punit, 1, nullptr);
 
     ferry = game_unit_by_number(ferry_id);
   }
@@ -936,11 +935,11 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
       struct unit_type *boattype
         = best_role_unit_for_player(pplayer, L_FERRYBOAT);
 
-      if (boattype == NULL) {
+      if (boattype == nullptr) {
         /* Sea travel not possible yet. Bump tech want for ferries. */
         boattype = get_role_unit(L_FERRYBOAT, 0);
 
-        if (NULL != boattype) {
+        if (boattype != nullptr) {
           struct ai_plr *plr_data = def_ai_player_data(pplayer, ait);
 
           unit_tech_reqs_iterate(boattype, padv) {
@@ -956,7 +955,7 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
         /* Return the result from the search on our current continent */
         return cr1;
       }
-      ferry = unit_virtual_create(pplayer, NULL, boattype, 0);
+      ferry = unit_virtual_create(pplayer, nullptr, boattype, 0);
       unit_tile_set(ferry, unit_tile(punit));
     }
 
@@ -982,8 +981,8 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
 
     /* If we use a virtual boat, we must have permission and be emigrating: */
     /* FIXME: These assert do not free cr2! */
-    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || use_virt_boat), NULL);
-    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || cr2->overseas), NULL);
+    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || use_virt_boat), nullptr);
+    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || cr2->overseas), nullptr);
   }
 
   if (!cr1) {
@@ -1012,8 +1011,8 @@ static struct cityresult *find_best_city_placement(struct ai_type *ait,
 *****************************************************************************/
 void dai_auto_settler_init(struct ai_plr *ai)
 {
-  fc_assert_ret(ai != NULL);
-  fc_assert_ret(ai->settler == NULL);
+  fc_assert_ret(ai != nullptr);
+  fc_assert_ret(ai->settler == nullptr);
 
   ai->settler = fc_calloc(1, sizeof(*ai->settler));
   ai->settler->tdc_hash = tile_data_cache_hash_new();
@@ -1036,9 +1035,9 @@ void dai_auto_settler_run(struct ai_type *ait, const struct civ_map *nmap,
   adv_want best_impr = 0; /* Value of best terrain improvement we can do */
   enum unit_activity best_act;
   struct extra_type *best_target;
-  struct tile *best_tile = NULL;
-  struct pf_path *path = NULL;
-  struct city *pcity = NULL;
+  struct tile *best_tile = nullptr;
+  struct pf_path *path = nullptr;
+  struct city *pcity = nullptr;
 
   /* Time it will take worker to complete its given task */
   int completion_time = 0;
@@ -1056,15 +1055,15 @@ BUILD_CITY:
     /* Check that the mission is still possible. If the tile has become
      * unavailable, call it off. */
     if (!city_can_be_built_here(nmap, ptile, punit, FALSE)) {
-      dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
+      dai_unit_new_task(ait, punit, AIUNIT_NONE, nullptr);
       set_unit_activity(punit, ACTIVITY_IDLE, ACTION_NONE);
-      send_unit_info(NULL, punit);
+      send_unit_info(nullptr, punit);
 
       return; /* Avoid recursion at all cost */
     } else {
      /* Go there */
       if ((!dai_gothere(ait, pplayer, punit, ptile)
-           && NULL == game_unit_by_number(sanity))
+           && game_unit_by_number(sanity) == nullptr)
           || punit->moves_left <= 0) {
         return;
       }
@@ -1074,7 +1073,7 @@ BUILD_CITY:
         if (elevel != CBE_OK) {
           UNIT_LOG(LOG_DEBUG, punit, "could not make city on %s",
                    tile_get_info_text(unit_tile(punit), TRUE, 0));
-          dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
+          dai_unit_new_task(ait, punit, AIUNIT_NONE, nullptr);
 
           if (elevel == CBE_RECOVERABLE) {
             /* Only known way to end in here is that hut turned in to a city
@@ -1089,7 +1088,7 @@ BUILD_CITY:
         }
       } else {
         UNIT_LOG(LOG_DEBUG, punit, "could not go to target");
-        /* dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL); */
+        /* dai_unit_new_task(ait, punit, AIUNIT_NONE, nullptr); */
         return;
       }
     }
@@ -1105,23 +1104,23 @@ BUILD_CITY:
     /* Have nearby cities requests? */
     pcity = worker_evaluate_city_requests(punit, &best_task, &path, state);
 
-    if (pcity != NULL) {
-      if (path != NULL) {
+    if (pcity != nullptr) {
+      if (path != nullptr) {
         completion_time = pf_path_last_position(path)->turn;
         best_impr = 1;
         best_act = best_task->act;
         best_target = best_task->tgt;
         best_tile = best_task->ptile;
       } else {
-        pcity = NULL;
+        pcity = nullptr;
       }
     }
 
-    if (pcity == NULL) {
+    if (pcity == nullptr) {
       best_impr = worker_evaluate_improvements(nmap, punit,
                                                &best_act, &best_target,
                                                &best_tile, &path, state);
-      if (path != NULL) {
+      if (path != nullptr) {
         completion_time = pf_path_last_position(path)->turn;
       }
     }
@@ -1161,10 +1160,10 @@ BUILD_CITY:
       cityresult_destroy(result);
 
       /*** Go back to and found a city ***/
-      if (path != NULL) {
+      if (path != nullptr) {
         pf_path_destroy(path);
       }
-      path = NULL;
+      path = nullptr;
       goto BUILD_CITY;
     } else if (best_impr > 0) {
       UNIT_LOG(LOG_DEBUG, punit, "improves terrain instead of founding");
@@ -1177,8 +1176,10 @@ BUILD_CITY:
       adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile);
     } else {
       UNIT_LOG(LOG_DEBUG, punit, "cannot find work");
-      fc_assert(result == NULL);
-      dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
+
+      fc_assert(result == nullptr);
+
+      dai_unit_new_task(ait, punit, AIUNIT_NONE, nullptr);
       goto CLEANUP;
     }
   } else {
@@ -1186,18 +1187,18 @@ BUILD_CITY:
     adv_unit_new_task(punit, AUT_AUTO_WORKER, best_tile);
   }
 
-  if (best_tile != NULL
+  if (best_tile != nullptr
       && auto_worker_setup_work(nmap, pplayer, punit, state, 0, &path,
                                 best_tile, best_act, &best_target,
                                 completion_time)) {
-    if (pcity != NULL) {
+    if (pcity != nullptr) {
       clear_worker_tasks(pcity);
     }
   }
 
 CLEANUP:
 
-  if (NULL != path) {
+  if (path != nullptr) {
     pf_path_destroy(path);
   }
 }
@@ -1223,9 +1224,9 @@ void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
   bool caller_closes;
   struct ai_plr *ai = dai_plr_data_get(ait, pplayer, &caller_closes);
 
-  fc_assert_ret(ai != NULL);
-  fc_assert_ret(ai->settler != NULL);
-  fc_assert_ret(ai->settler->tdc_hash != NULL);
+  fc_assert_ret(ai != nullptr);
+  fc_assert_ret(ai->settler != nullptr);
+  fc_assert_ret(ai->settler->tdc_hash != nullptr);
 
 #ifdef FREECIV_DEBUG
   log_debug("[aisettler cache for %s] save: %d, miss: %d, old: %d, hit: %d",
@@ -1251,7 +1252,7 @@ void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
 *****************************************************************************/
 void dai_auto_settler_free(struct ai_plr *ai)
 {
-  fc_assert_ret(ai != NULL);
+  fc_assert_ret(ai != nullptr);
 
   if (ai->settler) {
     if (ai->settler->tdc_hash) {
@@ -1259,7 +1260,7 @@ void dai_auto_settler_free(struct ai_plr *ai)
     }
     free(ai->settler);
   }
-  ai->settler = NULL;
+  ai->settler = nullptr;
 }
 
 /*************************************************************************//**
@@ -1276,7 +1277,7 @@ static enum cb_error_level dai_do_build_city(struct ai_type *ait,
   unit_activity_handling(punit, ACTIVITY_IDLE, ACTION_NONE);
 
   /* Free city reservations */
-  dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
+  dai_unit_new_task(ait, punit, AIUNIT_NONE, nullptr);
 
   pcity = tile_city(ptile);
   if (pcity) {
@@ -1293,7 +1294,8 @@ static enum cb_error_level dai_do_build_city(struct ai_type *ait,
   if (!pcity && punit) {
     enum ane_kind reason = action_not_enabled_reason(punit,
                                                      ACTION_FOUND_CITY,
-                                                     ptile, NULL, NULL);
+                                                     ptile,
+                                                     nullptr, nullptr);
 
     if (reason == ANEK_CITY_TOO_CLOSE_TGT) {
       /* This is acceptable. A hut in the path to the tile may have created
@@ -1359,7 +1361,7 @@ void contemplate_new_city(struct ai_type *ait, struct city *pcity)
 
   unit_type = best_role_unit(pcity, action_id_get_role(ACTION_FOUND_CITY));
 
-  if (unit_type == NULL) {
+  if (unit_type == nullptr) {
     log_debug("No ACTION_FOUND_CITY role unit available");
     return;
   }
-- 
2.53.0

