Project

General

Profile

Feature #2013 ยป 0037-road.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 05/03/2026 08:55 PM

View differences:

common/road.c
****************************************************************************/
Road_type_id road_number(const struct road_type *proad)
{
fc_assert_ret_val(NULL != proad, -1);
fc_assert_ret_val(proad != nullptr, -1);
return proad->id;
}
......
roads = extra_type_list_by_cause(EC_ROAD);
if (roads == NULL || id < 0 || id >= extra_type_list_size(roads)) {
return NULL;
if (roads == nullptr || id < 0 || id >= extra_type_list_size(roads)) {
return nullptr;
}
return extra_road_get(extra_type_list_get(roads, id));
......
requirement_vector_init(&proad->first_reqs);
proad->id = idx;
proad->integrators = NULL;
proad->integrators = nullptr;
proad->self = pextra;
}
......
requirement_vector_free(&proad->first_reqs);
if (proad->integrators != NULL) {
if (proad->integrators != nullptr) {
extra_type_list_destroy(proad->integrators);
proad->integrators = NULL;
proad->integrators = nullptr;
}
} extra_type_by_cause_iterate_end;
}
......
}
/************************************************************************//**
Return road type represented by given compatibility special, or NULL if
Return road type represented by given compatibility special, or nullptr if
special does not represent road type at all.
****************************************************************************/
struct road_type *road_by_compat_special(enum road_compat compat)
{
if (compat == ROCO_NONE) {
return NULL;
return nullptr;
}
extra_type_by_cause_iterate(EC_ROAD, pextra) {
struct road_type *proad = extra_road_get(pextra);
if (road_compat_special(proad) == compat) {
return proad;
}
} extra_type_by_cause_iterate_end;
return NULL;
return nullptr;
}
/************************************************************************//**
Return road type represented by given gui_type, or NULL if
Return road type represented by given gui_type, or nullptr if
it does not represent road type at all.
****************************************************************************/
struct road_type *road_by_gui_type(enum road_gui_type gui_type)
{
if (gui_type == ROAD_GUI_OTHER) {
return NULL;
return nullptr;
}
extra_type_by_cause_iterate(EC_ROAD, pextra) {
......
}
} extra_type_by_cause_iterate_end;
return NULL;
return nullptr;
}
/************************************************************************//**
......
.player = pplayer,
.tile = ptile,
.unit = punit,
.unittype = punit ? unit_type_get(punit) : NULL,
.unittype = punit ? unit_type_get(punit) : nullptr,
};
if (requirement_vector_size(&proad->first_reqs) > 0) {
......
return FALSE;
}
return are_road_reqs_fulfilled(nmap, proad, pplayer, NULL, ptile);
return are_road_reqs_fulfilled(nmap, proad, pplayer, nullptr, ptile);
}
/************************************************************************//**
......
}
/************************************************************************//**
Count tiles with specified road near the tile. Can be called with NULL
Count tiles with specified road near the tile. Can be called with nullptr
road.
****************************************************************************/
int count_road_near_tile(struct civ_map *nmap, const struct tile *ptile,
......
{
int count = 0;
if (proad == NULL) {
if (proad == nullptr) {
return 0;
}
......
int count = 0;
cardinal_adjc_iterate(nmap, ptile, adjc_tile) {
if (priver == NULL && tile_has_river(adjc_tile)) {
if (priver == nullptr && tile_has_river(adjc_tile)) {
/* Some river */
count++;
} else if (priver != NULL && tile_has_extra(adjc_tile, priver)) {
} else if (priver != nullptr && tile_has_extra(adjc_tile, priver)) {
/* Specific river */
count++;
}
......
int count = 0;
int total = 0;
fc_assert(priver != NULL);
fc_assert(priver != nullptr);
cardinal_adjc_iterate(nmap, ptile, adjc_tile) {
if (tile_has_extra(adjc_tile, priver)) {
......
int count = 0;
int total = 0;
fc_assert(priver != NULL);
fc_assert(priver != nullptr);
adjc_iterate(nmap, ptile, adjc_tile) {
if (tile_has_extra(adjc_tile, priver)) {
......
pextra = road_extra_get(proad);
return are_reqs_active(&(const struct req_context) { .tile = ptile },
NULL,
nullptr,
&pextra->reqs, RPT_POSSIBLE);
}
    (1-1/1)