Project

General

Profile

Feature #2510 ยป 0061-daidomestic.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 11/29/2026 01:55 AM

View differences:

ai/default/daidomestic.c
}
if (pcity == wonder_city
|| wonder_city == NULL
|| wonder_city == nullptr
|| city_data->distance_to_wonder_city <= 0
|| !city_production_gets_caravan_shields(&wonder_city->production)
/* TODO: Should helping to build a unit be considered when legal? */
......
unit_type = dai_wants_role_unit(ait, pplayer, pcity,
action_id_get_role(ACTION_HELP_WONDER),
want);
if (unit_type != NULL) {
if (unit_type != nullptr) {
choice->want = want;
choice->type = CT_CIVILIAN;
choice->value.utype = unit_type;
......
players_iterate(aplayer) {
if (aplayer == pplayer || !aplayer->is_alive) {
continue;
continue;
}
if (pplayers_allied(pplayer, aplayer)) {
city_list_iterate(aplayer->cities, acity) {
if (can_cities_trade(pcity, acity)) {
if (tile_continent(acity->tile) != continent) {
if (!(can_move_ic || has_boats)) {
/* FIXME: get by roads/rivers? */
/* FIXME: Get by roads/rivers? */
continue;
}
dest_city_found = TRUE;
......
* correct action. */
trade_action = utype_can_do_action(unit_type, ACTION_TRADE_ROUTE) ?
ACTION_TRADE_ROUTE : ACTION_MARKETPLACE;
bonus = get_target_bonus_effects(NULL,
bonus = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pplayer,
.city = pcity,
......
.action =
action_by_number(trade_action),
},
NULL,
nullptr,
EFT_TRADE_REVENUE_BONUS);
/* Be mercy full to players with small amounts. Round up. */
......
want += trader_trait / 4;
}
want -= utype_build_shield_cost(pcity, NULL, unit_type) * SHIELD_WEIGHTING / 150;
want -= utype_build_shield_cost(pcity, nullptr, unit_type) * SHIELD_WEIGHTING / 150;
/* Don't pile too many of them */
if (unassigned_caravans * 10 > want && want > 0.0) {
......
}
CITY_LOG(LOG_DEBUG, pcity,
"want for trade route unit is " ADV_WANT_PRINTF " (expected initial income %d)",
"want for trade route unit is " ADV_WANT_PRINTF
" (expected initial income %d)",
want,
income);
......
action_id_get_role(ACTION_TRADE_ROUTE),
want);
if (unit_type == NULL) {
if (unit_type == nullptr) {
unit_type = dai_wants_role_unit(ait, pplayer, pcity,
action_id_get_role(ACTION_MARKETPLACE),
want);
......
/* We don't want to build caravan that wouldn't be able to reach the
* destination by any means. It would be useless. */
if (unit_type != NULL && (!need_boat || has_boats)) {
if (unit_type != nullptr && (!need_boat || has_boats)) {
choice->want = want;
choice->type = CT_CIVILIAN;
choice->value.utype = unit_type;
......
struct player *pplayer,
struct city *pcity)
{
struct adv_data *adv = adv_data_get(pplayer, NULL);
struct adv_data *adv = adv_data_get(pplayer, nullptr);
/* Unit type with certain role */
struct unit_type *worker_type;
struct unit_type *founder_type;
......
worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
if (adv->wonder_city == pcity->id) {
if (worker_type == NULL || worker_type->pop_cost > 0) {
if (worker_type == nullptr || worker_type->pop_cost > 0) {
worker_want /= 5;
} else {
worker_want /= 2;
}
}
if (worker_type != NULL
if (worker_type != nullptr
&& pcity->surplus[O_FOOD] > utype_upkeep_cost(worker_type, nullptr,
pplayer, O_FOOD)) {
if (worker_want > 0) {
......
}
/* Terrain improvers don't use boats (yet) */
} else if (worker_type == NULL && worker_want > 0) {
} else if (worker_type == nullptr && worker_want > 0) {
/* Can't build workers. Lets stimulate science */
dai_wants_role_unit(ait, pplayer, pcity, UTYF_WORKERS, worker_want);
}
......
founder_want = city_data->founder_want;
if (adv->wonder_city == pcity->id) {
if (founder_type == NULL || founder_type->pop_cost > 0) {
if (founder_type == nullptr || founder_type->pop_cost > 0) {
founder_want /= 5;
} else {
founder_want /= 2;
......
/* We need boats to colonize! */
/* We might need boats even if there are boats free,
* if they are blockaded or in inland seas. */
struct ai_plr *ai = dai_plr_data_get(ait, pplayer, NULL);
struct ai_plr *ai = dai_plr_data_get(ait, pplayer, nullptr);
CITY_LOG(LOG_DEBUG, pcity,
"desires founders with passion " ADV_WANT_PRINTF
......
def_ai_city_data(acity, ait)->distance_to_wonder_city = 0;
} city_list_iterate_end;
if (wonder_city == NULL) {
if (wonder_city == nullptr) {
return;
}
    (1-1/1)