diff options
author | terkhen <terkhen@openttd.org> | 2010-11-06 13:03:17 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-11-06 13:03:17 +0000 |
commit | 25d1b2f54b9cac01e2737848c208f6d8096a4a92 (patch) | |
tree | 37860a84857248e929612d7ed018a4e2065d31cd /src/ship.h | |
parent | c8a56f17f82be7d4a8e935fc514c86a313dc7d15 (diff) | |
download | openttd-25d1b2f54b9cac01e2737848c208f6d8096a4a92.tar.xz |
(svn r21098) -Codechange: Ships now store their max speed in the cache instead of recalculating it every time.
Diffstat (limited to 'src/ship.h')
-rw-r--r-- | src/ship.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ship.h b/src/ship.h index 1c6749576..ca4cefa6d 100644 --- a/src/ship.h +++ b/src/ship.h @@ -35,7 +35,7 @@ struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> { bool IsPrimaryVehicle() const { return true; } SpriteID GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->cur_speed / 2; } - int GetDisplayMaxSpeed() const { return this->max_speed / 2; } + int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; } Money GetRunningCost() const; bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; } bool Tick(); @@ -43,6 +43,7 @@ struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> { Trackdir GetVehicleTrackdir() const; TileIndex GetOrderStationLocation(StationID station); bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); + void UpdateCache(); }; #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var) |