From c11e9bd26d0b7e027af95d3b2bcc7688562d6494 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 30 Sep 2026 05:28:54 +0300
Subject: [PATCH 81/81] advisors/: Replace NULL with nullptr

See RM #2308

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/advisors/advbuilding.c | 24 ++++++++++++------------
 server/advisors/advchoice.c   | 27 +++++++++++++++------------
 server/advisors/advruleset.c  |  4 ++--
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/server/advisors/advbuilding.c b/server/advisors/advbuilding.c
index 1041a9ca63..27bd8704ef 100644
--- a/server/advisors/advbuilding.c
+++ b/server/advisors/advbuilding.c
@@ -73,7 +73,7 @@ static void calculate_city_clusters(struct player *pplayer)
   punittype = best_role_unit_for_player(pplayer,
       action_id_get_role(ACTION_HELP_WONDER));
 
-  if (punittype == NULL) {
+  if (punittype == nullptr) {
     /* Simulate future unit */
     punittype = get_role_unit(action_id_get_role(ACTION_HELP_WONDER), 0);
   }
@@ -81,7 +81,7 @@ static void calculate_city_clusters(struct player *pplayer)
   fc_assert_msg(utype_can_do_action(punittype, ACTION_HELP_WONDER),
                 "Non existence of wonder helper unit not caught");
 
-  ghost = unit_virtual_create(pplayer, NULL, punittype, 0);
+  ghost = unit_virtual_create(pplayer, nullptr, punittype, 0);
   range = unit_move_rate(ghost) * 4;
 
   city_list_iterate(pplayer->cities, pcity) {
@@ -100,7 +100,7 @@ static void calculate_city_clusters(struct player *pplayer)
       if (move_cost > range) {
         break;
       }
-      if (acity == NULL) {
+      if (acity == nullptr) {
         continue;
       }
       if (city_owner(acity) == pplayer) {
@@ -174,7 +174,7 @@ static void ba_human_wants(struct player *pplayer, struct city *wonder_city)
 **************************************************************************/
 void building_advisor(struct player *pplayer)
 {
-  struct adv_data *adv = adv_data_get(pplayer, NULL);
+  struct adv_data *adv = adv_data_get(pplayer, nullptr);
   struct city *wonder_city = game_city_by_number(adv->wonder_city);
 
   CALL_FUNC_EACH_AI(build_adv_init, pplayer);
@@ -182,15 +182,15 @@ void building_advisor(struct player *pplayer)
   if (wonder_city && city_owner(wonder_city) != pplayer) {
     /* We lost it to the enemy! */
     adv->wonder_city = 0;
-    wonder_city = NULL;
+    wonder_city = nullptr;
   }
 
   /* Preliminary analysis - find our Wonder City. Also check if it
    * is sane to continue building the wonder in it. If either does
    * not check out, make a Wonder City. */
-  if (NULL == wonder_city
+  if (wonder_city == nullptr
    || 0 >= wonder_city->surplus[O_SHIELD]
-   || VUT_UTYPE == wonder_city->production.kind /* changed to defender? */
+   || VUT_UTYPE == wonder_city->production.kind /* Changed to defender? */
    || !is_wonder(wonder_city->production.value.building)
    || !can_city_build_improvement_now(wonder_city,
                                       wonder_city->production.value.building,
@@ -199,10 +199,10 @@ void building_advisor(struct player *pplayer)
                                  wonder_city->production.value.building)) {
     /* Find a new wonder city! */
     int best_candidate_value = 0;
-    struct city *best_candidate = NULL;
+    struct city *best_candidate = nullptr;
     /* Whether ruleset has a help wonder unit type */
-    bool has_help =
-        (num_role_units(action_id_get_role(ACTION_HELP_WONDER)) > 0);
+    bool has_help
+      = (num_role_units(action_id_get_role(ACTION_HELP_WONDER)) > 0);
 
     calculate_city_clusters(pplayer);
 
@@ -274,7 +274,7 @@ void building_advisor(struct player *pplayer)
 void building_advisor_choose(struct city *pcity, struct adv_choice *choice)
 {
   struct player *plr = city_owner(pcity);
-  struct impr_type *chosen = NULL;
+  struct impr_type *chosen = nullptr;
   adv_want want = 0;
 
   improvement_iterate(pimprove) {
@@ -296,7 +296,7 @@ void building_advisor_choose(struct city *pcity, struct adv_choice *choice)
   choice->want = want;
   choice->value.building = chosen;
 
-  if (chosen != NULL) {
+  if (chosen != nullptr) {
     choice->type = CT_BUILDING;
 
     CITY_LOG(LOG_DEBUG, pcity, "advisor wants to build %s with want "
diff --git a/server/advisors/advchoice.c b/server/advisors/advchoice.c
index 6a6810575f..c57f9e9d8c 100644
--- a/server/advisors/advchoice.c
+++ b/server/advisors/advchoice.c
@@ -30,14 +30,16 @@
 **************************************************************************/
 void adv_init_choice(struct adv_choice *choice)
 {
-  choice->value.utype = NULL;
+  choice->value.utype = nullptr;
   choice->want = 0;
   choice->type = CT_NONE;
   choice->need_boat = FALSE;
+
 #ifdef ADV_CHOICE_TRACK
-  choice->use = NULL;
+  choice->use = nullptr;
   choice->log_if_chosen = FALSE;
 #endif /* ADV_CHOICE_TRACK */
+
 }
 
 /**********************************************************************//**
@@ -46,9 +48,9 @@ void adv_init_choice(struct adv_choice *choice)
 void adv_deinit_choice(struct adv_choice *choice)
 {
 #ifdef ADV_CHOICE_TRACK
-  if (choice->use != NULL) {
+  if (choice->use != nullptr) {
     free(choice->use);
-    choice->use = NULL;
+    choice->use = nullptr;
   }
 #endif /* ADV_CHOICE_TRACK */
 }
@@ -71,10 +73,11 @@ struct adv_choice *adv_new_choice(void)
 void adv_free_choice(struct adv_choice *choice)
 {
 #ifdef ADV_CHOICE_TRACK
-  if (choice->use != NULL) {
+  if (choice->use != nullptr) {
     free(choice->use);
   }
 #endif /* ADV_CHOICE_TRACK */
+
   free(choice);
 }
 
@@ -150,13 +153,13 @@ void adv_choice_copy(struct adv_choice *dest, struct adv_choice *src)
     dest->value = src->value;
     dest->want = src->want;
     dest->need_boat = src->need_boat;
-    if (dest->use != NULL) {
+    if (dest->use != nullptr) {
       free(dest->use);
     }
-    if (src->use != NULL) {
+    if (src->use != nullptr) {
       dest->use = fc_strdup(src->use);
     } else {
-      dest->use = NULL;
+      dest->use = nullptr;
     }
     dest->log_if_chosen = src->log_if_chosen;
   }
@@ -167,7 +170,7 @@ void adv_choice_copy(struct adv_choice *dest, struct adv_choice *src)
 **************************************************************************/
 void adv_choice_set_use(struct adv_choice *choice, const char *use)
 {
-  if (choice->use != NULL) {
+  if (choice->use != nullptr) {
     free(choice->use);
   }
   choice->use = fc_strdup(use);
@@ -182,7 +185,7 @@ void adv_choice_log_info(struct adv_choice *choice,
   const char *use;
   const char *name;
 
-  if (choice->use != NULL) {
+  if (choice->use != nullptr) {
     use = choice->use;
   } else {
     use = "<unknown>";
@@ -190,7 +193,7 @@ void adv_choice_log_info(struct adv_choice *choice,
 
   name = adv_choice_rule_name(choice);
 
-  if (loc2 != NULL) {
+  if (loc2 != nullptr) {
     log_base(ADV_CHOICE_LOG_LEVEL, "Choice at \"%s:%s\": %s, "
                                    "want " ADV_WANT_PRINTF " as %s (%d)",
              loc1, loc2, name, choice->want, use, choice->type);
@@ -218,7 +221,7 @@ void adv_choice_log_int(struct adv_choice *choice,
 **************************************************************************/
 const char *adv_choice_get_use(const struct adv_choice *choice)
 {
-  if (choice->use == NULL) {
+  if (choice->use == nullptr) {
     return "(unset)";
   }
 
diff --git a/server/advisors/advruleset.c b/server/advisors/advruleset.c
index 4ad985f91e..4bfa72a0a1 100644
--- a/server/advisors/advruleset.c
+++ b/server/advisors/advruleset.c
@@ -39,7 +39,7 @@ void adv_units_ruleset_init(void)
     bool move_sea_disabled  = FALSE; /* Cannot move at some ocean terrains */
 
     terrain_type_iterate(pterrain) {
-      if (is_native_to_class(pclass, pterrain, NULL)) {
+      if (is_native_to_class(pclass, pterrain, nullptr)) {
         /* Can move at terrain */
         if (is_ocean(pterrain)) {
           move_sea_enabled = TRUE;
@@ -85,7 +85,7 @@ void adv_units_ruleset_init(void)
     effect_list_iterate(get_effects(EFT_DEFEND_BONUS), peffect) {
       if (peffect->value > 0) {
         requirement_vector_iterate(&peffect->reqs, preq) {
-          if (!is_req_active(&context, NULL, preq, RPT_POSSIBLE)) {
+          if (!is_req_active(&context, nullptr, preq, RPT_POSSIBLE)) {
             ptype->adv.igwall = FALSE;
             break;
           }
-- 
2.53.0

