From aa169f6af36562977b31d764b27372b7cf7781af Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 2 Dec 2026 04:21:21 +0200
Subject: [PATCH 52/52] text.c: Replace NULL with nullptr

See RM #2515

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/text.c | 83 ++++++++++++++++++++++++++-------------------------
 1 file changed, 42 insertions(+), 41 deletions(-)

diff --git a/client/text.c b/client/text.c
index c7f8c5b75a..a83177b556 100644
--- a/client/text.c
+++ b/client/text.c
@@ -68,9 +68,9 @@ const char *get_tile_output_text(const struct tile *ptile)
 
   for (i = 0; i < O_LAST; i++) {
     int before_penalty = 0;
-    int x = city_tile_output(NULL, ptile, FALSE, i);
+    int x = city_tile_output(nullptr, ptile, FALSE, i);
 
-    if (NULL != client.conn.playing) {
+    if (client.conn.playing != nullptr) {
       before_penalty = get_player_output_bonus(client.conn.playing,
                                                get_output_type(i),
                                                EFT_OUTPUT_PENALTY_TILE);
@@ -558,13 +558,13 @@ const char *unit_description(struct unit *punit)
   unit_activity_astr(punit, &str);
 
   if (pcity) {
-    /* TRANS: on own line immediately following \n, ... <city> */
+    /* TRANS: On own line immediately following \n, ... <city> */
     astr_add_line(&str, _("from %s"), city_name_get(pcity));
   } else {
     astr_add(&str, "\n");
   }
   if (game.info.citizen_nationality) {
-    if (nationality != NULL && owner != nationality) {
+    if (nationality != nullptr && owner != nationality) {
       /* TRANS: Nationality of the people comprising a unit, if
        * different from owner. */
       astr_add_line(&str, _("%s people"),
@@ -586,13 +586,13 @@ const char *unit_description(struct unit *punit)
 /************************************************************************//**
   Describe the airlift capacity of a city for the given units (from their
   current positions).
-  If pdest is non-NULL, describe its capacity as a destination, otherwise
+  If pdest is non-nullptr, describe its capacity as a destination, otherwise
   describe the capacity of the city the unit's currently in (if any) as a
   source. (If the units in the list are in different cities, this will
   probably not give a useful result in this case.)
   If not all of the listed units can be airlifted, return the description
   for those that can.
-  Returns NULL if an airlift is not possible for any of the units.
+  Returns nullptr if an airlift is not possible for any of the units.
 
   Not re-entrant
 ****************************************************************************/
@@ -600,7 +600,7 @@ const char *get_airlift_text(const struct unit_list *punits,
                              const struct city *pdest)
 {
   static struct astring str = ASTRING_INIT;
-  bool src = (pdest == NULL);
+  bool src = (pdest == nullptr);
   enum texttype { AL_IMPOSSIBLE, AL_UNKNOWN, AL_FINITE, AL_INFINITE }
       best = AL_IMPOSSIBLE;
   int cur = 0, max = 0;
@@ -609,7 +609,7 @@ const char *get_airlift_text(const struct unit_list *punits,
     enum texttype this = AL_IMPOSSIBLE;
     enum unit_airlift_result result;
 
-    /* NULL will tell us about the capability of airlifting from source */
+    /* nullptr will tell us about the capability of airlifting from source */
     result = test_unit_can_airlift_to(&(wld.map), client_player(), punit, pdest);
 
     switch (result) {
@@ -632,7 +632,8 @@ const char *get_airlift_text(const struct unit_list *punits,
       {
         const struct city *pcity = src ? tile_city(unit_tile(punit)) : pdest;
 
-        fc_assert_ret_val(pcity != NULL, fc_strdup("-"));
+        fc_assert_ret_val(pcity != nullptr, fc_strdup("-"));
+
         if (!src && ((game.info.airlifting_style & AIRLIFTING_UNLIMITED_DEST)
                      && game.info.airlift_to_always_enabled)) {
           /* No restrictions on destination (and we can infer this even for
@@ -682,7 +683,7 @@ const char *get_airlift_text(const struct unit_list *punits,
 
   switch (best) {
   case AL_IMPOSSIBLE:
-    return NULL;
+    return nullptr;
   case AL_UNKNOWN:
     astr_set(&str, "?");
     break;
@@ -807,8 +808,8 @@ const char *science_dialog_text(void)
   research = research_get(client_player());
   upkeep = client_player()->client.tech_upkeep;
 
-  if (NULL == client.conn.playing || (ours == 0 && theirs == 0
-                                      && upkeep == 0)) {
+  if (client.conn.playing == nullptr || (ours == 0 && theirs == 0
+                                         && upkeep == 0)) {
     return _("Progress: no research");
   }
 
@@ -889,7 +890,7 @@ const char *get_science_target_text(double *percent)
   } else {
     int total = research->client.researching_cost;
     int done = research->bulbs_researched;
-    int perturn = get_bulbs_per_turn(NULL, NULL, NULL);
+    int perturn = get_bulbs_per_turn(nullptr, nullptr, nullptr);
     int turns;
 
     if ((turns = turns_to_research_done(research, perturn)) >= 0) {
@@ -923,7 +924,7 @@ const char *get_science_goal_text(Tech_type_id goal)
   int steps = research_goal_unknown_techs(research, goal);
   int bulbs_needed = research_goal_bulbs_required(research, goal);
   int turns;
-  int perturn = get_bulbs_per_turn(NULL, NULL, NULL);
+  int perturn = get_bulbs_per_turn(nullptr, nullptr, nullptr);
   static struct astring str = ASTRING_INIT;
   struct astring buf1 = ASTRING_INIT,
                  buf2 = ASTRING_INIT,
@@ -974,14 +975,14 @@ const char *get_info_label_text(bool moreinfo)
 
   astr_clear(&str);
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     astr_add_line(&str, _("Population: %s"),
                   population_to_text(civ_population(client.conn.playing)));
   }
   astr_add_line(&str, _("Year: %s (T%d)"),
                 calendar_text(), game.info.turn);
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     astr_add_line(&str, _("Gold: %d (%+d)"),
                   client.conn.playing->economic.gold,
                   player_get_expected_income(client.conn.playing));
@@ -1026,16 +1027,16 @@ const char *get_info_label_text_popup(void)
 
   astr_clear(&str);
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     astr_add_line(&str, _("%s People"),
                   population_to_text(civ_population(client.conn.playing)));
   }
   astr_add_line(&str, _("Year: %s"), calendar_text());
   astr_add_line(&str, _("Turn: %d"), game.info.turn);
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     const struct research *presearch = research_get(client_player());
-    int perturn = get_bulbs_per_turn(NULL, NULL, NULL);
+    int perturn = get_bulbs_per_turn(nullptr, nullptr, nullptr);
     int upkeep = client_player()->client.tech_upkeep;
 
     astr_add_line(&str, _("Gold: %d"),
@@ -1050,7 +1051,7 @@ const char *get_info_label_text_popup(void)
     astr_add_line(&str, _("Researching %s: %s"),
                   research_advance_name_translation(presearch,
                                                     presearch->researching),
-                  get_science_target_text(NULL));
+                  get_science_target_text(nullptr));
     /* perturn is defined as: (bulbs produced) - upkeep */
     if (game.info.tech_upkeep_style != TECH_UPKEEP_NONE) {
       astr_add_line(&str, _("Bulbs per turn: %d - %d = %d"), perturn + upkeep,
@@ -1090,7 +1091,7 @@ const char *get_info_label_text_popup(void)
     astr_add_line(&str, _("Nuclear winter deactivated."));
   }
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     astr_add_line(&str, _("Government: %s"),
                   government_name_for_player(client.conn.playing));
   }
@@ -1203,8 +1204,8 @@ const char *get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
     if (game.info.citizen_nationality) {
       struct player *nationality = unit_nationality(punit);
 
-      /* Line 5, nationality text */
-      if (nationality != NULL && owner != nationality) {
+      /* Line 5, Nationality text */
+      if (nationality != nullptr && owner != nationality) {
         /* TRANS: Nationality of the people comprising a unit, if
          * different from owner. */
         astr_add_line(&str, _("%s people"),
@@ -1229,7 +1230,7 @@ const char *get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
       types_count[utype_index(unit_type_get(punit))]++;
     } unit_list_iterate_end;
 
-    top[0] = top[1] = top[2] = NULL;
+    top[0] = top[1] = top[2] = nullptr;
     unit_type_iterate(utype) {
       if (!top[2]
           || types_count[utype_index(top[2])] < types_count[utype_index(utype)]) {
@@ -1427,14 +1428,14 @@ const char *get_bulb_tooltip(void)
   astr_add_line(&str, _("Shows your progress in "
                         "researching the current technology."));
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     struct research *research = research_get(client_player());
 
     if (research->researching == A_UNSET) {
       astr_add_line(&str, _("No research target."));
     } else {
       int turns;
-      int perturn = get_bulbs_per_turn(NULL, NULL, NULL);
+      int perturn = get_bulbs_per_turn(nullptr, nullptr, nullptr);
       struct astring buf1 = ASTRING_INIT, buf2 = ASTRING_INIT;
 
       if ((turns = turns_to_research_done(research, perturn)) >= 0) {
@@ -1537,7 +1538,7 @@ const char *get_government_tooltip(void)
 
   astr_add_line(&str, _("Shows your current government:"));
 
-  if (NULL != client.conn.playing) {
+  if (client.conn.playing != nullptr) {
     astr_add_line(&str, "%s",
                   government_name_for_player(client.conn.playing));
   }
@@ -1547,7 +1548,7 @@ const char *get_government_tooltip(void)
 
 /************************************************************************//**
   Returns a description of the given spaceship. If there is no spaceship
-  (pship is NULL) then text with dummy values is returned.
+  (pship is nullptr) then text with dummy values is returned.
 
   Not re-entrant
 ****************************************************************************/
@@ -1732,7 +1733,7 @@ const char *get_report_title(const char *report_name)
 
   astr_add_line(&str, "%s", report_name);
 
-  if (pplayer != NULL) {
+  if (pplayer != nullptr) {
     char buf[4 * MAX_LEN_NAME];
 
     /* TRANS: <nation adjective> <government name>.
@@ -1772,12 +1773,12 @@ const char *get_act_sel_action_custom_text(struct action *paction,
 
   if (!action_prob_possible(prob)) {
     /* No info since impossible. */
-    return NULL;
+    return nullptr;
   }
 
   fc_assert_ret_val((action_get_target_kind(paction) != ATK_CITY
-                     || target_city != NULL),
-                    NULL);
+                     || target_city != nullptr),
+                    nullptr);
 
   if (action_has_result(paction, ACTRES_TRADE_ROUTE)) {
     bool estimated = FALSE;
@@ -1840,7 +1841,7 @@ const char *get_act_sel_action_custom_text(struct action *paction,
       }
     } else {
       /* No info to add. */
-      return NULL;
+      return nullptr;
     }
   } else if ((action_has_result(paction, ACTRES_HELP_WONDER)
               || action_has_result(paction, ACTRES_DISBAND_UNIT_RECOVER))
@@ -1852,7 +1853,7 @@ const char *get_act_sel_action_custom_text(struct action *paction,
     astr_set(&custom, _("%d remaining"), cost - target_city->shield_stock);
   } else {
     /* No info to add. */
-    return NULL;
+    return nullptr;
   }
 
   return astr_str(&custom);
@@ -1882,7 +1883,7 @@ const char *text_happiness_buildings(const struct city *pcity)
   struct effect_list *plist = effect_list_new();
   static struct astring str = ASTRING_INIT;
 
-  get_city_bonus_effects(plist, pcity, NULL, EFT_MAKE_CONTENT);
+  get_city_bonus_effects(plist, pcity, nullptr, EFT_MAKE_CONTENT);
   if (0 < effect_list_size(plist)) {
     struct astring effects = ASTRING_INIT;
 
@@ -1952,9 +1953,9 @@ const char *text_happiness_wonders(const struct city *pcity)
   struct effect_list *plist = effect_list_new();
   static struct astring str = ASTRING_INIT;
 
-  get_city_bonus_effects(plist, pcity, NULL, EFT_MAKE_HAPPY);
-  get_city_bonus_effects(plist, pcity, NULL, EFT_FORCE_CONTENT);
-  get_city_bonus_effects(plist, pcity, NULL, EFT_NO_UNHAPPY);
+  get_city_bonus_effects(plist, pcity, nullptr, EFT_MAKE_HAPPY);
+  get_city_bonus_effects(plist, pcity, nullptr, EFT_FORCE_CONTENT);
+  get_city_bonus_effects(plist, pcity, nullptr, EFT_NO_UNHAPPY);
   if (0 < effect_list_size(plist)) {
     struct astring effects = ASTRING_INIT;
 
@@ -2174,7 +2175,7 @@ const char *production_help(const struct universal *uni, char *buf,
   int segments = 0;
 
   if (uni->kind == VUT_UTYPE) {
-    if (uni->value.utype->helptext != NULL) {
+    if (uni->value.utype->helptext != nullptr) {
       strvec_iterate(uni->value.utype->helptext, text) {
         if (segments++) {
           cat_snprintf(buf, bufsize, "\n\n");
@@ -2185,7 +2186,7 @@ const char *production_help(const struct universal *uni, char *buf,
   } else {
     fc_assert(uni->kind == VUT_IMPROVEMENT);
 
-    if (uni->value.building->helptext != NULL) {
+    if (uni->value.building->helptext != nullptr) {
       strvec_iterate(uni->value.building->helptext, text) {
         if (segments++) {
           cat_snprintf(buf, bufsize, "\n\n");
@@ -2209,7 +2210,7 @@ const char *score_tooltip(const struct player *pplayer, int score)
   static char buf[1024];
   char *relation;
 
-  if (client.conn.playing != NULL) {
+  if (client.conn.playing != nullptr) {
     if (pplayer == client.conn.playing) {
       relation = _(" (us)");
     } else if (pplayers_allied(pplayer, client.conn.playing)) {
-- 
2.53.0

