From 23bd31bbd39afffe57c3b9f154b8f7ead501fd74 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 20 Sep 2026 11:43:14 +0300
Subject: [PATCH 68/68] diplomats.c: Replace NULL with nullptr

See RM #2264

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/diplomats.c | 196 +++++++++++++++++++++++----------------------
 1 file changed, 99 insertions(+), 97 deletions(-)

diff --git a/server/diplomats.c b/server/diplomats.c
index 3b78f55c01..a2bfc7edc1 100644
--- a/server/diplomats.c
+++ b/server/diplomats.c
@@ -120,7 +120,7 @@ bool spy_poison(struct player *pplayer, struct unit *pdiplomat,
 
   /* Check if the Diplomat/Spy succeeds against defending Diplomats/Spies. */
   if (!diplomat_infiltrate_tile(pplayer, cplayer, paction,
-                                pdiplomat, NULL, ctile, NULL)) {
+                                pdiplomat, nullptr, ctile, nullptr)) {
     return FALSE;
   }
 
@@ -173,7 +173,7 @@ bool spy_poison(struct player *pplayer, struct unit *pdiplomat,
 
     /* Update clients. */
     city_refresh (pcity);
-    send_city_info(NULL, pcity);
+    send_city_info(nullptr, pcity);
   } else {
     /* Notify everybody involved. */
     notify_player(pplayer, ctile, E_MY_DIPLOMAT_POISON, ftc_server,
@@ -242,7 +242,7 @@ bool spy_spread_plague(struct player *act_player, struct unit *act_unit,
   /* Battle all units capable of diplomatic defense. */
   if (!diplomat_infiltrate_tile(act_player, tgt_player,
                                 paction,
-                                act_unit, NULL, tgt_tile, NULL)) {
+                                act_unit, nullptr, tgt_tile, nullptr)) {
     return FALSE;
   }
 
@@ -282,7 +282,7 @@ bool spy_spread_plague(struct player *act_player, struct unit *act_unit,
   if (city_illness_strike(tgt_city)) {
     /* Update the clients. */
     city_refresh(tgt_city);
-    send_city_info(NULL, tgt_city);
+    send_city_info(nullptr, tgt_city);
   }
 
   /* Notify everyone involved. */
@@ -383,7 +383,7 @@ bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat,
   if (any_web_conns()) {
     webp_ptr = &web_packet;
   } else {
-    webp_ptr = NULL;
+    webp_ptr = nullptr;
   }
 
   routes = trade_route_packet_list_new();
@@ -411,7 +411,7 @@ bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat,
   if (!utype_is_consumed_by_action(paction, unit_type_get(pdiplomat))) {
     /* This unit isn't about to be consumed. Send updated unit information
      * to the clients. */
-    send_unit_info(NULL, pdiplomat);
+    send_unit_info(nullptr, pdiplomat);
   }
 
   dlsend_packet_investigate_finished(pplayer->connections, pcity->id);
@@ -530,7 +530,7 @@ bool diplomat_embassy(struct player *pplayer, struct unit *pdiplomat,
   if (!utype_is_consumed_by_action(paction, unit_type_get(pdiplomat))) {
     /* This unit isn't about to be consumed. Send updated unit information
      * to the clients. */
-    send_unit_info(NULL, pdiplomat);
+    send_unit_info(nullptr, pdiplomat);
   }
 
   return TRUE;
@@ -576,7 +576,7 @@ bool spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat,
                                 paction,
                                 pdiplomat, pvictim,
                                 unit_tile(pvictim),
-                                NULL)) {
+                                nullptr)) {
     return FALSE;
   }
 
@@ -602,7 +602,7 @@ bool spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat,
   } else {
     /* Sabotage the unit by removing half its remaining hit points. */
     pvictim->hp /= 2;
-    send_unit_info(NULL, pvictim);
+    send_unit_info(nullptr, pvictim);
 
     /* Notify everybody involved. */
     notify_player(pplayer, unit_tile(pvictim),
@@ -624,7 +624,7 @@ bool spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat,
                              unit_tile(pvictim), victim_link);
 
   /* Now lets see if the spy survives. */
-  diplomat_escape(pplayer, pdiplomat, NULL, paction);
+  diplomat_escape(pplayer, pdiplomat, nullptr, paction);
 
   return TRUE;
 }
