Codechange: Add missing override specifiers.

This commit is contained in:
Peter Nelson 2023-04-13 07:23:18 +01:00 committed by PeterN
parent a454773a73
commit 49dae08a3b
34 changed files with 123 additions and 123 deletions

View File

@ -89,28 +89,28 @@ struct Aircraft FINAL : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
/** We want to 'destruct' the right class. */ /** We want to 'destruct' the right class. */
virtual ~Aircraft() { this->PreDestructor(); } virtual ~Aircraft() { this->PreDestructor(); }
void MarkDirty(); void MarkDirty() override;
void UpdateDeltaXY(); void UpdateDeltaXY() override;
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; } ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; }
bool IsPrimaryVehicle() const { return this->IsNormalAircraft(); } bool IsPrimaryVehicle() const override { return this->IsNormalAircraft(); }
void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override;
int GetDisplaySpeed() const { return this->cur_speed; } int GetDisplaySpeed() const override { return this->cur_speed; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; } int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; }
int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; } int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; }
int GetCurrentMaxSpeed() const { return this->GetSpeedOldUnits(); } int GetCurrentMaxSpeed() const override { return this->GetSpeedOldUnits(); }
Money GetRunningCost() const; Money GetRunningCost() const override;
bool IsInDepot() const bool IsInDepot() const override
{ {
assert(this->IsPrimaryVehicle()); assert(this->IsPrimaryVehicle());
return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile);
} }
bool Tick(); bool Tick() override;
void OnNewDay(); void OnNewDay() override;
uint Crash(bool flooded = false); uint Crash(bool flooded = false) override;
TileIndex GetOrderStationLocation(StationID station); TileIndex GetOrderStationLocation(StationID station) override;
ClosestDepot FindClosestDepot(); ClosestDepot FindClosestDepot() override;
/** /**
* Check if the aircraft type is a normal flying device; eg * Check if the aircraft type is a normal flying device; eg

View File

@ -116,7 +116,7 @@ public:
if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this); if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this);
} }
inline TileIterator& operator ++() inline TileIterator& operator ++() override
{ {
(*this).OrthogonalTileIterator::operator++(); (*this).OrthogonalTileIterator::operator++();
while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) { while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) {
@ -125,7 +125,7 @@ public:
return *this; return *this;
} }
virtual std::unique_ptr<TileIterator> Clone() const std::unique_ptr<TileIterator> Clone() const override
{ {
return std::make_unique<BitmapTileIterator>(*this); return std::make_unique<BitmapTileIterator>(*this);
} }

View File

@ -1862,17 +1862,17 @@ static ContentType StringToContentType(const char *str)
/** Asynchronous callback */ /** Asynchronous callback */
struct ConsoleContentCallback : public ContentCallback { struct ConsoleContentCallback : public ContentCallback {
void OnConnect(bool success) void OnConnect(bool success) override
{ {
IConsolePrint(CC_DEFAULT, "Content server connection {}.", success ? "established" : "failed"); IConsolePrint(CC_DEFAULT, "Content server connection {}.", success ? "established" : "failed");
} }
void OnDisconnect() void OnDisconnect() override
{ {
IConsolePrint(CC_DEFAULT, "Content server connection closed."); IConsolePrint(CC_DEFAULT, "Content server connection closed.");
} }
void OnDownloadComplete(ContentID cid) void OnDownloadComplete(ContentID cid) override
{ {
IConsolePrint(CC_DEFAULT, "Completed download of {}.", cid); IConsolePrint(CC_DEFAULT, "Completed download of {}.", cid);
} }

View File

@ -97,7 +97,7 @@ struct Pool : PoolBase {
Titem **data; ///< Pointer to array of pointers to Titem Titem **data; ///< Pointer to array of pointers to Titem
Pool(const char *name); Pool(const char *name);
virtual void CleanPool(); void CleanPool() override;
/** /**
* Returns Titem with given index * Returns Titem with given index

View File

@ -47,9 +47,9 @@ struct DisasterVehicle FINAL : public SpecializedVehicle<DisasterVehicle, VEH_DI
virtual ~DisasterVehicle() = default; virtual ~DisasterVehicle() = default;
void UpdatePosition(int x, int y, int z); void UpdatePosition(int x, int y, int z);
void UpdateDeltaXY(); void UpdateDeltaXY() override;
void UpdateImage(); void UpdateImage();
bool Tick(); bool Tick() override;
}; };
#endif /* DISASTER_VEHICLE_H */ #endif /* DISASTER_VEHICLE_H */

View File

@ -30,8 +30,8 @@ struct EffectVehicle FINAL : public SpecializedVehicle<EffectVehicle, VEH_EFFECT
/** We want to 'destruct' the right class. */ /** We want to 'destruct' the right class. */
virtual ~EffectVehicle() = default; virtual ~EffectVehicle() = default;
void UpdateDeltaXY(); void UpdateDeltaXY() override;
bool Tick(); bool Tick() override;
TransparencyOption GetTransparencyOption() const; TransparencyOption GetTransparencyOption() const;
}; };

View File

@ -121,22 +121,22 @@ struct TranslationWriter : LanguageWriter {
{ {
} }
void WriteHeader(const LanguagePackHeader *) void WriteHeader(const LanguagePackHeader *) override
{ {
/* We don't use the header. */ /* We don't use the header. */
} }
void Finalise() void Finalise() override
{ {
/* Nothing to do. */ /* Nothing to do. */
} }
void WriteLength(uint) void WriteLength(uint) override
{ {
/* We don't write the length. */ /* We don't write the length. */
} }
void Write(const byte *buffer, size_t length) void Write(const byte *buffer, size_t length) override
{ {
this->strings.emplace_back((const char *)buffer, length); this->strings.emplace_back((const char *)buffer, length);
} }
@ -154,12 +154,12 @@ struct StringNameWriter : HeaderWriter {
{ {
} }
void WriteStringID(const std::string &name, int stringid) void WriteStringID(const std::string &name, int stringid) override
{ {
if (stringid == (int)this->strings.size()) this->strings.emplace_back(name); if (stringid == (int)this->strings.size()) this->strings.emplace_back(name);
} }
void Finalise(const StringData &) void Finalise(const StringData &) override
{ {
/* Nothing to do. */ /* Nothing to do. */
} }

View File

@ -90,8 +90,8 @@ struct IniFile : IniLoadFile {
bool SaveToDisk(const std::string &filename); bool SaveToDisk(const std::string &filename);
virtual FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size); FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size) override;
virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post); void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override;
}; };
#endif /* INI_TYPE_H */ #endif /* INI_TYPE_H */

