Project

General

Profile

Feature #2362 ยป 0092-actiontools.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 10/11/2026 07:48 AM

View differences:

server/actiontools.c
&& utype_is_consumed_by_action(paction, unit_type_get(actor))) {
if (action_has_result(paction, ACTRES_DISBAND_UNIT)
|| action_has_result(paction, ACTRES_DISBAND_UNIT_RECOVER)) {
wipe_unit(actor, ULR_DISBANDED, NULL);
wipe_unit(actor, ULR_DISBANDED, nullptr);
} else if (action_has_result(paction, ACTRES_NUKE)
|| action_has_result(paction, ACTRES_NUKE_UNITS)) {
wipe_unit(actor, ULR_DETONATED, NULL);
wipe_unit(actor, ULR_DETONATED, nullptr);
} else if (action_has_result(paction, ACTRES_ATTACK)
|| action_has_result(paction, ACTRES_WIPE_UNITS)) {
wipe_unit(actor, ULR_MISSILE, NULL);
wipe_unit(actor, ULR_MISSILE, nullptr);
} else {
wipe_unit(actor, ULR_USED, NULL);
wipe_unit(actor, ULR_USED, nullptr);
}
}
}
......
{
if (unit_is_alive(actor_id)) {
int spent_mp = unit_pays_mp_for_action(paction, actor);
actor->moves_left = MAX(0, actor->moves_left - spent_mp);
send_unit_info(NULL, actor);
send_unit_info(nullptr, actor);
}
}
......
{
if (unit_is_alive(target_id)) {
int spent_mp = get_target_bonus_effects(
NULL,
nullptr,
&(const struct req_context) {
.player = unit_owner(target),
.city = unit_tile(target) ? tile_city(unit_tile(target)) : NULL,
.city = unit_tile(target) ? tile_city(unit_tile(target)) : nullptr,
.tile = unit_tile(target),
.unit = target,
.unittype = unit_type_get(target),
.action = paction,
},
NULL,
nullptr,
EFT_ACTION_SUCCESS_TARGET_MOVE_COST);
target->moves_left = MAX(0, target->moves_left - spent_mp);
send_unit_info(NULL, target);
send_unit_info(nullptr, target);
}
}
......
Take care of any consequences (like casus belli) of the given action
when the situation was as specified.
victim_player can be NULL
victim_player can be nullptr
**************************************************************************/
static void action_consequence_common(const struct action *paction,
struct player *offender,
......
call_incident(INCIDENT_ACTION, cbr, paction, offender, victim_player);
/* Update the clients. */
send_player_all_c(offender, NULL);
send_player_all_c(offender, nullptr);
if (victim_player != NULL && victim_player != offender) {
if (victim_player != nullptr && victim_player != offender) {
/* The actor player was just sent. */
/* An action against an ownerless tile is victimless. */
send_player_all_c(victim_player, NULL);
send_player_all_c(victim_player, nullptr);
}
}
}
......
"everyone a casus belli against the %s."),
action_name_translation(paction),
nation_plural_for_player(offender));
} else if (victim_player == NULL) {
} else if (victim_player == nullptr) {
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRANS: Europeans ... Suitcase Nuke */
......
Take care of any consequences (like casus belli) of getting caught while
trying to perform the given action.
victim_player can be NULL
victim_player can be nullptr
**************************************************************************/
void action_consequence_caught(const struct action *paction,
struct player *offender,
......
"the %s."),
action_name_translation(paction),
nation_plural_for_player(offender));
} else if (victim_player == NULL) {
} else if (victim_player == nullptr) {
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRANS: Europeans ... Suitcase Nuke */
......
Take care of any consequences (like casus belli) of successfully
performing the given action.
victim_player can be NULL
victim_player can be nullptr
**************************************************************************/
void action_consequence_success(const struct action *paction,
struct player *offender,
......
Take care of any consequences (like casus belli) of successfully
completing the given action.
victim_player can be NULL
victim_player can be nullptr
**************************************************************************/
void action_consequence_complete(const struct action *paction,
struct player *offender,
......
{
const struct civ_map *nmap = &(wld.map);
if (actor == NULL || target == NULL) {
if (actor == nullptr || target == nullptr) {
/* Can't do any actions if actor or target are missing. */
return FALSE;
}
......
/**********************************************************************//**
Find a city to target for an action on the specified tile.
Returns NULL if no proper target is found.
Returns nullptr if no proper target is found.
If the only action(s) that can be performed against a target has the
rare_pop_up property the target will only be considered valid if the
......
return target;
}
return NULL;
return nullptr;
}
/**********************************************************************//**
......
{
const struct civ_map *nmap = &(wld.map);
if (actor == NULL || target == NULL) {
if (actor == nullptr || target == nullptr) {
/* Can't do any actions if actor or target are missing. */
return FALSE;
}
......
Find a unit to target for an action at the specified tile.
Returns the first unit found at the tile that the actor may act against
or NULL if no proper target is found.
or nullptr if no proper target is found.
If the only action(s) that can be performed against a target has the
rare_pop_up property the target will only be considered valid if the
......
}
} unit_list_iterate_end;
return NULL;
return nullptr;
}
/**********************************************************************//**
Returns the tile iff it, from the point of view of the owner of the
actor unit, looks like a target tile.
Returns NULL if the player knows that the actor unit can't do any
Returns nullptr if the player knows that the actor unit can't do any
action (that specifies its target as a tile) to the tile.
If the owner of the actor unit doesn't have the knowledge needed to know
......
{
const struct civ_map *nmap = &(wld.map);
if (actor == NULL || target == NULL) {
if (actor == nullptr || target == nullptr) {
/* Can't do any actions if actor or target are missing. */
return NULL;
return nullptr;
}
action_iterate(act) {
......
}
} action_iterate_end;
return NULL;
return nullptr;
}
/**********************************************************************//**
......
{
const struct civ_map *nmap = &(wld.map);
if (actor == NULL || tgt_tile == NULL || tgt_extra == NULL) {
if (actor == nullptr || tgt_tile == nullptr || tgt_extra == nullptr) {
/* Can't do any actions if actor or target are missing. */
return FALSE;
}
......
Find an extra to target for an action at the specified tile.
Returns the first extra found that the actor may act against at the tile
or NULL if no proper target is found. (Note that some actions requires
or nullptr if no proper target is found. (Note that some actions requires
the absence of an extra since they result in its creation while other
requires its presence.)
......
}
} extra_type_re_active_iterate_end;
return NULL;
return nullptr;
}
/**********************************************************************//**
......
case ASTK_EXTRA_NOT_THERE:
if (action_has_result(paction, ACTRES_PILLAGE)) {
/* Special treatment for "Pillage" */
struct extra_type *pextra = NULL;
struct extra_type *pextra = nullptr;
enum unit_activity activity = action_get_activity(paction);
unit_assign_specific_activity_target(actor_unit, &activity,
action_number(paction), &pextra);
if (pextra != NULL) {
if (pextra != nullptr) {
return extra_number(pextra);
}
}
......
}
/**********************************************************************//**
Returns the action auto performer that the specified cause can force the
specified actor to perform. Returns NULL if no such action auto performer
exists.
Returns the action auto performer that the specified cause can force
the specified actor to perform. Returns nullptr if no such
action auto performer exists.
**************************************************************************/
const struct action_auto_perf *
action_auto_perf_unit_sel(const enum action_auto_perf_cause cause,
......
} action_auto_perf_by_cause_iterate_end;
/* Can't even try to force an action. */
return NULL;
return nullptr;
}
#define action_auto_perf_acquire_targets(_target_extra_) \
......
Make the specified actor unit perform an action because of cause.
Returns the action the actor unit was forced to perform.
Returns NULL if that didn't happen.
Returns nullptr if that didn't happen.
Note that the return value doesn't say anything about survival.
**************************************************************************/
......
if (!autoperf) {
/* No matching Action Auto Performer. */
return NULL;
return nullptr;
}
actor_id = actor->id;
......
#define perform_action_to(act, actor, tgtid, tgt_extra) \
if (unit_perform_action(unit_owner(actor), \
actor->id, tgtid, tgt_extra, \
NULL, act, ACT_REQ_RULES)) { \
nullptr, act, ACT_REQ_RULES)) { \
return action_by_number(act); \
}
......
if (!unit_is_alive(actor_id)) {
/* The unit is gone. Maybe it was killed in Lua? */
return NULL;
return nullptr;
}
}
} action_auto_perf_actions_iterate_end;
return NULL;
return nullptr;
}
/**********************************************************************//**
    (1-1/1)