@@ -703,7 +703,7 @@ bool diplomat_bribe_unit(struct player *pplayer, struct unit *pdiplomat,
                                 paction,
                                 pdiplomat, pvictim,
                                 pvictim->tile,
-                                NULL)) {
+                                nullptr)) {
     return FALSE;
   }
 
@@ -724,7 +724,7 @@ bool diplomat_bribe_unit(struct player *pplayer, struct unit *pdiplomat,
 
   if (!unit_is_alive(diplomat_id)) {
     /* Destroyed by a script */
-    pdiplomat = NULL;
+    pdiplomat = nullptr;
   }
 
   /* Notify everybody involved. */
@@ -745,7 +745,7 @@ bool diplomat_bribe_unit(struct player *pplayer, struct unit *pdiplomat,
     /* The unit may have been on a tile shared with a city or a unit
      * it no longer can share a tile with. */
     pcity = tile_city(unit_tile(pvictim));
-    bounce = ((NULL != pcity
+    bounce = ((pcity != nullptr
                && !pplayers_allied(city_owner(pcity), unit_owner(pvictim)))
               /* Keep the old behavior (insto check is_non_allied_unit_tile) */
               || 1 < unit_list_size(unit_tile(pvictim)->units));
@@ -779,20 +779,20 @@ bool diplomat_bribe_unit(struct player *pplayer, struct unit *pdiplomat,
    * been bounced because it couldn't share tile with a unit or city. */
   if (!bounce
       /* Try to perform post move forced actions. */
-      && (NULL == action_auto_perf_unit_do(AAPC_POST_ACTION, pdiplomat,
-                                           uplayer, NULL, paction,
-                                           victim_tile, tile_city(victim_tile),
-                                           pvictim, NULL))
+      && (action_auto_perf_unit_do(AAPC_POST_ACTION, pdiplomat,
+                                   uplayer, nullptr, paction,
+                                   victim_tile, tile_city(victim_tile),
+                                   pvictim, nullptr) == nullptr)
       /* May have died while trying to do forced actions. */
       && unit_is_alive(diplomat_id)) {
     pdiplomat->moves_left = 0;
   }
-  if (NULL != player_unit_by_number(pplayer, diplomat_id)) {
-    send_unit_info(NULL, pdiplomat);
+  if (player_unit_by_number(pplayer, diplomat_id) != nullptr) {
+    send_unit_info(nullptr, pdiplomat);
   }
 
   /* Update clients. */
-  send_player_all_c(pplayer, NULL);
+  send_player_all_c(pplayer, nullptr);
 
   return TRUE;
 }
@@ -842,7 +842,7 @@ bool diplomat_bribe_stack(struct player *pplayer, struct unit *pdiplomat,
   }
 
   pcity = tile_city(pvictim);
-  if (pcity != NULL && !pplayers_allied(city_owner(pcity), pplayer)) {
+  if (pcity != nullptr && !pplayers_allied(city_owner(pcity), pplayer)) {
     bounce = TRUE;
   }
 
@@ -864,7 +864,7 @@ bool diplomat_bribe_stack(struct player *pplayer, struct unit *pdiplomat,
 
   if (!unit_is_alive(diplomat_id)) {
     /* Destroyed by a script */
-    pdiplomat = NULL;
+    pdiplomat = nullptr;
   }
 
   act_utype = unit_type_get(pdiplomat);
@@ -898,20 +898,20 @@ bool diplomat_bribe_stack(struct player *pplayer, struct unit *pdiplomat,
    * been bounced because it couldn't share tile with a unit or city. */
   if (!bounce
       /* Try to perform post move forced actions. */
-      && (NULL == action_auto_perf_unit_do(AAPC_POST_ACTION, pdiplomat,
-                                           NULL, NULL, paction,
-                                           pvictim, pcity,
-                                           NULL, NULL))
+      && (action_auto_perf_unit_do(AAPC_POST_ACTION, pdiplomat,
+                                   nullptr, nullptr, paction,
+                                   pvictim, pcity,
+                                   nullptr, nullptr) == nullptr)
       /* May have died while trying to do forced actions. */
       && unit_is_alive(diplomat_id)) {
     pdiplomat->moves_left = 0;
   }
-  if (NULL != player_unit_by_number(pplayer, diplomat_id)) {
-    send_unit_info(NULL, pdiplomat);
+  if (player_unit_by_number(pplayer, diplomat_id) != nullptr) {
+    send_unit_info(nullptr, pdiplomat);
   }
 
   /* Update clients. */
-  send_player_all_c(pplayer, NULL);
+  send_player_all_c(pplayer, nullptr);
 
   return TRUE;
 }
@@ -928,7 +928,7 @@ bool spy_attack(struct player *act_player, struct unit *act_unit,
                 struct tile *tgt_tile, const struct action *paction)
 {
   int act_unit_id;
-  struct player *tgt_player = NULL;
+  struct player *tgt_player = nullptr;
   const struct unit_type *act_utype;
 
   /* Sanity check: The actor still exists. */
@@ -939,13 +939,13 @@ bool spy_attack(struct player *act_player, struct unit *act_unit,
   act_unit_id = act_unit->id;
 
   /* Do the diplomatic battle against a diplomatic defender. */
-  diplomat_infiltrate_tile(act_player, NULL,
+  diplomat_infiltrate_tile(act_player, nullptr,
                            paction,
-                           act_unit, NULL, tgt_tile,
+                           act_unit, nullptr, tgt_tile,
                            &tgt_player);
 
   /* Sanity check: the defender had an owner. */
-  fc_assert_ret_val(tgt_player != NULL, TRUE);
+  fc_assert_ret_val(tgt_player != nullptr, TRUE);
 
   if (!unit_is_alive(act_unit_id)) {
     /* action_consequence_caught() is handled in
@@ -1082,9 +1082,9 @@ bool diplomat_get_tech(struct player *pplayer, struct unit *pdiplomat,
   /* Check if the Diplomat/Spy succeeds against defending Diplomats/Spies. */
   if (!diplomat_infiltrate_tile(pplayer, cplayer,
                                 paction,
-                                pdiplomat, NULL,
+                                pdiplomat, nullptr,
                                 pcity->tile,
-                                NULL)) {
+                                nullptr)) {
     return FALSE;
   }
 
@@ -1168,12 +1168,12 @@ bool diplomat_get_tech(struct player *pplayer, struct unit *pdiplomat,
                   _("No new technology found in %s."),
                   city_link(pcity));
     diplomat_charge_movement (pdiplomat, pcity->tile);
-    send_unit_info(NULL, pdiplomat);
+    send_unit_info(nullptr, pdiplomat);
     return FALSE;
   }
 
   /* Update stealing player's science progress and research fields */
-  send_player_all_c(pplayer, NULL);
+  send_player_all_c(pplayer, nullptr);
 
   /* Record the theft. */
   (pcity->steal)++;
@@ -1207,7 +1207,7 @@ bool diplomat_may_lose_gold(struct player *dec_player, struct player *inc_player
 
   /* Roll the dice. */
   if (fc_rand(100) < game.server.incite_gold_loss_chance) {
-    notify_player(dec_player, NULL, E_MY_DIPLOMAT_FAILED, ftc_server,
+    notify_player(dec_player, nullptr, E_MY_DIPLOMAT_FAILED, ftc_server,
                   PL_("Your %d gold prepared to incite the revolt was lost!",
                       "Your %d gold prepared to incite the revolt was lost!",
                       revolt_gold), revolt_gold);
@@ -1217,7 +1217,7 @@ bool diplomat_may_lose_gold(struct player *dec_player, struct player *inc_player
      * Roll the dice twice. */
     if (fc_rand(100) < game.server.incite_gold_capt_chance) {
       inc_player->economic.gold += revolt_gold;
-      notify_player(inc_player, NULL, E_ENEMY_DIPLOMAT_FAILED,
+      notify_player(inc_player, nullptr, E_ENEMY_DIPLOMAT_FAILED,
                     ftc_server,
                     PL_("Your security service captured %d gold prepared "
                         "to incite your town!",
@@ -1225,8 +1225,8 @@ bool diplomat_may_lose_gold(struct player *dec_player, struct player *inc_player
                         "to incite your town!", revolt_gold), revolt_gold);
     }
     /* Update clients. */
-    send_player_all_c(dec_player, NULL);
-    send_player_all_c(inc_player, NULL);
+    send_player_all_c(dec_player, nullptr);
+    send_player_all_c(inc_player, nullptr);
 
     return TRUE;
   } else {
@@ -1298,9 +1298,9 @@ bool diplomat_incite(struct player *pplayer, struct unit *pdiplomat,
   /* Check if the Diplomat/Spy succeeds against defending Diplomats/Spies. */
   if (!diplomat_infiltrate_tile(pplayer, cplayer,
                                 paction,
-                                pdiplomat, NULL,
+                                pdiplomat, nullptr,
                                 pcity->tile,
-                                NULL)) {
+                                nullptr)) {
     diplomat_may_lose_gold(pplayer, cplayer, revolt_cost / 2 );
     return FALSE;
   }
@@ -1426,9 +1426,9 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
   /* Check if the Diplomat/Spy succeeds against defending Diplomats/Spies. */
   if (!diplomat_infiltrate_tile(pplayer, cplayer,
                                 paction,
-                                pdiplomat, NULL,
+                                pdiplomat, nullptr,
                                 pcity->tile,
-                                NULL)) {
+                                nullptr)) {
     return FALSE;
   }
 
@@ -1484,29 +1484,29 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
                     unit_link(pdiplomat),
                     city_link(pcity));
       diplomat_charge_movement(pdiplomat, pcity->tile);
-      send_unit_info(NULL, pdiplomat);
+      send_unit_info(nullptr, pdiplomat);
       log_debug("sabotage: random: nothing to do");
       return FALSE;
     }
     if (count == 0 || fc_rand (2) == 1) {
-      ptarget = NULL;
+      ptarget = nullptr;
       log_debug("sabotage: random: targeted production");
     } else {
-      ptarget = NULL;
+      ptarget = nullptr;
       which = fc_rand (count);
 
       city_built_iterate(pcity, pimprove) {
-	if (pimprove->sabotage > 0) {
-	  if (which > 0) {
-	    which--;
-	  } else {
-	    ptarget = pimprove;
-	    break;
-	  }
-	}
+        if (pimprove->sabotage > 0) {
+          if (which > 0) {
+            which--;
+          } else {
+            ptarget = pimprove;
+            break;
+          }
+        }
       } city_built_iterate_end;
 
-      if (NULL != ptarget) {
+      if (ptarget != nullptr) {
         log_debug("sabotage: random: targeted improvement: %d (%s)",
                   improvement_number(ptarget),
                   improvement_rule_name(ptarget));
@@ -1516,14 +1516,16 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
     }
   } else if (improvement < 0) {
     /* If told to sabotage production, do so. */
-    ptarget = NULL;
+    ptarget = nullptr;
     log_debug("sabotage: specified target production");
   } else {
     struct impr_type *pimprove = improvement_by_number(improvement);
-    if (pimprove == NULL) {
+
+    if (pimprove == nullptr) {
       log_error("sabotage: requested for invalid improvement %d", improvement);
       return FALSE;
     }
+
     /*
      * Told which improvement to pick:
      * If try for wonder or palace, complain, deduct movement cost and return.
@@ -1531,7 +1533,7 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
      */
     if (city_has_building(pcity, pimprove)) {
       if (pimprove->sabotage > 0) {
-	ptarget = pimprove;
+        ptarget = pimprove;
         log_debug("sabotage: specified target improvement: %d (%s)",
                   improvement, improvement_rule_name(pimprove));
       } else {
@@ -1540,7 +1542,7 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
                       _("You cannot sabotage a %s!"),
                       improvement_name_translation(pimprove));
         diplomat_charge_movement(pdiplomat, pcity->tile);
-        send_unit_info(NULL, pdiplomat);
+        send_unit_info(nullptr, pdiplomat);
         log_debug("sabotage: disallowed target improvement: %d (%s)",
                   improvement, improvement_rule_name(pimprove));
         return FALSE;
@@ -1553,7 +1555,7 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
                     improvement_name_translation(pimprove),
                     city_link(pcity));
       diplomat_charge_movement(pdiplomat, pcity->tile);
-      send_unit_info(NULL, pdiplomat);
+      send_unit_info(nullptr, pdiplomat);
       log_debug("sabotage: target improvement not found: %d (%s)",
                 improvement, improvement_rule_name(pimprove));
       return FALSE;
@@ -1561,7 +1563,7 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
   }
 
   /* Now, the fun stuff!  Do the sabotage! */
-  if (NULL == ptarget) {
+  if (ptarget == nullptr) {
      char prod[256];
 
     /* Do it. */
@@ -1649,9 +1651,9 @@ bool diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
   }
 
   /* Update clients. */
-  send_city_info(NULL, pcity);
+  send_city_info(nullptr, pcity);
 
-  /* this may cause a diplomatic incident */
+  /* This may cause a diplomatic incident */
   action_consequence_success(paction, pplayer, act_utype, cplayer,
                              city_tile(pcity), city_link(pcity));
 
@@ -1719,8 +1721,8 @@ bool spy_steal_gold(struct player *act_player, struct unit *act_unit,
   /* Battle all units capable of diplomatic defense. */
   if (!diplomat_infiltrate_tile(act_player, tgt_player,
                                 paction,
-                                act_unit, NULL, tgt_tile,
-                                NULL)) {
+                                act_unit, nullptr, tgt_tile,
+                                nullptr)) {
     return FALSE;
   }
 
@@ -1856,8 +1858,8 @@ bool spy_steal_some_maps(struct player *act_player, struct unit *act_unit,
   /* Battle all units capable of diplomatic defense. */
   if (!diplomat_infiltrate_tile(act_player, tgt_player,
                                 paction,
-                                act_unit, NULL, tgt_tile,
-                                NULL)) {
+                                act_unit, nullptr, tgt_tile,
+                                nullptr)) {
     return FALSE;
   }
 
@@ -1893,7 +1895,7 @@ bool spy_steal_some_maps(struct player *act_player, struct unit *act_unit,
 
   /* Steal it. */
   normal_tile_prob = 100
-      + get_target_bonus_effects(NULL,
+      + get_target_bonus_effects(nullptr,
                                  &(const struct req_context) {
                                    .player = act_player,
                                  /* City: Decide once requests from ruleset
@@ -1985,8 +1987,8 @@ bool spy_nuke_city(struct player *act_player, struct unit *act_unit,
   /* Battle all units capable of diplomatic defense. */
   if (!diplomat_infiltrate_tile(act_player, tgt_player,
                                 paction,
-                                act_unit, NULL, tgt_tile,
-                                NULL)) {
+                                act_unit, nullptr, tgt_tile,
+                                nullptr)) {
     return FALSE;
   }
 
@@ -2036,7 +2038,7 @@ bool spy_nuke_city(struct player *act_player, struct unit *act_unit,
   if (utype_is_consumed_by_action(paction, unit_type_get(act_unit))) {
     /* The unit must be wiped here so it won't be seen as a victim of the
      * detonation of its own nuke. */
-    wipe_unit(act_unit, ULR_USED, NULL);
+    wipe_unit(act_unit, ULR_USED, nullptr);
   }
 
   /* Detonate the nuke. */
@@ -2109,20 +2111,20 @@ static bool diplomat_success_vs_defender(struct unit *pattacker,
     const struct veteran_level
       *vdef = utype_veteran_level(unit_type_get(pdefender), pdefender->veteran);
 
-    fc_assert_ret_val(vatt != NULL && vdef != NULL, FALSE);
+    fc_assert_ret_val(vatt != nullptr && vdef != nullptr, FALSE);
 
     chance += vatt->power_fact - vdef->power_fact;
   }
 
   /* Reduce the chance of an attack by EFT_SPY_RESISTANT percent. */
   chance -= chance * get_target_bonus_effects(
-                         NULL,
+                         nullptr,
                          &(const struct req_context) {
                            .player = tile_owner(pdefender_tile),
                            .city = tile_city(pdefender_tile),
                            .tile = pdefender_tile,
                          },
-                         NULL,
+                         nullptr,
                          EFT_SPY_RESISTANT
                      ) / 100;
 
@@ -2141,16 +2143,16 @@ static bool diplomat_success_vs_defender(struct unit *pattacker,
   This determines if a diplomat/spy succeeds in infiltrating a tile.
 
   - The infiltrator must go up against each defender.
-  - The victim unit won't defend. (NULL if everyone should defend)
+  - The victim unit won't defend. (nullptr if everyone should defend)
   - One or the other is eliminated in each contest.
 
   - Return TRUE if the infiltrator succeeds.
 
   'pplayer' is the player who tries to do a spy/diplomat action on 'ptile'
-  with the unit 'pdiplomat' against 'cplayer'. If 'cplayer' is NULL the
+  with the unit 'pdiplomat' against 'cplayer'. If 'cplayer' is nullptr the
   owner of the chosen defender, if a defender can be chosen, gets its
   role.
-  'defender_owner' is, if non NULL, set to the owner of the unit that
+  'defender_owner' is, if non nullptr, set to the owner of the unit that
   defended.
 ****************************************************************************/
 static bool diplomat_infiltrate_tile(struct player *pplayer,
@@ -2179,7 +2181,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                                        paction))) {
     struct player *uplayer = unit_owner(punit);
 
-    if (defender_owner != NULL) {
+    if (defender_owner != nullptr) {
       /* Some action performers may want to know defender player. */
       *defender_owner = uplayer;
     }
@@ -2198,7 +2200,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                     link_unit, link_diplomat);
 
       if (pcity) {
-        if (uplayer == cplayer || cplayer == NULL) {
+        if (uplayer == cplayer || cplayer == nullptr) {
           notify_player(uplayer, ptile, E_MY_DIPLOMAT_FAILED, ftc_server,
                         /* TRANS: <unit> ... <city> ... <diplomat> */
                         _("Your %s has been eliminated defending %s"
@@ -2221,7 +2223,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                         link_city, link_diplomat);
         }
       } else {
-        if (uplayer == cplayer || cplayer == NULL) {
+        if (uplayer == cplayer || cplayer == nullptr) {
           notify_player(uplayer, ptile, E_MY_DIPLOMAT_FAILED, ftc_server,
                         /* TRANS: <unit> ... <diplomat> */
                         _("Your %s has been eliminated defending "
@@ -2247,7 +2249,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                              game.info.combat_odds_scaled_veterancy ? att_vet : 100)) {
         notify_unit_experience(pdiplomat);
       }
-      send_unit_info(NULL, pdiplomat);
+      send_unit_info(nullptr, pdiplomat);
       wipe_unit(punit, ULR_ELIMINATED, pplayer);
       return FALSE;
     } else {
@@ -2264,7 +2266,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                     link_diplomat, link_unit);
 
       if (pcity) {
-        if (uplayer == cplayer || cplayer == NULL) {
+        if (uplayer == cplayer || cplayer == nullptr) {
           notify_player(uplayer, ptile, E_ENEMY_DIPLOMAT_FAILED, ftc_server,
                         _("Eliminated a %s %s while infiltrating %s."),
                         nation_adjective_for_player(pplayer),
@@ -2282,7 +2284,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
                         link_diplomat, link_city);
         }
       } else {
-        if (uplayer == cplayer || cplayer == NULL) {
+        if (uplayer == cplayer || cplayer == nullptr) {
           notify_player(uplayer, ptile, E_ENEMY_DIPLOMAT_FAILED, ftc_server,
                         _("Eliminated a %s %s while infiltrating our troops."),
                         nation_adjective_for_player(pplayer),
@@ -2308,7 +2310,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
         notify_unit_experience(punit);
       }
 
-      victim_link = NULL;
+      victim_link = nullptr;
 
       switch (action_get_target_kind(paction)) {
       case ATK_CITY:
@@ -2331,7 +2333,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
         break;
       }
 
-      fc_assert(victim_link != NULL);
+      fc_assert(victim_link != nullptr);
 
       action_consequence_caught(paction, pplayer, act_utype, uplayer,
                                 ptile, victim_link);
@@ -2346,7 +2348,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
 
 /************************************************************************//**
   This determines if a diplomat/spy survives and escapes.
-  If "pcity" is NULL, assume action was in the field.
+  If "pcity" is nullptr, assume action was in the field.
 
   Spies have a game.server.diplchance specified chance of survival (better
   if veteran):
@@ -2366,10 +2368,10 @@ void diplomat_escape(struct player *pplayer, struct unit *pdiplomat,
     vlink = city_link(pcity);
   } else {
     ptile = unit_tile(pdiplomat);
-    vlink = NULL;
+    vlink = nullptr;
   }
 
-  return diplomat_escape_full(pplayer, pdiplomat, pcity != NULL,
+  return diplomat_escape_full(pplayer, pdiplomat, pcity != nullptr,
                               ptile, vlink, paction);
 }
 
@@ -2407,9 +2409,9 @@ static void diplomat_escape_full(struct player *pplayer,
       + (vunit->power_fact - vbase->power_fact);
   }
 
-  /* find closest city for escape target */
-  spyhome = find_closest_city(ptile, NULL, unit_owner(pdiplomat), FALSE,
-                              FALSE, FALSE, TRUE, FALSE, NULL);
+  /* Find closest city for escape target */
+  spyhome = find_closest_city(ptile, nullptr, unit_owner(pdiplomat), FALSE,
+                              FALSE, FALSE, TRUE, FALSE, nullptr);
 
   if (spyhome
       && !utype_is_consumed_by_action(paction, dipltype)
@@ -2429,7 +2431,7 @@ static void diplomat_escape_full(struct player *pplayer,
                                 /* Handled by the ruleset. */
                                 0,
                                 FALSE)) {
-      send_unit_info(NULL, pdiplomat);
+      send_unit_info(nullptr, pdiplomat);
       log_error("Bug in diplomat_escape: Spy can't teleport.");
       return;
     }
@@ -2453,7 +2455,7 @@ static void diplomat_escape_full(struct player *pplayer,
   if (!utype_is_consumed_by_action(paction, dipltype)) {
     /* The unit was caught, not spent. It must therefore be deleted by
      * hand. */
-    wipe_unit(pdiplomat, ULR_CAUGHT, NULL);
+    wipe_unit(pdiplomat, ULR_CAUGHT, nullptr);
   }
 }
 
@@ -2474,7 +2476,7 @@ bool spy_escape(struct player *pplayer,
   const char *vlink;
   const struct unit_type *act_utype = unit_type_get(actor_unit);
 
-  if (target_city != NULL) {
+  if (target_city != nullptr) {
     fc_assert(city_tile(target_city) == target_tile);
     vlink = city_link(target_city);
   } else {
@@ -2487,7 +2489,7 @@ bool spy_escape(struct player *pplayer,
                              target_tile, vlink);
 
   /* Try to escape. */
-  diplomat_escape_full(pplayer, actor_unit, target_city != NULL,
+  diplomat_escape_full(pplayer, actor_unit, target_city != nullptr,
                        target_tile, vlink, paction);
 
   return TRUE;
-- 
2.53.0

