From 91fe8ce02bfe28f7772d7eabc6b37e8d6371d4c4 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 3 Jan 2026 03:40:18 +0200
Subject: [PATCH 43/43] city.[ch]: Replace NULL with nullptr

See RM #1859

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/city.c | 274 ++++++++++++++++++++++++++------------------------
 common/city.h | 156 ++++++++++++++--------------
 2 files changed, 219 insertions(+), 211 deletions(-)

diff --git a/common/city.c b/common/city.c
index 97ccf8dd69..5de2ecf813 100644
--- a/common/city.c
+++ b/common/city.c
@@ -57,7 +57,7 @@ static void citylog_map_radius_sq(enum log_level level);
 #endif /* FREECIV_DEBUG */
 
 /* Get city tile information using the city tile index. */
-static struct iter_index *city_map_index = NULL;
+static struct iter_index *city_map_index = nullptr;
 /* Get city tile information using the city tile coordinates. This is an
  * [x][y] array of integer values corresponding to city_map_index. The
  * coordinates x and y are in the range [0, CITY_MAP_MAX_SIZE] */
@@ -81,7 +81,7 @@ static const struct city *nearest_gov_center(const struct city *pcity,
                                              int *min_dist)
   fc__attribute((nonnull (1, 2)));
 
-struct citystyle *city_styles = NULL;
+struct citystyle *city_styles = nullptr;
 
 /* One day these values may be read in from the ruleset. In the meantime
  * they're just an easy way to access information about each output type. */
@@ -136,8 +136,8 @@ int city_tile_xy_to_index(int city_map_x, int city_map_y,
 **************************************************************************/
 int city_map_radius_sq_get(const struct city *pcity)
 {
-  /* a save return value is only the minimal squared radius */
-  fc_assert_ret_val(pcity != NULL, CITY_MAP_MIN_RADIUS_SQ);
+  /* A safe return value is only the minimal squared radius */
+  fc_assert_ret_val(pcity != nullptr, CITY_MAP_MIN_RADIUS_SQ);
 
   return pcity->city_radius_sq;
 }
@@ -159,7 +159,7 @@ void city_map_radius_sq_set(struct city *pcity, int radius_sq)
 int rs_max_city_radius_sq(void)
 {
   int max_rad = game.info.init_city_radius_sq
-    + effect_cumulative_max(EFT_CITY_RADIUS_SQ, NULL, 0);
+    + effect_cumulative_max(EFT_CITY_RADIUS_SQ, nullptr, 0);
 
   return MIN(max_rad, CITY_MAP_MAX_RADIUS_SQ);
 }
@@ -310,7 +310,7 @@ struct tile *city_map_to_tile(const struct civ_map *nmap,
   int tile_x, tile_y;
 
   fc_assert_ret_val(is_valid_city_coords(city_radius_sq, city_map_x,
-                                         city_map_y), NULL);
+                                         city_map_y), nullptr);
 
   index_to_map_pos(&tile_x, &tile_y, tile_index(city_center));
   tile_x += CITY_ABS2REL(city_map_x);
@@ -371,7 +371,7 @@ static char *citylog_map_line(int y, int city_radius_sq, int *city_map_data)
   int x, mindex;
   static char citylog[128], tmp[8];
 
-  fc_assert_ret_val(city_map_data != NULL, NULL);
+  fc_assert_ret_val(city_map_data != nullptr, nullptr);
 
   /* print y coordinates (absolute) */
   fc_snprintf(citylog, sizeof(citylog), "%2d ", y);
