forked from mirror/OpenTTD
Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
committed by
Michael Lutz
parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -45,7 +45,7 @@ struct SignList {
|
||||
|
||||
StringFilter string_filter; ///< The match string to be used when the GUIList is (re)-sorted.
|
||||
static bool match_case; ///< Should case sensitive matching be used?
|
||||
static char default_name[64]; ///< Default sign name, used if Sign::name is NULL.
|
||||
static char default_name[64]; ///< Default sign name, used if Sign::name is nullptr.
|
||||
|
||||
/**
|
||||
* Creates a SignList with filtering disabled by default.
|
||||
@@ -81,8 +81,8 @@ struct SignList {
|
||||
const char *a_name = (*a)->name;
|
||||
const char *b_name = (*b)->name;
|
||||
|
||||
if (a_name == NULL) a_name = SignList::default_name;
|
||||
if (b_name == NULL) b_name = SignList::default_name;
|
||||
if (a_name == nullptr) a_name = SignList::default_name;
|
||||
if (b_name == nullptr) b_name = SignList::default_name;
|
||||
|
||||
int r = strnatcmp(a_name, b_name); // Sort by name (natural sorting).
|
||||
|
||||
@@ -100,7 +100,7 @@ struct SignList {
|
||||
/* Same performance benefit as above for sorting. */
|
||||
const char *a_name = (*a)->name;
|
||||
|
||||
if (a_name == NULL) a_name = SignList::default_name;
|
||||
if (a_name == nullptr) a_name = SignList::default_name;
|
||||
|
||||
filter.ResetState();
|
||||
filter.AddLine(a_name);
|
||||
@@ -168,7 +168,7 @@ struct SignListWindow : Window, SignList {
|
||||
|
||||
void OnInit() override
|
||||
{
|
||||
/* Default sign name, used if Sign::name is NULL. */
|
||||
/* Default sign name, used if Sign::name is nullptr. */
|
||||
GetString(SignList::default_name, STR_DEFAULT_SIGN_NAME, lastof(SignList::default_name));
|
||||
this->signs.ForceResort();
|
||||
this->SortSignsList();
|
||||
@@ -352,7 +352,7 @@ static EventState SignListGlobalHotkeys(int hotkey)
|
||||
{
|
||||
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
|
||||
Window *w = ShowSignList();
|
||||
if (w == NULL) return ES_NOT_HANDLED;
|
||||
if (w == nullptr) return ES_NOT_HANDLED;
|
||||
return w->OnHotkey(hotkey);
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ static WindowDesc _sign_list_desc(
|
||||
/**
|
||||
* Open the sign list window
|
||||
*
|
||||
* @return newly opened sign list window, or NULL if the window could not be opened.
|
||||
* @return newly opened sign list window, or nullptr if the window could not be opened.
|
||||
*/
|
||||
Window *ShowSignList()
|
||||
{
|
||||
@@ -418,7 +418,7 @@ Window *ShowSignList()
|
||||
static bool RenameSign(SignID index, const char *text)
|
||||
{
|
||||
bool remove = StrEmpty(text);
|
||||
DoCommandP(0, index, 0, CMD_RENAME_SIGN | (StrEmpty(text) ? CMD_MSG(STR_ERROR_CAN_T_DELETE_SIGN) : CMD_MSG(STR_ERROR_CAN_T_CHANGE_SIGN_NAME)), NULL, text);
|
||||
DoCommandP(0, index, 0, CMD_RENAME_SIGN | (StrEmpty(text) ? CMD_MSG(STR_ERROR_CAN_T_DELETE_SIGN) : CMD_MSG(STR_ERROR_CAN_T_CHANGE_SIGN_NAME)), nullptr, text);
|
||||
return remove;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ struct SignWindow : Window, SignList {
|
||||
void UpdateSignEditWindow(const Sign *si)
|
||||
{
|
||||
/* Display an empty string when the sign hasn't been edited yet */
|
||||
if (si->name != NULL) {
|
||||
if (si->name != nullptr) {
|
||||
SetDParam(0, si->index);
|
||||
this->name_editbox.text.Assign(STR_SIGN_NAME);
|
||||
} else {
|
||||
@@ -559,7 +559,7 @@ static WindowDesc _query_sign_edit_desc(
|
||||
void HandleClickOnSign(const Sign *si)
|
||||
{
|
||||
if (_ctrl_pressed && (si->owner == _local_company || (si->owner == OWNER_DEITY && _game_mode == GM_EDITOR))) {
|
||||
RenameSign(si->index, NULL);
|
||||
RenameSign(si->index, nullptr);
|
||||
return;
|
||||
}
|
||||
ShowRenameSignWindow(si);
|
||||
@@ -585,5 +585,5 @@ void DeleteRenameSignWindow(SignID sign)
|
||||
{
|
||||
SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, WN_QUERY_STRING_SIGN));
|
||||
|
||||
if (w != NULL && w->cur_sign == sign) delete w;
|
||||
if (w != nullptr && w->cur_sign == sign) delete w;
|
||||
}
|
||||
|
Reference in New Issue
Block a user