From ccbf628602e1093bd4d29312113b7dc18ec918b0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 28 May 2024 04:48:05 +0200 Subject: also fix broken protos for {critter,light}_proto --- src/light.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/light.cpp') diff --git a/src/light.cpp b/src/light.cpp index e6de08a6..647368ec 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -21,7 +21,21 @@ light_proto& light_proto::operator=(const light_proto&) = default; light_proto::light_proto(light_proto&&) noexcept = default; light_proto& light_proto::operator=(light_proto&&) noexcept = default; -bool light_proto::operator==(const light_proto&) const = default; +bool light_proto::operator==(const object_proto& oʹ) const +{ + if (type != oʹ.type) + return false; + + if (!object_proto::operator==(oʹ)) + return false; + + const auto& o = static_cast(oʹ); + + return Math::abs(max_distance - o.max_distance) < 1e-8f && + color == o.color && + falloff == o.falloff && + enabled == o.enabled; +} light::light(object_id id, class chunk& c, const light_proto& proto) : object{id, c, proto}, -- cgit v1.2.3