Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Henry Wilson
2019-04-10 22:07:06 +01:00
committed by Michael Lutz
parent 3b4f224c0b
commit 7c8e7c6b6e
463 changed files with 5674 additions and 5674 deletions

View File

@@ -272,9 +272,9 @@ struct SmallMapColourScheme {
/** Available colour schemes for height maps. */
static SmallMapColourScheme _heightmap_schemes[] = {
{NULL, _green_map_heights, lengthof(_green_map_heights), MKCOLOUR_XXXX(0x54)}, ///< Green colour scheme.
{NULL, _dark_green_map_heights, lengthof(_dark_green_map_heights), MKCOLOUR_XXXX(0x62)}, ///< Dark green colour scheme.
{NULL, _violet_map_heights, lengthof(_violet_map_heights), MKCOLOUR_XXXX(0x81)}, ///< Violet colour scheme.
{nullptr, _green_map_heights, lengthof(_green_map_heights), MKCOLOUR_XXXX(0x54)}, ///< Green colour scheme.
{nullptr, _dark_green_map_heights, lengthof(_dark_green_map_heights), MKCOLOUR_XXXX(0x62)}, ///< Dark green colour scheme.
{nullptr, _violet_map_heights, lengthof(_violet_map_heights), MKCOLOUR_XXXX(0x81)}, ///< Violet colour scheme.
};
/**
@@ -283,7 +283,7 @@ static SmallMapColourScheme _heightmap_schemes[] = {
void BuildLandLegend()
{
/* The smallmap window has never been initialized, so no need to change the legend. */
if (_heightmap_schemes[0].height_colours == NULL) return;
if (_heightmap_schemes[0].height_colours == nullptr) return;
/*
* The general idea of this function is to fill the legend with an appropriate evenly spaced
@@ -1071,7 +1071,7 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des
this->SetupWidgetData();
this->SetZoomLevel(ZLC_INITIALIZE, NULL);
this->SetZoomLevel(ZLC_INITIALIZE, nullptr);
this->SmallMapCenterOnCurrentPos();
this->SetOverlayCargoMask();
}
@@ -1474,7 +1474,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
case WID_SM_ENABLE_ALL:
case WID_SM_DISABLE_ALL: {
LegendAndColour *tbl = NULL;
LegendAndColour *tbl = nullptr;
switch (this->map_type) {
case SMT_INDUSTRY:
tbl = _legend_from_industries;
@@ -1682,7 +1682,7 @@ class NWidgetSmallmapDisplay : public NWidgetContainer {
public:
NWidgetSmallmapDisplay() : NWidgetContainer(NWID_VERTICAL)
{
this->smallmap_window = NULL;
this->smallmap_window = nullptr;
}
void SetupSmallestSize(Window *w, bool init_array) override
@@ -1694,7 +1694,7 @@ public:
bar->SetupSmallestSize(w, init_array);
this->smallmap_window = dynamic_cast<SmallMapWindow *>(w);
assert(this->smallmap_window != NULL);
assert(this->smallmap_window != nullptr);
this->smallest_x = max(display->smallest_x, bar->smallest_x + smallmap_window->GetMinLegendWidth());
this->smallest_y = display->smallest_y + max(bar->smallest_y, smallmap_window->GetLegendHeight(smallmap_window->min_number_of_columns));
this->fill_x = max(display->fill_x, bar->fill_x);
@@ -1729,17 +1729,17 @@ public:
NWidgetCore *GetWidgetFromPos(int x, int y) override
{
if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return nullptr;
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
NWidgetCore *widget = child_wid->GetWidgetFromPos(x, y);
if (widget != NULL) return widget;
if (widget != nullptr) return widget;
}
return NULL;
return nullptr;
}
void Draw(const Window *w) override
{
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) child_wid->Draw(w);
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) child_wid->Draw(w);
}
};
@@ -1862,7 +1862,7 @@ bool ScrollMainWindowTo(int x, int y, int z, bool instant)
if (res) return res;
SmallMapWindow *w = dynamic_cast<SmallMapWindow*>(FindWindowById(WC_SMALLMAP, 0));
if (w != NULL) w->SmallMapCenterOnCurrentPos();
if (w != nullptr) w->SmallMapCenterOnCurrentPos();
return res;
}