1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 20:49:11 +00:00

Codechange: Use override specifer for overriding member declarations

This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
This commit is contained in:
Henry Wilson
2019-03-03 22:25:13 +00:00
committed by Michael Lutz
parent 31260e6625
commit af7d9020a1
85 changed files with 565 additions and 565 deletions

View File

@@ -84,7 +84,7 @@ struct PacketReader : LoadFilter {
this->buf += to_write;
}
/* virtual */ size_t Read(byte *rbuf, size_t size)
size_t Read(byte *rbuf, size_t size) override
{
/* Limit the amount to read to whatever we still have. */
size_t ret_size = size = min(this->written_bytes - this->read_bytes, size);
@@ -106,7 +106,7 @@ struct PacketReader : LoadFilter {
return ret_size;
}
/* virtual */ void Reset()
void Reset() override
{
this->read_bytes = 0;

View File

@@ -64,7 +64,7 @@ struct ContentTextfileWindow : public TextfileWindow {
}
}
/* virtual */ void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
if (widget == WID_TF_CAPTION) {
SetDParam(0, this->GetTypeString());

View File

@@ -117,7 +117,7 @@ public:
*lastof(this->visible) = true;
}
void SetupSmallestSize(Window *w, bool init_array)
void SetupSmallestSize(Window *w, bool init_array) override
{
/* Oh yeah, we ought to be findable! */
w->nested_array[WID_NG_HEADER] = this;
@@ -143,7 +143,7 @@ public:
this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@@ -183,7 +183,7 @@ public:
}
}
/* virtual */ void Draw(const Window *w)
void Draw(const Window *w) override
{
int i = 0;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
@@ -193,7 +193,7 @@ public:
}
}
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y)
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;

View File

@@ -163,7 +163,7 @@ struct PacketWriter : SaveFilter {
this->current = NULL;
}
/* virtual */ void Write(byte *buf, size_t size)
void Write(byte *buf, size_t size) override
{
/* We want to abort the saving when the socket is closed. */
if (this->cs == NULL) SlError(STR_NETWORK_ERROR_LOSTCONNECTION);
@@ -190,7 +190,7 @@ struct PacketWriter : SaveFilter {
this->total_size += size;
}
/* virtual */ void Finish()
void Finish() override
{
/* We want to abort the saving when the socket is closed. */
if (this->cs == NULL) SlError(STR_NETWORK_ERROR_LOSTCONNECTION);