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.
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.

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.
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<Train, VEH_TRAIN> {
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.