summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/chunk.cpp3
-rw-r--r--src/hole.cpp7
-rw-r--r--src/hole.hpp7
-rw-r--r--src/object-type.hpp2
-rw-r--r--src/object.hpp1
5 files changed, 19 insertions, 1 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp
index c358af41..3ef8902b 100644
--- a/src/chunk.cpp
+++ b/src/chunk.cpp
@@ -129,6 +129,7 @@ chunk& chunk::operator=(chunk&&) noexcept = default;
void chunk::add_object_unsorted(const std::shared_ptr<object>& e)
{
+ fm_assert(!e->gone);
_objects_sorted = false;
if (!e->is_dynamic())
mark_scenery_modified();
@@ -152,6 +153,7 @@ void chunk::sort_objects()
void chunk::add_object(const std::shared_ptr<object>& e)
{
fm_assert(_objects_sorted);
+ fm_assert(!e->gone);
if (!e->is_dynamic())
mark_scenery_modified();
if (bbox bb; _bbox_for_scenery(*e, bb))
@@ -173,6 +175,7 @@ void chunk::remove_object(size_t i)
auto& es = _objects;
fm_debug_assert(i < es.size());
auto* e = es[i].get();
+ fm_assert(!e->gone);
if (!e->is_dynamic())
mark_scenery_modified();
if (bbox bb; _bbox_for_scenery(*e, bb))
diff --git a/src/hole.cpp b/src/hole.cpp
new file mode 100644
index 00000000..f9e6f05c
--- /dev/null
+++ b/src/hole.cpp
@@ -0,0 +1,7 @@
+#include "hole.hpp"
+
+namespace floormat {
+
+
+
+} // namespace floormat
diff --git a/src/hole.hpp b/src/hole.hpp
new file mode 100644
index 00000000..d97c72f9
--- /dev/null
+++ b/src/hole.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace floormat {
+
+
+
+} // namespace floormat
diff --git a/src/object-type.hpp b/src/object-type.hpp
index 35b25ccf..6ff4e3a0 100644
--- a/src/object-type.hpp
+++ b/src/object-type.hpp
@@ -3,7 +3,7 @@
namespace floormat {
enum class object_type : unsigned char {
- none, critter, scenery, light, COUNT,
+ none, critter, scenery, light, hole, COUNT,
};
template<typename T> struct object_type_;
diff --git a/src/object.hpp b/src/object.hpp
index e121a927..9ee9f1d1 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -49,6 +49,7 @@ struct object
class chunk* const c;
const std::shared_ptr<anim_atlas> atlas;
const global_coords coord;
+ const std::weak_ptr<object> parent;
const Vector2b offset, bbox_offset;
const Vector2ub bbox_size;
uint32_t delta = 0;