@@ -445,10 +445,10 @@ void citylog_map_data(enum log_level level, int radius_sq, int *map_data)
 **************************************************************************/
 void citylog_map_workers(enum log_level level, struct city *pcity)
 {
-  int *city_map_data = NULL;
+  int *city_map_data = nullptr;
   const struct civ_map *nmap = &(wld.map);
 
-  fc_assert_ret(pcity != NULL);
+  fc_assert_ret(pcity != nullptr);
 
   if (!log_do_output_for_level(level)) {
     return;
@@ -477,7 +477,7 @@ void citylog_map_workers(enum log_level level, struct city *pcity)
 **************************************************************************/
 static void citylog_map_index(enum log_level level)
 {
-  int *city_map_data = NULL;
+  int *city_map_data = nullptr;
 
   if (!log_do_output_for_level(level)) {
     return;
@@ -500,7 +500,7 @@ static void citylog_map_index(enum log_level level)
 **************************************************************************/
 static void citylog_map_radius_sq(enum log_level level)
 {
-  int *city_map_data = NULL;
+  int *city_map_data = nullptr;
 
   if (!log_do_output_for_level(level)) {
     return;
@@ -564,10 +564,10 @@ void generate_city_map_indices(void)
     }
   }
 
-  fc_assert(NULL == city_map_index);
+  fc_assert(city_map_index == nullptr);
   city_map_index = fc_malloc(city_count_tiles * sizeof(*city_map_index));
 
-  /* copy the index numbers from city_map_index_tmp into city_map_index */
+  /* Copy the index numbers from city_map_index_tmp into city_map_index */
   for (i = 0; i < city_count_tiles; i++) {
     city_map_index[i] = city_map_index_tmp[i];
   }
@@ -575,7 +575,7 @@ void generate_city_map_indices(void)
   qsort(city_map_index, city_count_tiles, sizeof(*city_map_index),
         compare_iter_index);
 
-  /* set the static variable city_map_xy */
+  /* Set the static variable city_map_xy */
   for (i = 0; i < city_count_tiles; i++) {
     city_x = CITY_REL2ABS(city_map_index[i].dx);
     city_y = CITY_REL2ABS(city_map_index[i].dy);
@@ -618,7 +618,8 @@ void free_city_map_index(void)
 **************************************************************************/
 const char *get_output_identifier(Output_type_id output)
 {
-  fc_assert_ret_val(output >= 0 && output < O_LAST, NULL);
+  fc_assert_ret_val(output >= 0 && output < O_LAST, nullptr);
+
   return output_types[output].id;
 }
 
@@ -628,7 +629,8 @@ const char *get_output_identifier(Output_type_id output)
 **************************************************************************/
 const char *get_output_name(Output_type_id output)
 {
-  fc_assert_ret_val(output >= 0 && output < O_LAST, NULL);
+  fc_assert_ret_val(output >= 0 && output < O_LAST, nullptr);
+
   return _(output_types[output].name);
 }
 
@@ -637,7 +639,8 @@ const char *get_output_name(Output_type_id output)
 **************************************************************************/
 struct output_type *get_output_type(Output_type_id output)
 {
-  fc_assert_ret_val(output >= 0 && output < O_LAST, NULL);
+  fc_assert_ret_val(output >= 0 && output < O_LAST, nullptr);
+
   return &output_types[output];
 }
 
@@ -661,10 +664,10 @@ Output_type_id output_type_by_identifier(const char *id)
   Return the extended name of the building.
 **************************************************************************/
 const char *city_improvement_name_translation(const struct city *pcity,
-					      const struct impr_type *pimprove)
+                                              const struct impr_type *pimprove)
 {
   static char buffer[256];
-  const char *state = NULL;
+  const char *state = nullptr;
 
   if (is_great_wonder(pimprove)) {
     if (great_wonder_is_available(pimprove)) {
@@ -725,7 +728,7 @@ bool city_production_is_genus(const struct city *pcity,
   Return TRUE when the current production has this flag.
 **************************************************************************/
 bool city_production_has_flag(const struct city *pcity,
-			      enum impr_flag_id flag)
+                              enum impr_flag_id flag)
 {
   return VUT_IMPROVEMENT == pcity->production.kind
       && improvement_has_flag(pcity->production.value.building, flag);
@@ -753,17 +756,18 @@ bool city_production_build_units(const struct city *pcity,
   int shields_left = pcity->shield_stock;
   int unit_shield_cost, i;
 
-  fc_assert_ret_val(num_units != NULL, FALSE);
+  fc_assert_ret_val(num_units != nullptr, FALSE);
+
   (*num_units) = 0;
 
   if (pcity->production.kind != VUT_UTYPE) {
-    /* not a unit as the current production */
+    /* Not a unit as the current production */
     return FALSE;
   }
 
   utype = pcity->production.value.utype;
   if (utype_pop_value(utype, pcity) != 0 || utype_has_flag(utype, UTYF_UNIQUE)) {
-    /* unit with population cost or unique unit means that only one unit can
+    /* Unit with population cost or unique unit means that only one unit can
      * be build */
     (*num_units)++;
     return FALSE;
@@ -773,11 +777,11 @@ bool city_production_build_units(const struct city *pcity,
     shields_left += pcity->prod[O_SHIELD];
   }
 
-  unit_shield_cost = utype_build_shield_cost(pcity, NULL, utype);
+  unit_shield_cost = utype_build_shield_cost(pcity, nullptr, utype);
 
   for (i = 0; i < build_slots; i++) {
     if (shields_left < unit_shield_cost) {
-      /* not enough shields */
+      /* Not enough shields */
       break;
     }
 
@@ -788,7 +792,7 @@ bool city_production_build_units(const struct city *pcity,
       (void) worklist_peek_ith(&pcity->worklist, &target, i);
       if (target.kind != VUT_UTYPE
           || utype_index(target.value.utype) != utype_index(utype)) {
-        /* stop if there is a build target in the worklist not equal to the
+        /* Stop if there is a build target in the worklist not equal to the
          * unit we build */
         break;
       }
@@ -805,7 +809,7 @@ int city_production_unit_veteran_level(struct city *pcity,
                                        const struct unit_type *punittype)
 {
   int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
-                                  NULL, EFT_VETERAN_BUILD);
+                                  nullptr, EFT_VETERAN_BUILD);
   int max_levels = utype_veteran_levels(punittype) - 1;
 
   levels = CLIP(0, levels, max_levels);
@@ -843,7 +847,7 @@ bool can_city_build_improvement_direct(const struct city *pcity,
                            .city = pcity,
                            .tile = pcity->tile,
                          },
-                         NULL,
+                         nullptr,
                          &(pimprove->reqs), RPT_CERTAIN);
 }
 
@@ -888,7 +892,7 @@ bool can_city_build_improvement_later(const struct city *pcity,
   /* Check for requirements that aren't met and that are unchanging (so
    * they can never be met). */
   requirement_vector_iterate(&pimprove->reqs, preq) {
-    if (is_req_preventing(&city_ctxt, NULL, preq, RPT_POSSIBLE)) {
+    if (is_req_preventing(&city_ctxt, nullptr, preq, RPT_POSSIBLE)) {
       return FALSE;
     }
   } requirement_vector_iterate_end;
@@ -920,7 +924,7 @@ bool can_city_build_unit_direct(const struct civ_map *nmap,
                                 .tile = city_tile(pcity),
                                 .unittype = punittype,
                               },
-                              NULL,
+                              nullptr,
                               &punittype->build_reqs, RPT_CERTAIN)) {
     return FALSE;
   }
@@ -969,7 +973,7 @@ bool can_city_build_unit_now(const struct civ_map *nmap,
 **************************************************************************/
 bool can_city_build_unit_later(const struct civ_map *nmap,
                                const struct city *pcity,
-			       const struct unit_type *punittype)
+                               const struct unit_type *punittype)
 {
   /* Can the _player_ ever build this unit? */
   if (!can_player_build_unit_later(city_owner(pcity), punittype)) {
@@ -1069,7 +1073,7 @@ bool city_can_use_specialist(const struct city *pcity,
                            .player = city_owner(pcity),
                            .city = pcity,
                          },
-                         NULL,
+                         nullptr,
                          &specialist_by_number(type)->reqs, RPT_POSSIBLE);
 }
 
@@ -1086,7 +1090,7 @@ bool city_can_change_build(const struct city *pcity)
 **************************************************************************/
 void city_choose_build_default(const struct civ_map *nmap, struct city *pcity)
 {
-  if (NULL == city_tile(pcity)) {
+  if (city_tile(pcity) == nullptr) {
     /* When a "dummy" city is created with no tile, then choosing a build
      * target could fail. This currently might happen during map editing.
      * FIXME: assumes the first unit is always "valid", so check for
@@ -1136,7 +1140,7 @@ void city_choose_build_default(const struct civ_map *nmap, struct city *pcity)
 **************************************************************************/
 const char *city_name_get(const struct city *pcity)
 {
-  return (pcity->name != NULL) ? pcity->name : "City missing a name";
+  return (pcity->name != nullptr) ? pcity->name : "City missing a name";
 }
 
 /**********************************************************************//**
@@ -1180,7 +1184,7 @@ const char *city_name_getx(const struct city *pcity)
 **************************************************************************/
 void city_name_set(struct city *pcity, const char *new_name)
 {
-  if (pcity->name != NULL) {
+  if (pcity->name != nullptr) {
     free(pcity->name);
   }
 
@@ -1201,7 +1205,7 @@ void city_size_add(struct city *pcity, int add)
 {
   citizens size = city_size_get(pcity);
 
-  fc_assert_ret(pcity != NULL);
+  fc_assert_ret(pcity != nullptr);
   fc_assert_ret(MAX_CITY_SIZE - size >= add);
 
   /* Client sets size to zero to start stacking citizens in */
@@ -1215,7 +1219,7 @@ void city_size_add(struct city *pcity, int add)
 **************************************************************************/
 void city_size_set(struct city *pcity, citizens size)
 {
-  fc_assert_ret(pcity != NULL);
+  fc_assert_ret(pcity != nullptr);
 
   /* Set city size. */
   pcity->size = size;
@@ -1238,7 +1242,7 @@ int city_total_impr_gold_upkeep(const struct city *pcity)
 {
   int gold_needed = 0;
 
-  if (pcity == NULL) {
+  if (pcity == nullptr) {
     return 0;
   }
 
@@ -1259,7 +1263,7 @@ int city_total_unit_gold_upkeep(const struct city *pcity)
 {
   int gold_needed = 0;
 
-  if (pcity == NULL || pcity->units_supported == NULL) {
+  if (pcity == nullptr || pcity->units_supported == nullptr) {
     return 0;
   }
 
@@ -1276,11 +1280,12 @@ int city_total_unit_gold_upkeep(const struct city *pcity)
 bool city_has_building(const struct city *pcity,
                        const struct impr_type *pimprove)
 {
-  if (NULL == pimprove) {
+  if (pimprove == nullptr) {
     /* Callers should ensure that any external data is tested with
      * valid_improvement_by_number() */
     return FALSE;
   }
+
   return (pcity->built[improvement_index(pimprove)].turn > I_NEVER);
 }
 
@@ -1293,7 +1298,7 @@ int city_improvement_upkeep(const struct city *pcity,
 {
   int upkeep;
 
-  if (NULL == b) {
+  if (b == nullptr) {
     return 0;
   }
   if (!is_building_sellable(b)) {
@@ -1310,7 +1315,7 @@ int city_improvement_upkeep(const struct city *pcity,
 
 /**********************************************************************//**
   Calculate the output for the tile.
-  pcity may be NULL.
+  pcity may be nullptr.
   is_celebrating may be speculative.
   otype is the output type (generally O_FOOD, O_TRADE, or O_SHIELD).
 
@@ -1321,7 +1326,7 @@ int city_tile_output(const struct city *pcity, const struct tile *ptile,
 {
   int prod;
   const struct req_context city_ctxt = {
-    .player = pcity ? city_owner(pcity) : NULL,
+    .player = pcity ? city_owner(pcity) : nullptr,
     .city = pcity,
     .tile = ptile,
   };
@@ -1331,7 +1336,7 @@ int city_tile_output(const struct city *pcity, const struct tile *ptile,
   fc_assert_ret_val(otype >= 0 && otype < O_LAST, 0);
 
   if (T_UNKNOWN == pterrain) {
-    /* Special case for the client.  The server doesn't allow unknown tiles
+    /* Special case for the client. The server doesn't allow unknown tiles
      * to be worked but we don't necessarily know what player is involved. */
     return 0;
   }
@@ -1345,14 +1350,14 @@ int city_tile_output(const struct city *pcity, const struct tile *ptile,
   case O_SHIELD:
     if (pterrain->mining_shield_incr != 0) {
       prod += pterrain->mining_shield_incr
-        * get_target_bonus_effects(NULL, &city_ctxt, NULL, EFT_MINING_PCT)
+        * get_target_bonus_effects(nullptr, &city_ctxt, nullptr, EFT_MINING_PCT)
         / 100;
     }
     break;
   case O_FOOD:
     if (pterrain->irrigation_food_incr != 0) {
       prod += pterrain->irrigation_food_incr
-        * get_target_bonus_effects(NULL, &city_ctxt, NULL,
+        * get_target_bonus_effects(nullptr, &city_ctxt, nullptr,
                                    EFT_IRRIGATION_PCT) / 100;
     }
     break;
@@ -1400,7 +1405,7 @@ int city_tile_output(const struct city *pcity, const struct tile *ptile,
                                    EFT_OUTPUT_TILE_PUNISH_PCT))
            / 100;
 
-  if (NULL != pcity && is_city_center(pcity, ptile)) {
+  if (pcity != nullptr && is_city_center(pcity, ptile)) {
     prod = MAX(prod, game.info.min_city_center_output[otype]);
   }
 
@@ -1442,7 +1447,7 @@ bool base_city_can_work_tile(const struct player *restriction,
   int city_map_x, city_map_y;
   struct player *towner;
 
-  if (NULL == ptile) {
+  if (ptile == nullptr) {
     return FALSE;
   }
 
@@ -1450,19 +1455,19 @@ bool base_city_can_work_tile(const struct player *restriction,
     return FALSE;
   }
 
-  if (NULL != restriction
+  if (restriction != nullptr
       && TILE_UNKNOWN == tile_get_known(ptile, restriction)) {
     return FALSE;
   }
 
   towner = tile_owner(ptile);
-  if (NULL != towner && towner != powner
+  if (towner != nullptr && towner != powner
       && !gives_shared_tiles(towner, powner)) {
     return FALSE;
   }
   /* TODO: civ3-like option for borders */
 
-  if (NULL != tile_worked(ptile) && tile_worked(ptile) != pcity) {
+  if (tile_worked(ptile) != nullptr && tile_worked(ptile) != pcity) {
     return FALSE;
   }
 
@@ -1472,11 +1477,11 @@ bool base_city_can_work_tile(const struct player *restriction,
   }
 
   if (!is_free_worked(pcity, ptile)
-      && NULL != unit_occupies_tile(ptile, powner)) {
+      && unit_occupies_tile(ptile, powner) != nullptr) {
     return FALSE;
   }
 
-  if (get_city_tile_output_bonus(pcity, ptile, NULL, EFT_TILE_WORKABLE) <= 0) {
+  if (get_city_tile_output_bonus(pcity, ptile, nullptr, EFT_TILE_WORKABLE) <= 0) {
     return FALSE;
   }
 
@@ -1517,8 +1522,8 @@ bool citymindist_prevents_city_on_tile(const struct civ_map *nmap,
   Returns TRUE if the given unit can build a city at the given map
   coordinates.
 
-  punit is the founding unit. It may be NULL if a city is built out of the
-  blue (e.g., through editing).
+  punit is the founding unit. It may be nullptr if a city is built out of
+  the blue (e.g., through editing).
 **************************************************************************/
 bool city_can_be_built_here(const struct civ_map *nmap,
                             const struct tile *ptile,
@@ -1529,7 +1534,7 @@ bool city_can_be_built_here(const struct civ_map *nmap,
     return FALSE;
   }
 
-  if (punit == NULL) {
+  if (punit == nullptr) {
     /* The remaining checks tests if punit can found a city here */
     return TRUE;
   }
@@ -1546,7 +1551,7 @@ bool city_can_be_built_here(const struct civ_map *nmap,
 
     towner = tile_owner(ptile);
 
-    if (towner == NULL || towner == unit_owner(punit)) {
+    if (towner == nullptr || towner == unit_owner(punit)) {
       return TRUE;
     }
 
@@ -1626,8 +1631,8 @@ bool is_gov_center(const struct city *pcity)
 }
 
 /**********************************************************************//**
- This can be City Walls, Coastal defense... depending on attacker type.
- If attacker type is not given, just any defense effect will do.
+  This can be City Walls, Coastal defense... depending on attacker type.
+  If attacker type is not given, just any defense effect will do.
 **************************************************************************/
 bool city_got_defense_effect(const struct city *pcity,
                              const struct unit_type *attacker)
@@ -1638,11 +1643,11 @@ bool city_got_defense_effect(const struct city *pcity,
   }
 
   return get_unittype_bonus(city_owner(pcity), pcity->tile, attacker,
-                            NULL, EFT_DEFEND_BONUS) > 0;
+                            nullptr, EFT_DEFEND_BONUS) > 0;
 }
 
 /**********************************************************************//**
-  Return TRUE iff the city is happy.  A happy city will start celebrating
+  Return TRUE iff the city is happy. A happy city will start celebrating
   soon.
   A city can only be happy if half or more of the population is happy,
   none of the population is unhappy or angry, and it has sufficient size.
@@ -1650,9 +1655,9 @@ bool city_got_defense_effect(const struct city *pcity,
 bool city_happy(const struct city *pcity)
 {
   return (city_size_get(pcity) >= game.info.celebratesize
-	  && pcity->feel[CITIZEN_ANGRY][FEELING_FINAL] == 0
-	  && pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL] == 0
-	  && pcity->feel[CITIZEN_HAPPY][FEELING_FINAL] >= (city_size_get(pcity) + 1) / 2);
+          && pcity->feel[CITIZEN_ANGRY][FEELING_FINAL] == 0
+          && pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL] == 0
+          && pcity->feel[CITIZEN_HAPPY][FEELING_FINAL] >= (city_size_get(pcity) + 1) / 2);
 }
 
 /**********************************************************************//**
@@ -1662,8 +1667,8 @@ bool city_happy(const struct city *pcity)
 bool city_unhappy(const struct city *pcity)
 {
   return (pcity->feel[CITIZEN_HAPPY][FEELING_FINAL]
-	< pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL]
-	  + 2 * pcity->feel[CITIZEN_ANGRY][FEELING_FINAL]);
+          < pcity->feel[CITIZEN_UNHAPPY][FEELING_FINAL]
+          + 2 * pcity->feel[CITIZEN_ANGRY][FEELING_FINAL]);
 }
 
 /**********************************************************************//**
@@ -1691,7 +1696,7 @@ bool city_rapture_grow(const struct city *pcity)
   /* .rapture is checked instead of city_celebrating() because this
      function is called after .was_happy was updated. */
   return (pcity->rapture > 0 && pcity->surplus[O_FOOD] > 0
-	  && (pcity->rapture % game.info.rapturedelay) == 0
+          && (pcity->rapture % game.info.rapturedelay) == 0
           && get_city_bonus(pcity, EFT_RAPTURE_GROW) > 0);
 }
 
@@ -1717,12 +1722,12 @@ struct city *city_list_find_number(struct city_list *This, int id)
   if (id != 0) {
     city_list_iterate(This, pcity) {
       if (pcity->id == id) {
-	return pcity;
+        return pcity;
       }
     } city_list_iterate_end;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -1736,7 +1741,7 @@ struct city *city_list_find_name(struct city_list *This, const char *name)
     }
   } city_list_iterate_end;
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -2033,7 +2038,7 @@ int city_turns_to_grow(const struct city *pcity)
 {
   if (pcity->surplus[O_FOOD] > 0) {
     return (city_granary_size(city_size_get(pcity)) - pcity->food_stock +
-	    pcity->surplus[O_FOOD] - 1) / pcity->surplus[O_FOOD];
+            pcity->surplus[O_FOOD] - 1) / pcity->surplus[O_FOOD];
   } else if (pcity->surplus[O_FOOD] < 0) {
     /* Turns before famine loss */
     return -1 + (pcity->food_stock / pcity->surplus[O_FOOD]);
@@ -2059,11 +2064,11 @@ struct city *tile_enemy_city(const struct tile *ptile,
 {
   struct city *pcity = tile_city(ptile);
 
-  if (pcity != NULL && pplayers_at_war(pplayer, city_owner(pcity))) {
+  if (pcity != nullptr && pplayers_at_war(pplayer, city_owner(pcity))) {
     return pcity;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -2074,11 +2079,11 @@ struct city *tile_allied_city(const struct tile *ptile,
 {
   struct city *pcity = tile_city(ptile);
 
-  if (pcity != NULL && pplayers_allied(pplayer, city_owner(pcity))) {
+  if (pcity != nullptr && pplayers_allied(pplayer, city_owner(pcity))) {
     return pcity;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -2089,11 +2094,11 @@ struct city *tile_non_attack_city(const struct tile *ptile,
 {
   struct city *pcity = tile_city(ptile);
 
-  if (pcity != NULL && pplayers_non_attack(pplayer, city_owner(pcity))) {
+  if (pcity != nullptr && pplayers_non_attack(pplayer, city_owner(pcity))) {
     return pcity;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -2104,11 +2109,11 @@ struct city *tile_non_allied_city(const struct tile *ptile,
 {
   struct city *pcity = tile_city(ptile);
 
-  if (pcity != NULL && !pplayers_allied(pplayer, city_owner(pcity))) {
+  if (pcity != nullptr && !pplayers_allied(pplayer, city_owner(pcity))) {
     return pcity;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -2243,15 +2248,15 @@ citizens player_angry_citizens(const struct player *pplayer)
 }
 
 /**********************************************************************//**
- Return the factor (in %) by which the city's output should be multiplied.
+  Return the factor (in %) by which the city's output should be multiplied.
 **************************************************************************/
 int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype)
 {
   struct output_type *output = &output_types[otype];
-  int bonus1 = 100 + get_city_tile_output_bonus(pcity, NULL, output,
-						EFT_OUTPUT_BONUS);
-  int bonus2 = 100 + get_city_tile_output_bonus(pcity, NULL, output,
-						EFT_OUTPUT_BONUS_2);
+  int bonus1 = 100 + get_city_tile_output_bonus(pcity, nullptr, output,
+                                                EFT_OUTPUT_BONUS);
+  int bonus2 = 100 + get_city_tile_output_bonus(pcity, nullptr, output,
+                                                EFT_OUTPUT_BONUS_2);
 
   return MAX(bonus1 * bonus2 / 100, 0);
 }
@@ -2323,7 +2328,7 @@ bool city_built_last_turn(const struct city *pcity)
 static const struct city *nearest_gov_center(const struct city *pcity,
                                              int *min_dist)
 {
-  const struct city *gov_center = NULL;
+  const struct city *gov_center = nullptr;
 
   *min_dist = FC_INFINITY;
 
@@ -2371,10 +2376,10 @@ static inline void get_worked_tile_output(const struct civ_map *nmap,
 
   city_tile_iterate_index(nmap, city_map_radius_sq_get(pcity), pcenter, ptile,
                           city_tile_index) {
-    if (workers_map == NULL) {
+    if (workers_map == nullptr) {
       struct city *pwork = tile_worked(ptile);
 
-      is_worked = (NULL != pwork && pwork == pcity);
+      is_worked = (pwork != nullptr && pwork == pcity);
     } else {
       is_worked = workers_map[city_tile_index];
     }
@@ -2449,7 +2454,7 @@ static inline void city_tile_cache_update(const struct civ_map *nmap,
   int radius_sq = city_map_radius_sq_get(pcity);
 
   /* Initialize tile_cache if needed */
-  if (pcity->tile_cache == NULL || pcity->tile_cache_radius_sq == -1
+  if (pcity->tile_cache == nullptr || pcity->tile_cache_radius_sq == -1
       || pcity->tile_cache_radius_sq != radius_sq) {
     pcity->tile_cache = fc_realloc(pcity->tile_cache,
                                    city_map_tiles(radius_sq)
@@ -2501,7 +2506,7 @@ static void set_surpluses(struct city *pcity)
         int min_dist;
         const struct city *gov_center = nearest_gov_center(pcity, &min_dist);
 
-        if (gov_center == NULL) {
+        if (gov_center == nullptr) {
           /* No gov center - no income */
           waste_level = 100;
         } else {
@@ -2799,21 +2804,21 @@ static inline void unhappy_city_check(struct city *pcity)
     output_type_iterate(o) {
       switch (output_types[o].unhappy_penalty) {
       case UNHAPPY_PENALTY_NONE:
-	pcity->unhappy_penalty[o] = 0;
-	break;
+        pcity->unhappy_penalty[o] = 0;
+        break;
       case UNHAPPY_PENALTY_SURPLUS:
-	pcity->unhappy_penalty[o] = MAX(pcity->prod[o] - pcity->usage[o], 0);
-	break;
+        pcity->unhappy_penalty[o] = MAX(pcity->prod[o] - pcity->usage[o], 0);
+        break;
       case UNHAPPY_PENALTY_ALL_PRODUCTION:
-	pcity->unhappy_penalty[o] = pcity->prod[o];
-	break;
+        pcity->unhappy_penalty[o] = pcity->prod[o];
+        break;
       }
 
       pcity->prod[o] -= pcity->unhappy_penalty[o];
     } output_type_iterate_end;
   } else {
     memset(pcity->unhappy_penalty, 0,
- 	   O_LAST * sizeof(*pcity->unhappy_penalty));
+           O_LAST * sizeof(*pcity->unhappy_penalty));
   }
 }
 
@@ -2821,7 +2826,7 @@ static inline void unhappy_city_check(struct city *pcity)
   Calculate the pollution from production and population in the city.
 **************************************************************************/
 int city_pollution_types(const struct city *pcity, int shield_total,
-			 int *pollu_prod, int *pollu_pop, int *pollu_mod)
+                         int *pollu_prod, int *pollu_pop, int *pollu_mod)
 {
   int prod, pop, mod;
 
@@ -2856,7 +2861,8 @@ int city_pollution_types(const struct city *pcity, int shield_total,
 **************************************************************************/
 int city_pollution(const struct city *pcity, int shield_total)
 {
-  return city_pollution_types(pcity, shield_total, NULL, NULL, NULL);
+  return city_pollution_types(pcity, shield_total,
+                              nullptr, nullptr, nullptr);
 }
 
 /**********************************************************************//**
@@ -2865,7 +2871,7 @@ int city_pollution(const struct city *pcity, int shield_total)
   of both cities. The health penalty is given as the product of the ruleset
   option 'game.info.illness_trade_infection' (in percent) and the square
   root of the product of the size of both cities.
- *************************************************************************/
+**************************************************************************/
 static int get_trade_illness(const struct city *pcity)
 {
   float illness_trade = 0.0;
@@ -3016,12 +3022,12 @@ inline void set_city_production(struct city *pcity)
      * there's just a placeholder city with a placeholder owner
      * created for some tile->worked. */
     if (!is_server()
-        && (tcity == NULL
-            || city_owner(tcity)->slot == NULL)) {
+        && (tcity == nullptr
+            || city_owner(tcity)->slot == nullptr)) {
       continue;
     }
 
-    fc_assert_action(tcity != NULL, continue);
+    fc_assert_action(tcity != nullptr, continue);
 
     can_trade = can_cities_trade(pcity, tcity);
 
@@ -3048,15 +3054,15 @@ inline void set_city_production(struct city *pcity)
   } trade_routes_iterate_end;
   pcity->prod[O_GOLD] += get_city_tithes_bonus(pcity);
 
-  /* Account for waste.  Note that waste is calculated before tax income is
+  /* Account for waste. Note that waste is calculated before tax income is
    * calculated, so if you had "science waste" it would not include taxed
-   * science.  However waste is calculated after the bonuses are multiplied
+   * science. However waste is calculated after the bonuses are multiplied
    * on, so shield waste will include shield bonuses. */
   output_type_iterate(o) {
     int prod = pcity->prod[o] * pcity->bonus[o] / 100 + pcity->abs_bonus[o];
 
     prod = MAX(prod, 0);
-    pcity->waste[o] = city_waste(pcity, o, prod, NULL);
+    pcity->waste[o] = city_waste(pcity, o, prod, nullptr);
   } output_type_iterate_end;
 
   /* Convert trade into science/luxury/gold, and add this on to whatever
@@ -3090,12 +3096,12 @@ int city_unit_unhappiness(const struct civ_map *nmap,
   struct player *plr;
   int happy_cost;
 
-  if (punit == NULL || free_unhappy == NULL) {
+  if (punit == nullptr || free_unhappy == nullptr) {
     return 0;
   }
 
   pcity = game_city_by_number(punit->homecity);
-  if (pcity == NULL) {
+  if (pcity == nullptr) {
     return 0;
   }
 
@@ -3177,7 +3183,7 @@ static inline void city_support(const struct civ_map *nmap,
     unit_list_iterate(pcity->tile->units, punit) {
       if (is_martial_law_unit(punit)
           && unit_owner(punit) == city_owner(pcity)) {
-        int current = get_target_bonus_effects(NULL,
+        int current = get_target_bonus_effects(nullptr,
                                                &(const struct req_context) {
                                                  .player = city_owner(pcity),
                                                  .city = pcity,
@@ -3185,7 +3191,7 @@ static inline void city_support(const struct civ_map *nmap,
                                                  .unit = punit,
                                                  .unittype = unit_type_get(punit)
                                                },
-                                               NULL, EFT_MARTIAL_LAW_BY_UNIT);
+                                               nullptr, EFT_MARTIAL_LAW_BY_UNIT);
         if (current > 0) {
           if (sel_count < max_mart_units) {
             best_units[sel_count++] = current;
@@ -3225,7 +3231,7 @@ static inline void city_support(const struct civ_map *nmap,
 /**********************************************************************//**
   Refreshes the internal cached data in the city structure.
 
-  !full_refresh will not update tile_cache[] or bonus[].  These two
+  !full_refresh will not update tile_cache[] or bonus[]. These two
   values do not need to be recalculated for AI CMA testing.
 
   'workers_map' is an boolean array which defines the placement of the
@@ -3237,8 +3243,8 @@ static inline void city_support(const struct civ_map *nmap,
 void city_refresh_from_main_map(const struct civ_map *nmap,
                                 struct city *pcity, bool *workers_map)
 {
-  if (workers_map == NULL) {
-    /* do a full refresh */
+  if (workers_map == nullptr) {
+    /* Do a full refresh */
 
     /* Calculate the bonus[] array values. */
     set_city_bonuses(pcity);
@@ -3259,7 +3265,7 @@ void city_refresh_from_main_map(const struct civ_map *nmap,
   pcity->pollution = city_pollution(pcity, pcity->prod[O_SHIELD]);
 
   happy_copy(pcity, FEELING_LUXURY);
-  citizen_happy_luxury(pcity);	/* With our new found luxuries */
+  citizen_happy_luxury(pcity);  /* With our new found luxuries */
 
   happy_copy(pcity, FEELING_EFFECT);
   citizen_content_buildings(pcity);
@@ -3282,7 +3288,7 @@ void city_refresh_from_main_map(const struct civ_map *nmap,
 /**********************************************************************//**
   Give corruption/waste generated by city. otype gives the output type
   (O_SHIELD/O_TRADE). 'total' gives the total output of this type in the
-  city. If non-NULL, 'breakdown' should be an OLOSS_LAST-sized array
+  city. If non-nullptr, 'breakdown' should be an OLOSS_LAST-sized array
   which will be filled in with a breakdown of the kinds of waste
   (not cumulative).
 **************************************************************************/
@@ -3331,15 +3337,15 @@ int city_waste(const struct city *pcity, Output_type_id otype, int total,
       int min_dist;
       const struct city *gov_center = nearest_gov_center(pcity, &min_dist);
 
-      if (gov_center == NULL) {
+      if (gov_center == nullptr) {
         waste_all = TRUE; /* No gov center - no income */
       } else {
         waste_level += waste_by_dist * min_dist / 100;
         if (waste_by_rel_dist > 0) {
-	  /* Multiply by 50 as an "standard size" for which EFT_OUTPUT_WASTE_BY_DISTANCE
-	   * and EFT_OUTPUT_WASTE_BY_REL_DISTANCE would give same result. */
+          /* Multiply by 50 as an "standard size" for which EFT_OUTPUT_WASTE_BY_DISTANCE
+           * and EFT_OUTPUT_WASTE_BY_REL_DISTANCE would give same result. */
           waste_level += waste_by_rel_dist * 50 * min_dist / 100
-	    / MAX(MAP_NATIVE_WIDTH, MAP_NATIVE_HEIGHT);
+            / MAX(MAP_NATIVE_WIDTH, MAP_NATIVE_HEIGHT);
         }
       }
     }
@@ -3418,8 +3424,8 @@ Specialist_type_id best_specialist(Output_type_id otype,
       int val2 = get_specialist_output(pcity, i, otype);
 
       if (val2 > val) {
-	best = i;
-	val = val2;
+        best = i;
+        val = val2;
       }
     }
   } normal_specialist_type_iterate_end;
@@ -3431,7 +3437,7 @@ Specialist_type_id best_specialist(Output_type_id otype,
  Adds an improvement (and its effects) to a city.
 **************************************************************************/
 void city_add_improvement(struct city *pcity,
-			  const struct impr_type *pimprove)
+                          const struct impr_type *pimprove)
 {
   pcity->built[improvement_index(pimprove)].turn = game.info.turn; /*I_ACTIVE*/
 
@@ -3445,7 +3451,7 @@ void city_add_improvement(struct city *pcity,
  Removes an improvement (and its effects) from a city.
 **************************************************************************/
 void city_remove_improvement(struct city *pcity,
-			     const struct impr_type *pimprove)
+                             const struct impr_type *pimprove)
 {
   log_debug("Improvement %s removed from city %s",
             improvement_rule_name(pimprove), pcity->name);
@@ -3493,7 +3499,7 @@ void city_styles_free(void)
   }
 
   free(city_styles);
-  city_styles = NULL;
+  city_styles = nullptr;
   game.control.num_city_styles = 0;
 }
 
@@ -3512,13 +3518,15 @@ struct city *create_city_virtual(struct player *pplayer,
    * if you ever allocate it by some other mean than fc_calloc() */
   struct city *pcity = fc_calloc(1, sizeof(*pcity));
 
-  fc_assert_ret_val(NULL != name, NULL);        /* No unnamed cities! */
+  fc_assert_ret_val(name != nullptr, nullptr);    /* No unnamed cities! */
 
   /* Do this early, so any logging later will have the city name */
   city_name_set(pcity, name);
 
   pcity->tile = ptile;
-  fc_assert_ret_val(NULL != pplayer, NULL);     /* No unowned cities! */
+
+  fc_assert_ret_val(pplayer != nullptr, nullptr); /* No unowned cities! */
+
   pcity->owner = pplayer;
   pcity->acquire_t = CACQ_FOUNDED;
 
@@ -3610,7 +3618,7 @@ void destroy_city_virtual(struct city *pcity)
 
   unit_list_destroy(pcity->units_supported);
   trade_route_list_destroy(pcity->routes);
-  if (pcity->tile_cache != NULL) {
+  if (pcity->tile_cache != nullptr) {
     free(pcity->tile_cache);
   }
 
@@ -3627,17 +3635,17 @@ void destroy_city_virtual(struct city *pcity)
     unit_list_destroy(pcity->client.info_units_present);
     /* Handle a rare case where the game is freed in the middle of a
      * spy/diplomat investigate cycle. */
-    if (pcity->client.collecting_info_units_supported != NULL) {
+    if (pcity->client.collecting_info_units_supported != nullptr) {
       unit_list_destroy(pcity->client.collecting_info_units_supported);
     }
-    if (pcity->client.collecting_info_units_present != NULL) {
+    if (pcity->client.collecting_info_units_present != nullptr) {
       unit_list_destroy(pcity->client.collecting_info_units_present);
     }
   }
 
   free(pcity->name);
 
-  memset(pcity, 0, sizeof(*pcity)); /* ensure no pointers remain */
+  memset(pcity, 0, sizeof(*pcity)); /* Ensure no pointers remain */
   free(pcity);
 }
 
@@ -3659,7 +3667,7 @@ bool city_exist(int id)
   Return TRUE if the city is a virtual city. That is, it is a valid city
   pointer but does not correspond to a city that exists in the game.
 
-  NB: A return value of FALSE implies that either the pointer is NULL or
+  NB: A return value of FALSE implies that either the pointer is nullptr or
   that the city exists in the game.
 **************************************************************************/
 bool city_is_virtual(const struct city *pcity)
@@ -3707,7 +3715,7 @@ void city_rally_point_clear(struct city *pcity)
     pcity->rally_point.persistent = FALSE;
     pcity->rally_point.vigilant = FALSE;
     free(pcity->rally_point.orders);
-    pcity->rally_point.orders = NULL;
+    pcity->rally_point.orders = nullptr;
   }
 }
 
@@ -3720,7 +3728,7 @@ void city_rally_point_receive(const struct packet_city_rally_point *packet,
   struct unit_order *checked_orders;
   const struct civ_map *nmap = &(wld.map);
 
-  if (NULL == pcity) {
+  if (pcity == nullptr) {
     /* Probably lost. */
     log_verbose("handle_city_rally_point() bad city number %d.",
                 packet->id);
@@ -3741,7 +3749,7 @@ void city_rally_point_receive(const struct packet_city_rally_point *packet,
     pcity->rally_point.persistent = FALSE;
     if (pcity->rally_point.orders) {
       free(pcity->rally_point.orders);
-      pcity->rally_point.orders = NULL;
+      pcity->rally_point.orders = nullptr;
     }
   } else {
     checked_orders = create_unit_orders(nmap, packet->length,
diff --git a/common/city.h b/common/city.h
index 283ffa412d..d3da7a13d8 100644
--- a/common/city.h
+++ b/common/city.h
@@ -132,20 +132,20 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
  * (the city center is _radius_sq_min = 0) outward to the tiles of
  * _radius_sq_max. (_x, _y) will be the valid elements of
  * [0, CITY_MAP_MAX_SIZE] taking into account the city radius. */
-#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min,	\
+#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min,       \
                                                   _radius_sq_max,       \
-                                                  _index, _x, _y)	\
-{									\
-  fc_assert(_radius_sq_min <= _radius_sq_max);				\
-  int _x = 0, _y = 0, _index;						\
-  int _x##_y##_index = city_map_tiles(_radius_sq_min);			\
-  while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index,		\
-                               _radius_sq_max)) {			\
-    _index = _x##_y##_index;						\
+                                                  _index, _x, _y)       \
+{                                                                       \
+  fc_assert(_radius_sq_min <= _radius_sq_max);                          \
+  int _x = 0, _y = 0, _index;                                           \
+  int _x##_y##_index = city_map_tiles(_radius_sq_min);                  \
+  while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index,                \
+                               _radius_sq_max)) {                       \
+    _index = _x##_y##_index;                                            \
     _x##_y##_index++;
 
-#define city_map_iterate_outwards_radius_sq_index_end			\
-  }									\
+#define city_map_iterate_outwards_radius_sq_index_end                   \
+  }                                                                     \
 }
 
   /* Same as above, but don't set index */
@@ -160,19 +160,19 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
                                _radius_sq_max)) {                       \
     _x##_y##_index++;
 
-#define city_map_iterate_outwards_radius_sq_end		                \
-  }									\
+#define city_map_iterate_outwards_radius_sq_end                         \
+  }                                                                     \
 }
 
 /* Iterate a city map. This iterates over all city positions in the city
  * map starting at the city center (i.e., positions that are workable by
- * the city) using the index (_index) and  the coordinates (_x, _y). It
+ * the city) using the index (_index) and the coordinates (_x, _y). It
  * is an abbreviation for city_map_iterate_outwards_radius_sq(_end). */
-#define city_map_iterate(_radius_sq, _index, _x, _y)		        \
-  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ,	\
+#define city_map_iterate(_radius_sq, _index, _x, _y)                    \
+  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ,  \
                                             _radius_sq, _index, _x, _y)
 
-#define city_map_iterate_end						\
+#define city_map_iterate_end                                            \
   city_map_iterate_outwards_radius_sq_index_end
 
 #define city_map_iterate_without_index(_radius_sq, _x, _y)              \
@@ -183,12 +183,12 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
   city_map_iterate_outwards_radius_sq_end
 
 /* Iterate the tiles between two radii of a city map. */
-#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max,	\
-                                   _x, _y)				\
-  city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max,	\
+#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max,      \
+                                   _x, _y)                              \
+  city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max,   \
                                       _x, _y)
 
-#define city_map_iterate_radius_sq_end					\
+#define city_map_iterate_radius_sq_end                                  \
   city_map_iterate_outwards_radius_sq_end
 
 /* Iterate a city map in checked real map coordinates.
@@ -197,30 +197,30 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
  * (_index) will be the city tile index in the interval
  * [0, city_map_tiles(_radius_sq)] */
 #define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile,   \
-                                _index) {				\
-  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ,	\
-                                            _radius_sq, _index, _x, _y)	\
+                                _index) {                               \
+  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ,  \
+                                            _radius_sq, _index, _x, _y) \
   struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq,  \
-                                        _x, _y);			\
-  if (NULL != _tile) {
+                                        _x, _y);                        \
+  if (_tile != nullptr) {
 
-#define city_tile_iterate_index_end					\
-    }									\
+#define city_tile_iterate_index_end                                     \
+    }                                                                   \
   } city_map_iterate_outwards_radius_sq_index_end;
 
 /* simple extension to skip is_free_worked() tiles. */
 #define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile,  \
-                                           _tile, _index, _x, _y) {	   \
-  city_map_iterate(_radius_sq, _index, _x, _y) {			   \
-    if (!is_free_worked_index(_index)) {				   \
+                                           _tile, _index, _x, _y) {        \
+  city_map_iterate(_radius_sq, _index, _x, _y) {                           \
+    if (!is_free_worked_index(_index)) {                                   \
       struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
-                                            _x, _y);			   \
-      if (NULL != _tile) {
+                                            _x, _y);                       \
+      if (_tile != nullptr) {
 
-#define city_tile_iterate_skip_free_worked_end				\
-      }									\
-    }									\
-  } city_map_iterate_end;						\
+#define city_tile_iterate_skip_free_worked_end                          \
+      }                                                                 \
+    }                                                                   \
+  } city_map_iterate_end;                                               \
 }
 
 /* Does the same thing as city_tile_iterate_index(), but keeps the city
@@ -231,7 +231,7 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
                                       _radius_sq, _x, _y)                  \
   struct tile *_tile = city_map_to_tile(_nmap, _center##_tile, _radius_sq, \
                                         _x, _y);                           \
-  if (NULL != _tile) {
+  if (_tile != nullptr) {
 
 #define city_tile_iterate_end                                           \
     }                                                                   \
@@ -241,9 +241,9 @@ void citylog_map_workers(enum log_level level, struct city *pcity);
  * (replaced Impr_Status) */
 
 struct built_status {
-  int turn;			/* turn built, negative for old state */
-#define I_NEVER		(-1)	/* Improvement never built */
-#define I_DESTROYED	(-2)	/* Improvement built and destroyed */
+  int turn;                     /* Turn built, negative for old state */
+#define I_NEVER         (-1)    /* Improvement never built */
+#define I_DESTROYED     (-2)    /* Improvement built and destroyed */
 };
 
 /* How much this output type is penalized for unhappy cities: not at all,
@@ -271,15 +271,15 @@ enum citizen_category {
   CITIZEN_SPECIALIST = CITIZEN_LAST,
 };
 
-/* changing this order will break network compatibility,
+/* Changing this order will break network compatibility,
  * and clients that don't use the symbols. */
 enum citizen_feeling {
-  FEELING_BASE,		/* before any of the modifiers below */
-  FEELING_LUXURY,	/* after luxury */
-  FEELING_EFFECT,	/* after building effects */
-  FEELING_NATIONALITY,  /* after citizen nationality effects */
-  FEELING_MARTIAL,	/* after units enforce martial order */
-  FEELING_FINAL,	/* after wonders (final result) */
+  FEELING_BASE,         /* Before any of the modifiers below */
+  FEELING_LUXURY,       /* After luxury */
+  FEELING_EFFECT,       /* After building effects */
+  FEELING_NATIONALITY,  /* After citizen nationality effects */
+  FEELING_MARTIAL,      /* After units enforce martial order */
+  FEELING_FINAL,        /* After wonders (final result) */
   FEELING_LAST
 };
 
@@ -317,10 +317,10 @@ struct cm_parameter; /* defined in ./common/aicore/cm.h */
 #endif
 struct city {
   char *name;
-  struct tile *tile; /* May be NULL, should check! */
-  struct player *owner; /* Cannot be NULL. */
-  struct player *original; /* Often NULL in client,
-                            * can be NULL on server after player removal */
+  struct tile *tile;       /* May be nullptr, should check! */
+  struct player *owner;    /* Cannot be nullptr. */
+  struct player *original; /* Often nullptr in client,
+                            * can be nullptr on server after player removal */
   int id;
   int style;
   enum capital_type capital;
@@ -469,11 +469,11 @@ struct city {
       bool colored;
       int color_index;
 
-      /* info for dipl/spy investigation */
+      /* Info for dipl/spy investigation */
       struct unit_list *info_units_supported;
       struct unit_list *info_units_present;
       /* Before popup the city dialog, units go there. In normal process,
-       * these pointers are set to NULL. */
+       * these pointers are set to nullptr. */
       struct unit_list *collecting_info_units_supported;
       struct unit_list *collecting_info_units_present;
 
@@ -539,7 +539,7 @@ extern struct output_type output_types[];
       struct city *_city =                                             \
         game_city_by_number(_city##_numbers[_city##_index]);           \
                                                                        \
-      if (NULL != _city) {
+      if (_city != nullptr) {
 
 #define city_list_iterate_safe_end                                     \
       }                                                                \
@@ -569,7 +569,7 @@ void city_name_set(struct city *pcity, const char *new_name);
 **************************************************************************/
 static inline citizens city_size_get(const struct city *pcity)
 {
-  fc_assert_ret_val(pcity != NULL, 0);
+  fc_assert_ret_val(pcity != nullptr, 0);
 
   return pcity->size;
 }
@@ -629,7 +629,7 @@ bool can_city_build_now(const struct civ_map *nmap,
 
 int city_unit_slots_available(const struct city *pcity);
 bool city_can_use_specialist(const struct city *pcity,
-			     Specialist_type_id type);
+                             Specialist_type_id type);
 bool city_has_building(const struct city *pcity,
                        const struct impr_type *pimprove);
 bool is_capital(const struct city *pcity);
@@ -666,7 +666,7 @@ void city_choose_build_default(const struct civ_map *nmap, struct city *pcity);
 /* Textual representation of buildings */
 
 const char *city_improvement_name_translation(const struct city *pcity,
-					      const struct impr_type *pimprove);
+                                              const struct impr_type *pimprove);
 const char *city_production_name_translation(const struct city *pcity);
 
 /* City map functions */
@@ -736,7 +736,7 @@ struct city *tile_enemy_city(const struct tile *ptile,
 static inline bool is_enemy_city_tile(const struct tile *ptile,
                                       const struct player *pplayer)
 {
-  return NULL != tile_enemy_city(ptile, pplayer);
+  return tile_enemy_city(ptile, pplayer) != nullptr;
 }
 
 struct city *tile_allied_city(const struct tile *ptile,
@@ -748,7 +748,7 @@ struct city *tile_allied_city(const struct tile *ptile,
 static inline bool is_allied_city_tile(const struct tile *ptile,
                                        const struct player *pplayer)
 {
-  return NULL != tile_allied_city(ptile, pplayer);
+  return tile_allied_city(ptile, pplayer) != nullptr;
 }
 
 struct city *tile_non_attack_city(const struct tile *ptile,
@@ -760,7 +760,7 @@ struct city *tile_non_attack_city(const struct tile *ptile,
 static inline bool is_non_attack_city_tile(const struct tile *ptile,
                                            const struct player *pplayer)
 {
-  return NULL != tile_non_attack_city(ptile, pplayer);
+  return tile_non_attack_city(ptile, pplayer) != nullptr;
 }
 
 struct city *tile_non_allied_city(const struct tile *ptile,
@@ -772,7 +772,7 @@ struct city *tile_non_allied_city(const struct tile *ptile,
 static inline bool is_non_allied_city_tile(const struct tile *ptile,
                                            const struct player *pplayer)
 {
-  return NULL != tile_non_allied_city(ptile, pplayer);
+  return tile_non_allied_city(ptile, pplayer) != nullptr;
 }
 
 bool is_unit_near_a_friendly_city(const struct civ_map *nmap,
@@ -790,9 +790,9 @@ bool city_exists_within_max_city_map(const struct civ_map *nmap,
 int city_granary_size(int city_size);
 
 void city_add_improvement(struct city *pcity,
-			  const struct impr_type *pimprove);
+                          const struct impr_type *pimprove);
 void city_remove_improvement(struct city *pcity,
-			     const struct impr_type *pimprove);
+                             const struct impr_type *pimprove);
 
 /* City update functions */
 void city_refresh_from_main_map(const struct civ_map *nmap,
@@ -801,13 +801,13 @@ void city_refresh_from_main_map(const struct civ_map *nmap,
 int city_waste(const struct city *pcity, Output_type_id otype, int total,
                int *breakdown);
 Specialist_type_id best_specialist(Output_type_id otype,
-				   const struct city *pcity);
+                                   const struct city *pcity);
 int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype);
 bool city_built_last_turn(const struct city *pcity);
 
 /* City creation / destruction */
 struct city *create_city_virtual(struct player *pplayer,
-				 struct tile *ptile, const char *name);
+                                 struct tile *ptile, const char *name);
 void destroy_city_virtual(struct city *pcity);
 bool city_is_virtual(const struct city *pcity);
 
@@ -819,7 +819,7 @@ void city_styles_free(void);
 void add_tax_income(const struct player *pplayer, int trade, int *output);
 int get_city_tithes_bonus(const struct city *pcity);
 int city_pollution_types(const struct city *pcity, int shield_total,
-			 int *pollu_prod, int *pollu_pop, int *pollu_mod);
+                         int *pollu_prod, int *pollu_pop, int *pollu_mod);
 int city_pollution(const struct city *pcity, int shield_total);
 int city_illness_calc(const struct city *pcity, int *ill_base,
                       int *ill_size, int *ill_trade, int *ill_pollution);
@@ -833,25 +833,25 @@ bool city_exist(int id);
  * Iterates over all improvements, skipping those not yet built in the
  * given city.
  */
-#define city_built_iterate(_pcity, _p)				\
-  improvement_iterate(_p) {						\
-    if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) {	\
-      continue;								\
+#define city_built_iterate(_pcity, _p)                                  \
+  improvement_iterate(_p) {                                             \
+    if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) {       \
+      continue;                                                         \
     }
 
-#define city_built_iterate_end					\
+#define city_built_iterate_end                                          \
   } improvement_iterate_end;
 
 
 /* Iterates over all output types in the game. */
-#define output_type_iterate(output)					    \
-{									    \
-  Output_type_id output;						    \
-									    \
+#define output_type_iterate(output)                                         \
+{                                                                           \
+  Output_type_id output;                                                    \
+                                                                            \
   for (output = 0; output < O_LAST; output++) {
 
-#define output_type_iterate_end						    \
-  }									    \
+#define output_type_iterate_end                                             \
+  }                                                                         \
 }
 
 
-- 
2.51.0

