(svn r17725) -Codechange: Reduce usage of EngInfo and XxxVehInfo, esp. when a Engine * is already present.

This commit is contained in:
frosch
2009-10-06 19:17:07 +00:00
parent 95dfee1c60
commit f3aacb8fe3
12 changed files with 88 additions and 68 deletions

View File

@@ -123,7 +123,13 @@ struct RoadVehicle : public SpecializedVehicle<RoadVehicle, VEH_ROAD> {
SpriteID GetImage(Direction direction) const;
int GetDisplaySpeed() const { return this->cur_speed / 2; }
int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); }
Money GetRunningCost() const
{
const RoadVehicleInfo *rvi = RoadVehInfo(this->engine_type);
return rvi->running_cost * GetPriceByIndex(rvi->running_cost_class);
}
int GetDisplayImageWidth(Point *offset = NULL) const;
bool IsInDepot() const { return this->state == RVSB_IN_DEPOT; }
bool IsStoppedInDepot() const;