Project

General

Profile

Feature #2154 ยป 0052-rssanity.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 08/20/2026 12:19 AM

View differences:

server/ruleset/rssanity.c
**************************************************************************/
static bool sanity_check_metadata(rs_conversion_logger logger)
{
if (game.ruleset_summary != NULL
if (game.ruleset_summary != nullptr
&& strlen(game.ruleset_summary) > MAX_LEN_CONTENT) {
ruleset_error(logger,
LOG_ERROR,
......
} requirement_vector_iterate_end;
problem = req_vec_suggest_repair(preqs, req_vec_vector_number, preqs);
if (problem != NULL) {
if (problem != nullptr) {
ruleset_error(logger, LOG_ERROR, "%s: %s.", list_for, problem->description);
req_vec_problem_free(problem);
return FALSE;
......
}
if (num_role_units(L_PARTISAN) == 0
&& effect_cumulative_max(EFT_INSPIRE_PARTISANS, NULL, 0) > 0) {
&& effect_cumulative_max(EFT_INSPIRE_PARTISANS, nullptr, 0) > 0) {
ruleset_error(logger, LOG_ERROR,
_("Inspire_Partisans effect present, "
"but no units with partisan role."));
......
return FALSE;
}
if (pimprove->genus != IG_SPECIAL
&& (get_potential_improvement_bonus(pimprove, NULL, EFT_SS_STRUCTURAL,
&& (get_potential_improvement_bonus(pimprove, nullptr, EFT_SS_STRUCTURAL,
RPT_POSSIBLE, FALSE)
|| get_potential_improvement_bonus(pimprove, NULL, EFT_SS_COMPONENT,
|| get_potential_improvement_bonus(pimprove, nullptr, EFT_SS_COMPONENT,
RPT_POSSIBLE, FALSE)
|| get_potential_improvement_bonus(pimprove, NULL, EFT_SS_MODULE,
|| get_potential_improvement_bonus(pimprove, nullptr, EFT_SS_MODULE,
RPT_POSSIBLE, FALSE))) {
ruleset_error(logger, LOG_ERROR,
_("Space part %s with genus other than \"Special\""),
......
bool ret = TRUE;
for (i = 0; boolean_effects[i] != EFT_COUNT; i++) {
if (effect_cumulative_min(boolean_effects[i], NULL) < 0
&& effect_cumulative_max(boolean_effects[i], NULL, 0) == 0) {
if (effect_cumulative_min(boolean_effects[i], nullptr) < 0
&& effect_cumulative_max(boolean_effects[i], nullptr, 0) == 0) {
ruleset_error(logger, LOG_ERROR,
_("Boolean effect %s can get disabled, but it can't get "
"enabled before that."),
......
bool default_gov_failed = FALSE;
bool obsoleted_by_loop = FALSE;
els_data els;
rs_conversion_logger logger = ((compat != NULL) ? compat->log_cb : NULL);
rs_conversion_logger logger
= ((compat != nullptr) ? compat->log_cb : nullptr);
if (!sanity_check_metadata(logger)) {
ok = FALSE;
......
" and req2 like before."),
advance_rule_name(padvance));
ok = FALSE;
} else if (is_req_unchanging(NULL, preq) < REQUCH_HACK
} else if (is_req_unchanging(nullptr, preq) < REQUCH_HACK
/* If we get an obsolete improvement before the game,
* almost surely it is going to become not obsolete later.
* This check must catch it. */) {
......
}
} requirement_vector_iterate_end;
if (padvance->bonus_message != NULL) {
if (padvance->bonus_message != nullptr) {
if (!formats_match(padvance->bonus_message, "%s")) {
ruleset_error(logger, LOG_ERROR,
_("Tech \"%s\" bonus message is not format with %%s "
......
Tech_type_id tech = game.rgame.global_init_techs[techi];
struct advance *a = valid_advance_by_number(tech);
if (a == NULL) {
if (a == nullptr) {
ruleset_error(logger, LOG_ERROR,
_("Tech %s does not exist, but is initial "
"tech for everyone."),
......
Tech_type_id tech = pnation->init_techs[techi];
struct advance *a = valid_advance_by_number(tech);
if (a == NULL) {
if (a == nullptr) {
ruleset_error(logger, LOG_ERROR,
_("Tech %s does not exist, but is initial tech for %s."),
advance_rule_name(advance_by_number(tech)),
......
int chain_length = 0;
const struct unit_type *upgraded = putype;
while (upgraded != NULL && !obsoleted_by_loop) {
while (upgraded != nullptr && !obsoleted_by_loop) {
upgraded = upgraded->obsoleted_by;
chain_length++;
if (chain_length > num_utypes) {
......
} unit_class_re_active_iterate_end;
achievements_re_active_iterate(pach) {
if (!pach->unique && pach->cons_msg == NULL) {
if (!pach->unique && pach->cons_msg == nullptr) {
ruleset_error(logger, LOG_ERROR,
_("Achievement %s has no message for consecutive gainers though "
"it's possible to be gained by multiple players"),
......
}
} achievements_re_active_iterate_end;
if (game.server.ruledit.embedded_nations != NULL) {
if (game.server.ruledit.embedded_nations != nullptr) {
int nati;
for (nati = 0; nati < game.server.ruledit.embedded_nations_count; nati++) {
struct nation_type *pnat
= nation_by_rule_name(game.server.ruledit.embedded_nations[nati]);
if (pnat == NULL) {
if (pnat == nullptr) {
ruleset_error(logger, LOG_ERROR,
_("There's nation %s listed in embedded nations, but there's "
"no such nation."),
......
log_normal(_("Disabling 'barbarians' setting for lack of suitable "
"unit types."));
setting_ruleset_lock_clear(pset);
if (!setting_enum_set(pset, "DISABLED", NULL, NULL, 0)) {
if (!setting_enum_set(pset, "DISABLED", nullptr, nullptr, 0)) {
ok = FALSE;
}
setting_ruleset_lock_set(pset);
    (1-1/1)