Feature #1755 ยป 0041-counters.c-Replace-NULL-with-nullptr.patch
| common/counters.c | ||
|---|---|---|
|
for (i = 0; i < game.control.num_counters; i++) {
|
||
|
if (NULL != counters[i].helptext) {
|
||
|
if (counters[i].helptext != nullptr) {
|
||
|
strvec_destroy(counters[i].helptext);
|
||
|
counters[i].helptext = NULL;
|
||
|
counters[i].helptext = nullptr;
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
****************************************************************************/
|
||
|
struct counter *counter_by_id(int id)
|
||
|
{
|
||
|
fc_assert_ret_val(id < game.control.num_counters, NULL);
|
||
|
fc_assert_ret_val(id < game.control.num_counters, nullptr);
|
||
|
return &counters[id];
|
||
|
}
|
||
| ... | ... | |
|
****************************************************************************/
|
||
|
int counter_id(struct counter *pcount)
|
||
|
{
|
||
|
fc_assert_ret_val(NULL != pcount, -1);
|
||
|
fc_assert_ret_val(pcount != nullptr, -1);
|
||
|
return pcount - counters;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Search for counter by rule name
|
||
|
(return matched counter if found or NULL)
|
||
|
(return matched counter if found or nullptr)
|
||
|
****************************************************************************/
|
||
|
struct counter *counter_by_rule_name(const char *name)
|
||
|
{
|
||
|
int i;
|
||
|
fc_assert_ret_val(NULL != name, NULL);
|
||
|
fc_assert_ret_val('\0' != name[0], NULL);
|
||
|
fc_assert_ret_val(name != nullptr, nullptr);
|
||
|
fc_assert_ret_val('\0' != name[0], nullptr);
|
||
|
for (i = 0; i < game.control.num_counters; i++)
|
||
|
{
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Search for counter by translated name
|
||
|
(return matched counter if found or NULL)
|
||
|
(return matched counter if found or nullptr)
|
||
|
****************************************************************************/
|
||
|
struct counter *counter_by_translated_name(const char *name)
|
||
|
{
|
||
|
int i;
|
||
|
fc_assert_ret_val(NULL != name, NULL);
|
||
|
fc_assert_ret_val('\0' != name[0], NULL);
|
||
|
fc_assert_ret_val(name != nullptr, nullptr);
|
||
|
fc_assert_ret_val('\0' != name[0], nullptr);
|
||
|
for (i = 0; i < game.control.num_counters; i++)
|
||
|
{
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
| ... | ... | |
|
****************************************************************************/
|
||
|
const char *counter_rule_name(struct counter *pcount)
|
||
|
{
|
||
|
fc_assert_ret_val(NULL != pcount, NULL);
|
||
|
fc_assert_ret_val(pcount != nullptr, nullptr);
|
||
|
return rule_name_get(&pcount->name);
|
||
|
}
|
||
| ... | ... | |
|
***************************************************************************/
|
||
|
int counter_index(const struct counter *pcount)
|
||
|
{
|
||
|
fc_assert_ret_val(NULL != pcount, -1);
|
||
|
fc_assert_ret_val(pcount != nullptr, -1);
|
||
|
return pcount->index;
|
||
|
}
|
||
| ... | ... | |
|
return counters_city[index];
|
||
|
}
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||