summaryrefslogtreecommitdiffhomepage
path: root/src/light.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-28 04:48:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-28 04:58:10 +0200
commitccbf628602e1093bd4d29312113b7dc18ec918b0 (patch)
treebeb3507d4831a5b50b43ccbc73c416ae360cd10a /src/light.cpp
parent6f4e493d7cbe514527e2b2d942040609ef930da9 (diff)
also fix broken protos for {critter,light}_proto
Diffstat (limited to 'src/light.cpp')
-rw-r--r--src/light.cpp16
1 files changed, 15 insertions, 1 deletions
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<const light_proto&>(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},