View File

@ -32,7 +32,7 @@ public:
* Call the demand calculator on the given component. * Call the demand calculator on the given component.
* @param job Component to calculate the demands for. * @param job Component to calculate the demands for.
*/ */
virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); } void Run(LinkGraphJob &job) const override { DemandCalculator c(job); }
/** /**
* Virtual destructor has to be defined because of virtual Run(). * Virtual destructor has to be defined because of virtual Run().

View File

@ -28,7 +28,7 @@ public:
* values. Only do that on the very last flow mapping. * values. Only do that on the very last flow mapping.
*/ */
FlowMapper(bool scale) : scale(scale) {} FlowMapper(bool scale) : scale(scale) {}
virtual void Run(LinkGraphJob &job) const; void Run(LinkGraphJob &job) const override;
private: private:

View File

@ -16,7 +16,7 @@ public:
* Initialize the link graph job. * Initialize the link graph job.
* @param job Job to be initialized. * @param job Job to be initialized.
*/ */
virtual void Run(LinkGraphJob &job) const { job.Init(); } void Run(LinkGraphJob &job) const override { job.Init(); }
}; };
#endif /* INIT_H */ #endif /* INIT_H */

View File

@ -80,7 +80,7 @@ public:
* Run the calculation. * Run the calculation.
* @param graph Component to be calculated. * @param graph Component to be calculated.
*/ */
virtual void Run(LinkGraphJob &job) const { Tpass pass(job); } void Run(LinkGraphJob &job) const override { Tpass pass(job); }
}; };
#endif /* MCF_H */ #endif /* MCF_H */

View File

@ -75,7 +75,7 @@ public:
ServerNetworkGameSocketHandler(SOCKET s); ServerNetworkGameSocketHandler(SOCKET s);
~ServerNetworkGameSocketHandler(); ~ServerNetworkGameSocketHandler();
virtual Packet *ReceivePacket() override; Packet *ReceivePacket() override;
NetworkRecvStatus CloseConnection(NetworkRecvStatus status) override; NetworkRecvStatus CloseConnection(NetworkRecvStatus status) override;
std::string GetClientName() const; std::string GetClientName() const;

View File

