(svn r17121) -Fix [FS#3060]: Update vehicle position cache when the vehicle sprite changes.
This commit is contained in:
@@ -308,6 +308,21 @@ public:
|
||||
*/
|
||||
virtual void OnNewDay() {};
|
||||
|
||||
/**
|
||||
* Update vehicle sprite- and position caches
|
||||
* @param moved Was the vehicle moved?
|
||||
* @param turned Did the vehicle direction change?
|
||||
*/
|
||||
inline void UpdateViewport(bool moved, bool turned)
|
||||
{
|
||||
extern void VehicleMove(Vehicle *v, bool update_viewport);
|
||||
|
||||
if (turned) this->UpdateDeltaXY(this->direction);
|
||||
SpriteID old_image = this->cur_image;
|
||||
this->cur_image = this->GetImage(this->direction);
|
||||
if (moved || this->cur_image != old_image) VehicleMove(this, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Trackdir on which the vehicle is currently located.
|
||||
* Works for trains and ships.
|
||||
|
Reference in New Issue
Block a user