diff options
author | truebrain <truebrain@openttd.org> | 2012-01-02 13:44:37 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2012-01-02 13:44:37 +0000 |
commit | 091bc25a90bb68118f7dbd0e4d750de266cbf855 (patch) | |
tree | 77aaea1eca3aa6705991e37d915c3e0aa5e4ce44 /src/vehicle_base.h | |
parent | 0d929e877faf9572a80803db382ab973702e02c0 (diff) | |
download | openttd-091bc25a90bb68118f7dbd0e4d750de266cbf855.tar.xz |
(svn r23714) -Codechange: don't mix Viewport with non-viewport code
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 31b8332d4..852442e2e 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -986,19 +986,19 @@ struct SpecializedVehicle : public Vehicle { /** * Update vehicle sprite- and position caches - * @param moved Was the vehicle moved? - * @param turned Did the vehicle direction change? + * @param force_update Force updating the vehicle on the viewport. + * @param update_delta Also update the delta? */ - inline void UpdateViewport(bool moved, bool turned) + inline void UpdateViewport(bool force_update, bool update_delta) { - extern void VehicleUpdatePositionAndViewport(Vehicle *v); + extern void VehicleUpdateViewport(Vehicle *v, bool dirty); /* Explicitly choose method to call to prevent vtable dereference - * it gives ~3% runtime improvements in games with many vehicles */ - if (turned) ((T *)this)->T::UpdateDeltaXY(this->direction); + if (update_delta) ((T *)this)->T::UpdateDeltaXY(this->direction); SpriteID old_image = this->cur_image; this->cur_image = ((T *)this)->T::GetImage(this->direction, EIT_ON_MAP); - if (moved || this->cur_image != old_image) VehicleUpdatePositionAndViewport(this); + if (force_update || this->cur_image != old_image) VehicleUpdateViewport(this, true); } }; |