@ -43,7 +43,7 @@ public:
{ {
} }
inline TileIterator& operator ++() inline TileIterator& operator ++() override
{ {
this->att++; this->att++;
if (this->att->ti.x == -0x80) { if (this->att->ti.x == -0x80) {
@ -60,7 +60,7 @@ public:
return this->att->gfx; return this->att->gfx;
} }
virtual std::unique_ptr<TileIterator> Clone() const std::unique_ptr<TileIterator> Clone() const override
{ {
return std::make_unique<AirportTileTableIterator>(*this); return std::make_unique<AirportTileTableIterator>(*this);
} }

View File

@ -246,7 +246,7 @@ public:
struct IndustryTileSpec; struct IndustryTileSpec;
class IndustryTileOverrideManager : public OverrideManagerBase { class IndustryTileOverrideManager : public OverrideManagerBase {
protected: protected:
virtual bool CheckValidNewID(uint16_t testid) { return testid != 0xFF; } bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
public: public:
IndustryTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : IndustryTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
OverrideManagerBase(offset, maximum, invalid) {} OverrideManagerBase(offset, maximum, invalid) {}
@ -266,7 +266,7 @@ public:
struct AirportTileSpec; struct AirportTileSpec;
class AirportTileOverrideManager : public OverrideManagerBase { class AirportTileOverrideManager : public OverrideManagerBase {
protected: protected:
virtual bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
public: public:
AirportTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : AirportTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
OverrideManagerBase(offset, maximum, invalid) {} OverrideManagerBase(offset, maximum, invalid) {}
@ -277,7 +277,7 @@ public:
struct ObjectSpec; struct ObjectSpec;
class ObjectOverrideManager : public OverrideManagerBase { class ObjectOverrideManager : public OverrideManagerBase {
protected: protected:
virtual bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; }
public: public:
ObjectOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : ObjectOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) :
OverrideManagerBase(offset, maximum, invalid) {} OverrideManagerBase(offset, maximum, invalid) {}

View File

@ -32,8 +32,8 @@ struct RoadTypeScopeResolver : public ScopeResolver {
{ {
} }
/* virtual */ uint32_t GetRandomBits() const; uint32_t GetRandomBits() const override;
/* virtual */ uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override;
}; };
/** Resolver object for road types. */ /** Resolver object for road types. */

View File

@ -90,7 +90,7 @@ struct RealSpriteGroup : SpriteGroup {
std::vector<const SpriteGroup *> loading; ///< List of loading groups (can be SpriteIDs or Callback results) std::vector<const SpriteGroup *> loading; ///< List of loading groups (can be SpriteIDs or Callback results)
protected: protected:
const SpriteGroup *Resolve(ResolverObject &object) const; const SpriteGroup *Resolve(ResolverObject &object) const override;
}; };
/* Shared by deterministic and random groups. */ /* Shared by deterministic and random groups. */
@ -179,7 +179,7 @@ struct DeterministicSpriteGroup : SpriteGroup {
const SpriteGroup *error_group; // was first range, before sorting ranges const SpriteGroup *error_group; // was first range, before sorting ranges
protected: protected:
const SpriteGroup *Resolve(ResolverObject &object) const; const SpriteGroup *Resolve(ResolverObject &object) const override;
}; };
enum RandomizedSpriteGroupCompareMode { enum RandomizedSpriteGroupCompareMode {
@ -201,7 +201,7 @@ struct RandomizedSpriteGroup : SpriteGroup {
std::vector<const SpriteGroup *> groups; ///< Take the group with appropriate index: std::vector<const SpriteGroup *> groups; ///< Take the group with appropriate index:
protected: protected:
const SpriteGroup *Resolve(ResolverObject &object) const; const SpriteGroup *Resolve(ResolverObject &object) const override;
}; };
@ -227,7 +227,7 @@ struct CallbackResultSpriteGroup : SpriteGroup {
} }
uint16_t result; uint16_t result;
uint16_t GetCallbackResult() const { return this->result; } uint16_t GetCallbackResult() const override { return this->result; }
}; };
@ -249,8 +249,8 @@ struct ResultSpriteGroup : SpriteGroup {
SpriteID sprite; SpriteID sprite;
byte num_sprites; byte num_sprites;
SpriteID GetResult() const { return this->sprite; } SpriteID GetResult() const override { return this->sprite; }
byte GetNumResults() const { return this->num_sprites; } byte GetNumResults() const override { return this->num_sprites; }
}; };
/** /**

View File

@ -113,7 +113,7 @@ struct PersistentStorageArray : BasePersistentStorageArray {
return this->storage[pos]; return this->storage[pos];
} }
void ClearChanges() void ClearChanges() override
{ {
if (this->prev_storage) { if (this->prev_storage) {
this->storage = *this->prev_storage; this->storage = *this->prev_storage;

View File

@ -34,8 +34,8 @@ struct TownScopeResolver : public ScopeResolver {
{ {
} }
virtual uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override;
virtual void StorePSA(uint reg, int32_t value); void StorePSA(uint reg, int32_t value) override;
}; };
/** Resolver of town properties. */ /** Resolver of town properties. */

