Fix 1a38cbde7
: Ship viewport hash not updated on rotation
This commit is contained in:
@@ -351,15 +351,21 @@ void Ship::UpdateDeltaXY()
|
|||||||
this->x_offs -= this->x_pos - this->rotation_x_pos;
|
this->x_offs -= this->x_pos - this->rotation_x_pos;
|
||||||
this->y_offs -= this->y_pos - this->rotation_y_pos;
|
this->y_offs -= this->y_pos - this->rotation_y_pos;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this->rotation != this->cur_image_valid_dir) {
|
bool RecentreShipSpriteBounds(Vehicle *v)
|
||||||
this->cur_image_valid_dir = INVALID_DIR;
|
{
|
||||||
Point offset = RemapCoords(this->x_offs, this->y_offs, 0);
|
Ship *ship = Ship::From(v);
|
||||||
this->sprite_seq_bounds.left = -offset.x - 16;
|
if (ship->rotation != ship->cur_image_valid_dir) {
|
||||||
this->sprite_seq_bounds.right = this->sprite_seq_bounds.left + 32;
|
ship->cur_image_valid_dir = INVALID_DIR;
|
||||||
this->sprite_seq_bounds.top = -offset.y - 16;
|
Point offset = RemapCoords(ship->x_offs, ship->y_offs, 0);
|
||||||
this->sprite_seq_bounds.bottom = this->sprite_seq_bounds.top + 32;
|
ship->sprite_seq_bounds.left = -offset.x - 16;
|
||||||
|
ship->sprite_seq_bounds.right = ship->sprite_seq_bounds.left + 32;
|
||||||
|
ship->sprite_seq_bounds.top = -offset.y - 16;
|
||||||
|
ship->sprite_seq_bounds.bottom = ship->sprite_seq_bounds.top + 32;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ship::GetEffectiveMaxSpeed() const
|
int Ship::GetEffectiveMaxSpeed() const
|
||||||
|
@@ -1450,10 +1450,19 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool always_update_viewport = false;
|
||||||
|
|
||||||
|
if (EXPECTED_TYPE == VEH_SHIP && update_delta) {
|
||||||
|
extern bool RecentreShipSpriteBounds(Vehicle *v);
|
||||||
|
always_update_viewport = RecentreShipSpriteBounds(this);
|
||||||
|
}
|
||||||
|
|
||||||
SetBit(this->vcache.cached_veh_flags, VCF_IMAGE_REFRESH);
|
SetBit(this->vcache.cached_veh_flags, VCF_IMAGE_REFRESH);
|
||||||
|
|
||||||
if (force_update) {
|
if (force_update) {
|
||||||
this->Vehicle::UpdateViewport(IsPointInViewportVehicleRedrawArea(_viewport_vehicle_map_redraw_rects, pt));
|
this->Vehicle::UpdateViewport(IsPointInViewportVehicleRedrawArea(_viewport_vehicle_map_redraw_rects, pt));
|
||||||
|
} else if (always_update_viewport) {
|
||||||
|
this->Vehicle::UpdateViewport(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user