Codechange: Use override specifier for Train and RoadVehicle structs

This commit is contained in:
Henry Wilson 2022-11-04 19:12:51 +00:00 committed by Michael Lutz
parent 89cf0d5da8
commit b304c06a4a
2 changed files with 34 additions and 34 deletions

View File

@ -124,28 +124,28 @@ struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> {
friend struct GroundVehicle<RoadVehicle, VEH_ROAD>; // GroundVehicle needs to use the acceleration functions defined at RoadVehicle. friend struct GroundVehicle<RoadVehicle, VEH_ROAD>; // GroundVehicle needs to use the acceleration functions defined at RoadVehicle.
void MarkDirty(); void MarkDirty() override;
void UpdateDeltaXY(); void UpdateDeltaXY() override;
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_REVENUE : EXPENSES_ROADVEH_RUN; } ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_ROADVEH_REVENUE : EXPENSES_ROADVEH_RUN; }
bool IsPrimaryVehicle() const { return this->IsFrontEngine(); } bool IsPrimaryVehicle() const override { return this->IsFrontEngine(); }
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->gcache.last_speed / 2; } int GetDisplaySpeed() const override { return this->gcache.last_speed / 2; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; } int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed / 2; }
Money GetRunningCost() const; Money GetRunningCost() const override;
int GetDisplayImageWidth(Point *offset = nullptr) const; int GetDisplayImageWidth(Point *offset = nullptr) const;
bool IsInDepot() const { return this->state == RVSB_IN_DEPOT; } bool IsInDepot() const override { return this->state == RVSB_IN_DEPOT; }
bool Tick(); bool Tick() override;
void OnNewDay(); void OnNewDay() override;
uint Crash(bool flooded = false); uint Crash(bool flooded = false) override;
Trackdir GetVehicleTrackdir() const; Trackdir GetVehicleTrackdir() const override;
TileIndex GetOrderStationLocation(StationID station); TileIndex GetOrderStationLocation(StationID station) override;
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) override;
bool IsBus() const; bool IsBus() const;
int GetCurrentMaxSpeed() const; int GetCurrentMaxSpeed() const override;
int UpdateSpeed(); int UpdateSpeed();
void SetDestTile(TileIndex tile); void SetDestTile(TileIndex tile) override;
protected: // These functions should not be called outside acceleration code. protected: // These functions should not be called outside acceleration code.

View File

@ -107,23 +107,23 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
friend struct GroundVehicle<Train, VEH_TRAIN>; // GroundVehicle needs to use the acceleration functions defined at Train. friend struct GroundVehicle<Train, VEH_TRAIN>; // GroundVehicle needs to use the acceleration functions defined at Train.
void MarkDirty(); void MarkDirty() override;
void UpdateDeltaXY(); void UpdateDeltaXY() override;
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_REVENUE : EXPENSES_TRAIN_RUN; } ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_TRAIN_REVENUE : EXPENSES_TRAIN_RUN; }
void PlayLeaveStationSound() const; void PlayLeaveStationSound() const override;
bool IsPrimaryVehicle() const { return this->IsFrontEngine(); } bool IsPrimaryVehicle() const override { return this->IsFrontEngine(); }
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->gcache.last_speed; } int GetDisplaySpeed() const override { return this->gcache.last_speed; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; } int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; }
Money GetRunningCost() const; Money GetRunningCost() const override;
int GetDisplayImageWidth(Point *offset = nullptr) const; int GetDisplayImageWidth(Point *offset = nullptr) const;
bool IsInDepot() const { return this->track == TRACK_BIT_DEPOT; } bool IsInDepot() const override { return this->track == TRACK_BIT_DEPOT; }
bool Tick(); bool Tick() override;
void OnNewDay(); void OnNewDay() override;
uint Crash(bool flooded = false); uint Crash(bool flooded = false) override;
Trackdir GetVehicleTrackdir() const; Trackdir GetVehicleTrackdir() const override;
TileIndex GetOrderStationLocation(StationID station); TileIndex GetOrderStationLocation(StationID station) override;
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) override;
void ReserveTrackUnderConsist() const; void ReserveTrackUnderConsist() const;
@ -135,7 +135,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
void UpdateAcceleration(); 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. * Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.