View File

@ -399,7 +399,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
static_assert(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed)); static_assert(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed));
} }
virtual void OnNewGRFsScanned() void OnNewGRFsScanned() override
{ {
ResetGRFConfig(false); ResetGRFConfig(false);

View File

@ -665,19 +665,19 @@ public:
}; };
inline const static SaveLoadCompatTable compat_description = _station_normal_sl_compat; inline const static SaveLoadCompatTable compat_description = _station_normal_sl_compat;
void Save(BaseStation *bst) const void Save(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) != 0) return; if ((bst->facilities & FACIL_WAYPOINT) != 0) return;
SlObject(bst, this->GetDescription()); SlObject(bst, this->GetDescription());
} }
void Load(BaseStation *bst) const void Load(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) != 0) return; if ((bst->facilities & FACIL_WAYPOINT) != 0) return;
SlObject(bst, this->GetLoadDescription()); SlObject(bst, this->GetLoadDescription());
} }
void FixPointers(BaseStation *bst) const void FixPointers(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) != 0) return; if ((bst->facilities & FACIL_WAYPOINT) != 0) return;
SlObject(bst, this->GetDescription()); SlObject(bst, this->GetDescription());
@ -696,19 +696,19 @@ public:
}; };
inline const static SaveLoadCompatTable compat_description = _station_waypoint_sl_compat; inline const static SaveLoadCompatTable compat_description = _station_waypoint_sl_compat;
void Save(BaseStation *bst) const void Save(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) == 0) return; if ((bst->facilities & FACIL_WAYPOINT) == 0) return;
SlObject(bst, this->GetDescription()); SlObject(bst, this->GetDescription());
} }
void Load(BaseStation *bst) const void Load(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) == 0) return; if ((bst->facilities & FACIL_WAYPOINT) == 0) return;
SlObject(bst, this->GetLoadDescription()); SlObject(bst, this->GetLoadDescription());
} }
void FixPointers(BaseStation *bst) const void FixPointers(BaseStation *bst) const override
{ {
if ((bst->facilities & FACIL_WAYPOINT) == 0) return; if ((bst->facilities & FACIL_WAYPOINT) == 0) return;
SlObject(bst, this->GetDescription()); SlObject(bst, this->GetDescription());

View File

@ -57,7 +57,7 @@ public:
/** /**
* @api -all * @api -all
*/ */
virtual void FinalRelease(); void FinalRelease() override;
}; };
#endif /* SCRIPT_ASYNCMODE_HPP */ #endif /* SCRIPT_ASYNCMODE_HPP */

View File

@ -48,7 +48,7 @@ public:
/** /**
* @api -all * @api -all
*/ */
virtual void FinalRelease(); void FinalRelease() override;
}; };
#endif /* SCRIPT_EXECMODE_HPP */ #endif /* SCRIPT_EXECMODE_HPP */

View File

