summaryrefslogtreecommitdiff
path: root/src/smallmap_gui.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-04-10 22:07:06 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-10 23:22:20 +0200
commit7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch)
tree99f134b7e66367cf11e10bc5061896eab4a3264f /src/smallmap_gui.cpp
parent3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff)
downloadopenttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/smallmap_gui.cpp')
-rw-r--r--src/smallmap_gui.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 5286d2d63..124985173 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -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;
}