From b304c06a4a7c666260b42e07d064b4ae32ff16a7 Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Fri, 4 Nov 2022 19:12:51 +0000 Subject: [PATCH] Codechange: Use override specifier for Train and RoadVehicle structs --- src/roadveh.h | 34 +++++++++++++++++----------------- src/train.h | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/roadveh.h b/src/roadveh.h index 249b8279c8..e1406cb7cb 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -124,28 +124,28 @@ struct RoadVehicle FINAL : public GroundVehicle { friend struct GroundVehicle; // GroundVehicle needs to use the acceleration functions defined at RoadVehicle. - void MarkDirty(); - void UpdateDeltaXY(); - ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_REVENUE : EXPENSES_ROADVEH_RUN; } - bool IsPrimaryVehicle() const { return this->IsFrontEngine(); } - void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; - int GetDisplaySpeed() const { return this->gcache.last_speed / 2; } - int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; } - Money GetRunningCost() const; + void MarkDirty() override; + void UpdateDeltaXY() override; + ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_ROADVEH_REVENUE : EXPENSES_ROADVEH_RUN; } + bool IsPrimaryVehicle() const override { return this->IsFrontEngine(); } + void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override; + int GetDisplaySpeed() const override { return this->gcache.last_speed / 2; } + int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed / 2; } + Money GetRunningCost() const override; int GetDisplayImageWidth(Point *offset = nullptr) const; - bool IsInDepot() const { return this->state == RVSB_IN_DEPOT; } - bool Tick(); - void OnNewDay(); - uint Crash(bool flooded = false); - Trackdir GetVehicleTrackdir() const; - TileIndex GetOrderStationLocation(StationID station); - bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); + bool IsInDepot() const override { return this->state == RVSB_IN_DEPOT; } + bool Tick() override; + void OnNewDay() override; + uint Crash(bool flooded = false) override; + Trackdir GetVehicleTrackdir() const override; + TileIndex GetOrderStationLocation(StationID station) override; + bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) override; bool IsBus() const; - int GetCurrentMaxSpeed() const; + int GetCurrentMaxSpeed() const override; int UpdateSpeed(); - void SetDestTile(TileIndex tile); + void SetDestTile(TileIndex tile) override; protected: // These functions should not be called outside acceleration code. diff --git a/src/train.h b/src/train.h index 60e1a2e281..8ff597ebb8 100644 --- a/src/train.h +++ b/src/train.h @@ -107,23 +107,23 @@ struct Train FINAL : public GroundVehicle { friend struct GroundVehicle; // GroundVehicle needs to use the acceleration functions defined at Train. - void MarkDirty(); - void UpdateDeltaXY(); - ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_REVENUE : EXPENSES_TRAIN_RUN; } - void PlayLeaveStationSound() const; - bool IsPrimaryVehicle() const { return this->IsFrontEngine(); } - void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; - int GetDisplaySpeed() const { return this->gcache.last_speed; } - int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; } - Money GetRunningCost() const; + void MarkDirty() override; + void UpdateDeltaXY() override; + ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_TRAIN_REVENUE : EXPENSES_TRAIN_RUN; } + void PlayLeaveStationSound() const override; + bool IsPrimaryVehicle() const override { return this->IsFrontEngine(); } + void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override; + int GetDisplaySpeed() const override { return this->gcache.last_speed; } + int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; } + Money GetRunningCost() const override; int GetDisplayImageWidth(Point *offset = nullptr) const; - bool IsInDepot() const { return this->track == TRACK_BIT_DEPOT; } - bool Tick(); - void OnNewDay(); - uint Crash(bool flooded = false); - Trackdir GetVehicleTrackdir() const; - TileIndex GetOrderStationLocation(StationID station); - bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); + bool IsInDepot() const override { return this->track == TRACK_BIT_DEPOT; } + bool Tick() override; + void OnNewDay() override; + uint Crash(bool flooded = false) override; + Trackdir GetVehicleTrackdir() const override; + TileIndex GetOrderStationLocation(StationID station) override; + bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) override; void ReserveTrackUnderConsist() const; @@ -135,7 +135,7 @@ struct Train FINAL : public GroundVehicle { void UpdateAcceleration(); - int GetCurrentMaxSpeed() const; + int GetCurrentMaxSpeed() const override; /** * Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.