@ -90,7 +90,7 @@ public:
this->End(); this->End();
} }
SQInteger Begin() SQInteger Begin() override
{ {
if (this->list->buckets.empty()) return 0; if (this->list->buckets.empty()) return 0;
this->has_no_more_items = false; this->has_no_more_items = false;
@ -105,7 +105,7 @@ public:
return item_current; return item_current;
} }
void End() void End() override
{ {
this->bucket_list = nullptr; this->bucket_list = nullptr;
this->has_no_more_items = true; this->has_no_more_items = true;
@ -135,7 +135,7 @@ public:
this->item_next = *this->bucket_list_iter; this->item_next = *this->bucket_list_iter;
} }
SQInteger Next() SQInteger Next() override
{ {
if (this->IsEnd()) return 0; if (this->IsEnd()) return 0;
@ -144,7 +144,7 @@ public:
return item_current; return item_current;
} }
void Remove(SQInteger item) void Remove(SQInteger item) override
{ {
if (this->IsEnd()) return; if (this->IsEnd()) return;
@ -179,7 +179,7 @@ public:
this->End(); this->End();
} }
SQInteger Begin() SQInteger Begin() override
{ {
if (this->list->buckets.empty()) return 0; if (this->list->buckets.empty()) return 0;
this->has_no_more_items = false; this->has_no_more_items = false;
@ -199,7 +199,7 @@ public:
return item_current; return item_current;
} }
void End() void End() override
{ {
this->bucket_list = nullptr; this->bucket_list = nullptr;
this->has_no_more_items = true; this->has_no_more_items = true;
@ -232,7 +232,7 @@ public:
this->item_next = *this->bucket_list_iter; this->item_next = *this->bucket_list_iter;
} }
SQInteger Next() SQInteger Next() override
{ {
if (this->IsEnd()) return 0; if (this->IsEnd()) return 0;
@ -241,7 +241,7 @@ public:
return item_current; return item_current;
} }
void Remove(SQInteger item) void Remove(SQInteger item) override
{ {
if (this->IsEnd()) return; if (this->IsEnd()) return;
@ -271,7 +271,7 @@ public:
this->End(); this->End();
} }
SQInteger Begin() SQInteger Begin() override
{ {
if (this->list->items.empty()) return 0; if (this->list->items.empty()) return 0;
this->has_no_more_items = false; this->has_no_more_items = false;
@ -284,7 +284,7 @@ public:
return item_current; return item_current;
} }
void End() void End() override
{ {
this->has_no_more_items = true; this->has_no_more_items = true;
} }
@ -302,7 +302,7 @@ public:
if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first;
} }
SQInteger Next() SQInteger Next() override
{ {
if (this->IsEnd()) return 0; if (this->IsEnd()) return 0;
@ -311,7 +311,7 @@ public:
return item_current; return item_current;
} }
void Remove(SQInteger item) void Remove(SQInteger item) override
{ {
if (this->IsEnd()) return; if (this->IsEnd()) return;
@ -344,7 +344,7 @@ public:
this->End(); this->End();
} }
SQInteger Begin() SQInteger Begin() override
{ {
if (this->list->items.empty()) return 0; if (this->list->items.empty()) return 0;
this->has_no_more_items = false; this->has_no_more_items = false;
@ -358,7 +358,7 @@ public:
return item_current; return item_current;
} }
void End() void End() override
{ {
this->has_no_more_items = true; this->has_no_more_items = true;
} }
@ -381,7 +381,7 @@ public:
if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first;
} }
SQInteger Next() SQInteger Next() override
{ {
if (this->IsEnd()) return 0; if (this->IsEnd()) return 0;
@ -390,7 +390,7 @@ public:
return item_current; return item_current;
} }
void Remove(SQInteger item) void Remove(SQInteger item) override
{ {
if (this->IsEnd()) return; if (this->IsEnd()) return;

View File

@ -50,7 +50,7 @@ public:
/** /**
* @api -all * @api -all
*/ */
virtual void FinalRelease(); void FinalRelease() override;
}; };
#endif /* SCRIPT_TESTMODE_HPP */ #endif /* SCRIPT_TESTMODE_HPP */

View File

@ -125,7 +125,7 @@ public:
/** /**
* @api -all * @api -all
*/ */
virtual std::string GetEncodedText(); std::string GetEncodedText() override;
private: private:
using ScriptTextRef = ScriptObjectRef<ScriptText>; using ScriptTextRef = ScriptObjectRef<ScriptText>;

View File

