summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-04-13 21:05:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-04-13 21:08:46 +0200
commitb4f0ae962bdd07c01f7193631b6fa502b53351be (patch)
treeedb7a1bc4d0caf8636c5f1a99f05db3c7dcfd432 /src/scenery.cpp
parentff2a12174c8bd8be75dadeb23c88b6f9a1f0e1da (diff)
split scenery-proto into its own file
Diffstat (limited to 'src/scenery.cpp')
-rw-r--r--src/scenery.cpp55
1 files changed, 1 insertions, 54 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp
index e0b62211..442b712c 100644
--- a/src/scenery.cpp
+++ b/src/scenery.cpp
@@ -1,70 +1,17 @@
#include "scenery.hpp"
+#include "scenery-proto.hpp"
#include "compat/assert.hpp"
#include "compat/exception.hpp"
-#include "compat/overloaded.hpp"
#include "tile-constants.hpp"
#include "anim-atlas.hpp"
#include "rotation.inl"
-#include "nanosecond.hpp"
#include "world.hpp"
#include "shaders/shader.hpp"
#include <mg/Functions.h>
namespace floormat {
-// ---------- generic_scenery_proto ----------
-bool generic_scenery_proto::operator==(const generic_scenery_proto& p) const = default;
-enum scenery_type generic_scenery_proto::scenery_type() { return scenery_type::generic; }
-
-// ---------- door_scenery_proto ----------
-
-bool door_scenery_proto::operator==(const door_scenery_proto& p) const = default;
-enum scenery_type door_scenery_proto::scenery_type() { return scenery_type::door; }
-
-// --- scenery_proto ---
-
-scenery_proto::scenery_proto() noexcept { type = object_type::scenery; }
-scenery_proto::~scenery_proto() noexcept = default;
-scenery_proto::operator bool() const { return atlas != nullptr; }
-
-scenery_proto& scenery_proto::operator=(const scenery_proto&) noexcept = default;
-scenery_proto::scenery_proto(const scenery_proto&) noexcept = default;
-scenery_proto& scenery_proto::operator=(scenery_proto&&) noexcept = default;
-scenery_proto::scenery_proto(scenery_proto&&) noexcept = default;
-
-enum scenery_type scenery_proto::scenery_type() const
-{
- return std::visit(overloaded {
- [](std::monostate) { return scenery_type::none; },
- []<typename T>(const T&) { return T::scenery_type(); },
- }, subtype
- );
-}
-
-bool scenery_proto::operator==(const object_proto& e0) const
-{
- if (type != e0.type)
- return false;
-
- if (!object_proto::operator==(e0))
- return false;
-
- const auto& sc = static_cast<const scenery_proto&>(e0);
-
- if (subtype.index() != sc.subtype.index())
- return false;
-
- return std::visit(
- [](const auto& a, const auto& b) -> bool {
- if constexpr(std::is_same_v<std::decay_t<decltype(a)>, std::decay_t<decltype(b)>>)
- return a == b;
- else
- fm_assert(false);
- },
- subtype, sc.subtype
- );
-}
// --- scenery ---