diff options
author | frosch <frosch@openttd.org> | 2009-10-06 19:17:07 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-10-06 19:17:07 +0000 |
commit | f3aacb8fe3e96efd90b0ab93dbf8fb33a8842434 (patch) | |
tree | 373048e110915c31097d4e056da5f54833620492 /src/roadveh.h | |
parent | 95dfee1c604d420df9f0d5860fcddf29e657fc32 (diff) | |
download | openttd-f3aacb8fe3e96efd90b0ab93dbf8fb33a8842434.tar.xz |
(svn r17725) -Codechange: Reduce usage of EngInfo and XxxVehInfo, esp. when a Engine * is already present.
Diffstat (limited to 'src/roadveh.h')
-rw-r--r-- | src/roadveh.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/roadveh.h b/src/roadveh.h index e7b05d988..44062a3eb 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -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; |