diff --git a/all-is-cubes-base/src/math/rotation.rs b/all-is-cubes-base/src/math/rotation.rs index 17bfe4670..2fe4fa28e 100644 --- a/all-is-cubes-base/src/math/rotation.rs +++ b/all-is-cubes-base/src/math/rotation.rs @@ -374,6 +374,7 @@ impl GridRotation { /// /// May panic or wrap if `vector` has any components equal to [`GridCoordinate::MIN`]. #[inline] + #[track_caller] pub fn transform_vector(self, vector: GridVector) -> GridVector { #[inline(always)] fn inner(rotation: GridRotation, vector: GridVector) -> Option { diff --git a/all-is-cubes/src/inv/inv_in_block.rs b/all-is-cubes/src/inv/inv_in_block.rs index 6ae021f8e..8b61361ea 100644 --- a/all-is-cubes/src/inv/inv_in_block.rs +++ b/all-is-cubes/src/inv/inv_in_block.rs @@ -1,7 +1,8 @@ //! Configuration of inventories owned by blocks ([`Modifier::Inventory`]). use alloc::vec::Vec; -use euclid::Point3D; + +use euclid::{Point3D, Vector3D}; use crate::block::Resolution; use crate::math::{GridCoordinate, GridPoint, GridRotation, GridVector, Gridgid}; @@ -192,7 +193,10 @@ impl IconRow { first_slot: self.first_slot, count: self.count, origin: transform.transform_point(self.origin), // TODO: does not account for size of icon - stride: transform.rotation.transform_vector(self.stride), + stride: transform.rotation.transform_vector( + // Kludge: clamped to avoid numeric overflow of `i32::MIN` + self.stride.max(Vector3D::splat(-i32::MAX)), + ), } } }