From 33386c4baf4f3f5f2f618073ad11e88bf9a0d5a2 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 15 Nov 2026 09:58:04 +0200
Subject: [PATCH 71/71] daitech.c: Replace NULL with nullptr

See RM #2488

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

diff --git a/ai/default/daitech.c b/ai/default/daitech.c
index da6910c4ad..d5c4f84f13 100644
--- a/ai/default/daitech.c
+++ b/ai/default/daitech.c
@@ -228,15 +228,15 @@ static adv_want dai_tech_base_want(struct ai_type *ait, struct player *pplayer,
   struct research *pres = research_get(pplayer);
   Tech_type_id tech = advance_number(padv);
   enum tech_state old_state = research_invention_state(pres, tech);
-  struct adv_data *adv = adv_data_get(pplayer, NULL);
-  adv_want orig_want = dai_city_want(pplayer, pcity, adv, NULL);
+  struct adv_data *adv = adv_data_get(pplayer, nullptr);
+  adv_want orig_want = dai_city_want(pplayer, pcity, adv, nullptr);
   adv_want final_want;
   bool world_knew = game.info.global_advances[tech];
   int world_count = game.info.global_advance_count;
 
   research_invention_set(pres, tech, TECH_KNOWN);
 
-  final_want = dai_city_want(pplayer, pcity, adv, NULL);
+  final_want = dai_city_want(pplayer, pcity, adv, nullptr);
 
   research_invention_set(pres, tech, old_state);
   game.info.global_advances[tech] = world_knew;
@@ -252,7 +252,7 @@ static void dai_tech_effect_values(struct ai_type *ait, struct player *pplayer)
 {
   /* TODO: Currently this duplicates code from daicity.c improvement effect
    *       evaluating almost verbose - refactor so that they can share code. */
-  struct adv_data *adv = adv_data_get(pplayer, NULL);
+  struct adv_data *adv = adv_data_get(pplayer, nullptr);
   struct ai_plr *aip = def_ai_player_data(pplayer, ait);
   int turns = 9999; /* TODO: Set to correct value */
   int nplayers = normal_player_count();
@@ -296,10 +296,9 @@ static void dai_tech_effect_values(struct ai_type *ait, struct player *pplayer)
               present = preq->present;
               continue;
             }
-            if (!is_req_active(&context, NULL, preq, RPT_POSSIBLE)) {
+            if (!is_req_active(&context, nullptr, preq, RPT_POSSIBLE)) {
               active = FALSE;
-              break; /* presence doesn't matter for inactive effects. */
-
+              break; /* Presence doesn't matter for inactive effects. */
             }
           } requirement_vector_iterate_end;
 
@@ -383,7 +382,7 @@ void dai_manage_tech(struct ai_type *ait, struct player *pplayer)
 }
 
 /**********************************************************************//**
-  Returns the best defense multiplier unit we can build, or NULL if none.
+  Returns the best defense multiplier unit we can build, or nullptr if none.
   Assigns tech wants for techs to get better units, but only for the
   cheapest to research.
 **************************************************************************/
@@ -395,15 +394,15 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait,
 {
   struct research *presearch = research_get(pplayer);
   int best_avl_def = 0;
-  struct unit_type *best_avl = NULL;
+  struct unit_type *best_avl = nullptr;
   int best_cost = FC_INFINITY;
   struct advance *best_tech = A_NEVER;
-  struct unit_type *best_unit = NULL;
+  struct unit_type *best_unit = nullptr;
   struct tile *ptile = city_tile(pcity);
   int def_values[U_LAST];
   int att_idx = utype_index(att);
   int defbonus = 100
-    + get_unittype_bonus(pplayer, ptile, att, NULL, EFT_DEFEND_BONUS);
+    + get_unittype_bonus(pplayer, ptile, att, nullptr, EFT_DEFEND_BONUS);
 
   unit_type_iterate(deftype) {
     int mp_pct = deftype->cache.defense_mp_bonuses_pct[att_idx] + 100;
@@ -451,7 +450,7 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait,
       } unit_tech_reqs_iterate_end;
 
       building = utype_needs_improvement(deftype, pcity);
-      if (building != NULL
+      if (building != nullptr
           && !can_player_build_improvement_direct(pplayer, building,
                                                   RPT_CERTAIN)) {
         const struct req_context context = {
@@ -463,7 +462,7 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait,
         };
 
         requirement_vector_iterate(&building->reqs, preq) {
-          if (!is_req_active(&context, NULL, preq, RPT_CERTAIN)) {
+          if (!is_req_active(&context, nullptr, preq, RPT_CERTAIN)) {
 
             if (VUT_ADVANCE == preq->source.kind && preq->present) {
               int iimprtech = advance_number(preq->source.value.advance);
@@ -498,9 +497,10 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait,
     struct ai_plr *plr_data = def_ai_player_data(pplayer, ait);
 
     /* Crank up chosen tech want */
-    if (best_avl != NULL
+    if (best_avl != nullptr
         && def_values[utype_index(best_unit)] <= 1.5 * best_avl_def) {
-      /* We already have almost as good unit suitable for defending against this attacker */
+      /* We already have almost as good unit suitable for defending against
+       * this attacker */
       want /= 2;
     }
 
@@ -515,7 +515,7 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait,
 }
 
 /**********************************************************************//**
-  Returns the best unit we can build, or NULL if none. "Best" here
+  Returns the best unit we can build, or nullptr if none. "Best" here
   means last in the unit list as defined in the ruleset. Assigns tech
   wants for techs to get better units with given role, but only for the
   cheapest to research "next" unit up the "chain".
@@ -527,8 +527,8 @@ struct unit_type *dai_wants_role_unit(struct ai_type *ait, struct player *pplaye
   int i, n;
   int best_cost = FC_INFINITY;
   struct advance *best_tech = A_NEVER;
-  struct unit_type *best_unit = NULL;
-  struct unit_type *build_unit = NULL;
+  struct unit_type *best_unit = nullptr;
+  struct unit_type *build_unit = nullptr;
   const struct civ_map *nmap = &(wld.map);
 
   n = num_role_units(role);
@@ -558,7 +558,7 @@ struct unit_type *dai_wants_role_unit(struct ai_type *ait, struct player *pplaye
       } unit_tech_reqs_iterate_end;
 
       building = utype_needs_improvement(iunit, pcity);
-      if (building != NULL
+      if (building != nullptr
           && !can_player_build_improvement_direct(pplayer, building,
                                                   RPT_CERTAIN)) {
         requirement_vector_iterate(&building->reqs, preq) {
@@ -595,7 +595,7 @@ struct unit_type *dai_wants_role_unit(struct ai_type *ait, struct player *pplaye
     struct ai_plr *plr_data = def_ai_player_data(pplayer, ait);
 
     /* Crank up chosen tech want */
-    if (build_unit != NULL) {
+    if (build_unit != nullptr) {
       /* We already have a role unit of this kind */
       want /= 2;
     }
-- 
2.53.0