@ -1016,11 +1016,11 @@ struct SettingEntry : BaseSettingEntry {
SettingEntry(const char *name); SettingEntry(const char *name);
virtual void Init(byte level = 0); void Init(byte level = 0) override;
virtual void ResetAll(); void ResetAll() override;
virtual uint Length() const; uint Length() const override;
virtual uint GetMaxHelpHeight(int maxw); uint GetMaxHelpHeight(int maxw) override;
virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); bool UpdateFilterState(SettingFilter &filter, bool force_visible) override;
void SetButtons(byte new_val); void SetButtons(byte new_val);
@ -1036,7 +1036,7 @@ struct SettingEntry : BaseSettingEntry {
void SetValueDParams(uint first_param, int32_t value) const; void SetValueDParams(uint first_param, int32_t value) const;
protected: protected:
virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override;
private: private:
bool IsVisibleByRestrictionMode(RestrictionMode mode) const; bool IsVisibleByRestrictionMode(RestrictionMode mode) const;
@ -1077,23 +1077,23 @@ struct SettingsPage : BaseSettingEntry, SettingsContainer {
SettingsPage(StringID title); SettingsPage(StringID title);
virtual void Init(byte level = 0); void Init(byte level = 0) override;
virtual void ResetAll(); void ResetAll() override;
virtual void FoldAll(); void FoldAll() override;
virtual void UnFoldAll(); void UnFoldAll() override;
virtual uint Length() const; uint Length() const override;
virtual void GetFoldingState(bool &all_folded, bool &all_unfolded) const; void GetFoldingState(bool &all_folded, bool &all_unfolded) const override;
virtual bool IsVisible(const BaseSettingEntry *item) const; bool IsVisible(const BaseSettingEntry *item) const override;
virtual BaseSettingEntry *FindEntry(uint row, uint *cur_row); BaseSettingEntry *FindEntry(uint row, uint *cur_row) override;
virtual uint GetMaxHelpHeight(int maxw) { return SettingsContainer::GetMaxHelpHeight(maxw); } uint GetMaxHelpHeight(int maxw) override { return SettingsContainer::GetMaxHelpHeight(maxw); }
virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); bool UpdateFilterState(SettingFilter &filter, bool force_visible) override;
virtual uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const; uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const override;
protected: protected:
virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override;
}; };
/* == BaseSettingEntry methods == */ /* == BaseSettingEntry methods == */

View File

@ -159,7 +159,7 @@ struct SettingsIniFile : IniLoadFile {
{ {
} }
virtual FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) override
{ {
/* Open the text file in binary mode to prevent end-of-line translations /* Open the text file in binary mode to prevent end-of-line translations
* done by ftell() and friends, as defined by K&R. */ * done by ftell() and friends, as defined by K&R. */
@ -173,7 +173,7 @@ struct SettingsIniFile : IniLoadFile {
return in; return in;
} }
virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post) void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override
{ {
FatalError("{}{}{}", pre, buffer, post); FatalError("{}{}{}", pre, buffer, post);
} }

View File

@ -15,19 +15,19 @@
/** Implementation of the allegro sound driver. */ /** Implementation of the allegro sound driver. */
class SoundDriver_Allegro : public SoundDriver { class SoundDriver_Allegro : public SoundDriver {
public: public:
const char *Start(const StringList &param); const char *Start(const StringList &param) override;
void Stop(); void Stop() override;
void MainLoop(); void MainLoop() override;
const char *GetName() const { return "allegro"; } const char *GetName() const override { return "allegro"; }
}; };
/** Factory for the allegro sound driver. */ /** Factory for the allegro sound driver. */
class FSoundDriver_Allegro : public DriverFactoryBase { class FSoundDriver_Allegro : public DriverFactoryBase {
public: public:
FSoundDriver_Allegro() : DriverFactoryBase(Driver::DT_SOUND, 4, "allegro", "Allegro Sound Driver (param hz,samples)") {} FSoundDriver_Allegro() : DriverFactoryBase(Driver::DT_SOUND, 4, "allegro", "Allegro Sound Driver (param hz,samples)") {}
/* virtual */ Driver *CreateInstance() const { return new SoundDriver_Allegro(); } Driver *CreateInstance() const override { return new SoundDriver_Allegro(); }
}; };
#endif /* SOUND_ALLEGRO_H */ #endif /* SOUND_ALLEGRO_H */

View File

@ -17,7 +17,7 @@ class SpriteLoaderGrf : public SpriteLoader {
byte container_ver; byte container_ver;
public: public:
SpriteLoaderGrf(byte container_ver) : container_ver(container_ver) {} SpriteLoaderGrf(byte container_ver) : container_ver(container_ver) {}
uint8_t LoadSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags); uint8_t LoadSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags) override;
}; };
#endif /* SPRITELOADER_GRF_HPP */ #endif /* SPRITELOADER_GRF_HPP */

View File

