1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00

Codechange: remove ZeroedMemoryAllocator from NWidgetBase

This commit is contained in:
Rubidium
2025-02-22 12:07:17 +01:00
committed by rubidium42
parent bb4ac915ff
commit 5cee804f98
8 changed files with 88 additions and 115 deletions

View File

@@ -844,17 +844,6 @@ static void DrawOutline(const Window *, const NWidgetBase *wid)
* @see NestedWidgetParts
*/
/**
* Base class constructor.
* @param tp Nested widget type.
*/
NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator()
{
this->type = tp;
}
/* ~NWidgetContainer() takes care of #next and #prev data members. */
/**
* @fn void NWidgetBase::SetupSmallestSize(Window *w)
* Compute smallest size needed by the widget.
@@ -1116,10 +1105,7 @@ NWidgetCore::NWidgetCore(WidgetType tp, Colours colour, WidgetID index, uint fil
this->colour = colour;
this->widget_data = widget_data;
this->SetToolTip(tool_tip);
this->scrollbar_index = -1;
this->text_colour = tp == WWT_CAPTION ? TC_WHITE : TC_BLACK;
this->text_size = FS_NORMAL;
this->align = SA_CENTER;
}
/**
@@ -1312,13 +1298,6 @@ NWidgetCore *NWidgetContainer::GetWidgetFromPos(int x, int y)
return nullptr;
}
/**
* Widgets stacked on top of each other.
*/
NWidgetStacked::NWidgetStacked(WidgetID index) : NWidgetContainer(NWID_SELECTION), index(index)
{
}
void NWidgetStacked::SetupSmallestSize(Window *w)
{
/* Zero size plane selected */
@@ -1426,7 +1405,7 @@ bool NWidgetStacked::SetDisplayedPlane(int plane)
class NWidgetLayer : public NWidgetContainer {
public:
NWidgetLayer(WidgetID index);
NWidgetLayer(WidgetID index) : NWidgetContainer(NWID_LAYER), index(index) {}
void SetupSmallestSize(Window *w) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
@@ -1436,8 +1415,6 @@ public:
const WidgetID index; ///< If non-negative, index in the #Window::widget_lookup.
};
NWidgetLayer::NWidgetLayer(WidgetID index) : NWidgetContainer(NWID_LAYER), index(index) {}
void NWidgetLayer::SetupSmallestSize(Window *w)
{
/* First sweep, recurse down and compute minimal size and filling. */
@@ -1947,7 +1924,7 @@ NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int, int)
return nullptr;
}
NWidgetMatrix::NWidgetMatrix(Colours colour, WidgetID index) : NWidgetPIPContainer(NWID_MATRIX, NWidContainerFlag::EqualSize), index(index), clicked(-1), count(-1)
NWidgetMatrix::NWidgetMatrix(Colours colour, WidgetID index) : NWidgetPIPContainer(NWID_MATRIX, NWidContainerFlag::EqualSize), index(index)
{
this->colour = colour;
}