From 6b6f886bcded0505b4286e3bd1e08f71f456b63b Mon Sep 17 00:00:00 2001 From: fluxionary <25628292+fluxionary@users.noreply.github.com> Date: Thu, 13 Oct 2022 05:46:48 -0700 Subject: [PATCH] object ids are u16, not s16 (#12848) --- src/util/pointedthing.cpp | 6 +++--- src/util/pointedthing.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/pointedthing.cpp b/src/util/pointedthing.cpp index b906264d0..6aa37dfe8 100644 --- a/src/util/pointedthing.cpp +++ b/src/util/pointedthing.cpp @@ -36,7 +36,7 @@ PointedThing::PointedThing(const v3s16 &under, const v3s16 &above, distanceSq(distSq) {} -PointedThing::PointedThing(s16 id, const v3f &point, const v3s16 &normal, +PointedThing::PointedThing(u16 id, const v3f &point, const v3s16 &normal, f32 distSq) : type(POINTEDTHING_OBJECT), object_id(id), @@ -81,7 +81,7 @@ void PointedThing::serialize(std::ostream &os) const writeV3S16(os, node_abovesurface); break; case POINTEDTHING_OBJECT: - writeS16(os, object_id); + writeU16(os, object_id); break; } } @@ -100,7 +100,7 @@ void PointedThing::deSerialize(std::istream &is) node_abovesurface = readV3S16(is); break; case POINTEDTHING_OBJECT: - object_id = readS16(is); + object_id = readU16(is); break; default: throw SerializationError("unsupported PointedThingType"); diff --git a/src/util/pointedthing.h b/src/util/pointedthing.h index 5b30ed031..68b183195 100644 --- a/src/util/pointedthing.h +++ b/src/util/pointedthing.h @@ -61,7 +61,7 @@ struct PointedThing * Only valid if type is POINTEDTHING_OBJECT. * The ID of the object the ray hit. */ - s16 object_id = -1; + u16 object_id = 0; /*! * Only valid if type isn't POINTEDTHING_NONE. * First intersection point of the ray and the nodebox in irrlicht @@ -93,7 +93,7 @@ struct PointedThing const v3s16 &real_under, const v3f &point, const v3s16 &normal, u16 box_id, f32 distSq); //! Constructor for POINTEDTHING_OBJECT - PointedThing(s16 id, const v3f &point, const v3s16 &normal, f32 distSq); + PointedThing(u16 id, const v3f &point, const v3s16 &normal, f32 distSq); std::string dump() const; void serialize(std::ostream &os) const; void deSerialize(std::istream &is);