@ -538,7 +538,7 @@ public:
if (!st->TileBelongsToAirport(this->tile)) ++(*this); if (!st->TileBelongsToAirport(this->tile)) ++(*this);
} }
inline TileIterator& operator ++() inline TileIterator& operator ++() override
{ {
(*this).OrthogonalTileIterator::operator++(); (*this).OrthogonalTileIterator::operator++();
while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) { while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) {
@ -547,7 +547,7 @@ public:
return *this; return *this;
} }
virtual std::unique_ptr<TileIterator> Clone() const std::unique_ptr<TileIterator> Clone() const override
{ {
return std::make_unique<AirportTileIterator>(*this); return std::make_unique<AirportTileIterator>(*this);
} }

View File

@ -238,7 +238,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
this->output_stream << "#define TABLE_STRINGS_H\n"; this->output_stream << "#define TABLE_STRINGS_H\n";
} }
void WriteStringID(const std::string &name, int stringid) void WriteStringID(const std::string &name, int stringid) override
{ {
if (prev + 1 != stringid) this->output_stream << "\n"; if (prev + 1 != stringid) this->output_stream << "\n";
fmt::print(this->output_stream, "static const StringID {} = 0x{:X};\n", name, stringid); fmt::print(this->output_stream, "static const StringID {} = 0x{:X};\n", name, stringid);
@ -246,7 +246,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
total_strings++; total_strings++;
} }
void Finalise(const StringData &data) void Finalise(const StringData &data) override
{ {
/* Find the plural form with the most amount of cases. */ /* Find the plural form with the most amount of cases. */
int max_plural_forms = 0; int max_plural_forms = 0;
@ -293,18 +293,18 @@ struct LanguageFileWriter : LanguageWriter, FileWriter {
{ {
} }
void WriteHeader(const LanguagePackHeader *header) void WriteHeader(const LanguagePackHeader *header) override
{ {
this->Write((const byte *)header, sizeof(*header)); this->Write((const byte *)header, sizeof(*header));
} }
void Finalise() void Finalise() override
{ {
this->output_stream.put(0); this->output_stream.put(0);
this->FileWriter::Finalise(); this->FileWriter::Finalise();
} }
void Write(const byte *buffer, size_t length) void Write(const byte *buffer, size_t length) override
{ {
this->output_stream.write((const char *)buffer, length); this->output_stream.write((const char *)buffer, length);
} }

View File

@ -812,14 +812,14 @@ public:
{ {
} }
virtual void SetString(const char *s) void SetString(const char *s) override
{ {
this->string = s; this->string = s;
this->len = strlen(s); this->len = strlen(s);
this->cur_pos = 0; this->cur_pos = 0;
} }
virtual size_t SetCurPosition(size_t pos) size_t SetCurPosition(size_t pos) override
{ {
assert(this->string != nullptr && pos <= this->len); assert(this->string != nullptr && pos <= this->len);
/* Sanitize in case we get a position inside an UTF-8 sequence. */ /* Sanitize in case we get a position inside an UTF-8 sequence. */
@ -827,7 +827,7 @@ public:
return this->cur_pos = pos; return this->cur_pos = pos;
} }
virtual size_t Next(IterType what) size_t Next(IterType what) override
{ {
assert(this->string != nullptr); assert(this->string != nullptr);
@ -865,7 +865,7 @@ public:
return END; return END;
} }
virtual size_t Prev(IterType what) size_t Prev(IterType what) override
{ {
assert(this->string != nullptr); assert(this->string != nullptr);

View File

@ -210,7 +210,7 @@ public:
/** /**
* Move ourselves to the next tile in the rectangle on the map. * Move ourselves to the next tile in the rectangle on the map.
*/ */
inline TileIterator& operator ++() inline TileIterator& operator ++() override
{ {
assert(this->tile != INVALID_TILE); assert(this->tile != INVALID_TILE);
@ -225,7 +225,7 @@ public:
return *this; return *this;
} }
virtual std::unique_ptr<TileIterator> Clone() const std::unique_ptr<TileIterator> Clone() const override
{ {
return std::make_unique<OrthogonalTileIterator>(*this); return std::make_unique<OrthogonalTileIterator>(*this);
} }
@ -262,9 +262,9 @@ public:
*this = DiagonalTileIterator(DiagonalTileArea(corner1, corner2)); *this = DiagonalTileIterator(DiagonalTileArea(corner1, corner2));
} }
TileIterator& operator ++(); TileIterator& operator ++() override;
virtual std::unique_ptr<TileIterator> Clone() const std::unique_ptr<TileIterator> Clone() const override
{ {
return std::make_unique<DiagonalTileIterator>(*this); return std::make_unique<DiagonalTileIterator>(*this);
} }