summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-04-13 17:42:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-04-13 17:42:30 +0200
commit2260ab972100f1d6679690b730b6f0aa7409b014 (patch)
tree18386a59968c1e7933db702281fc13fe62ff9b1e /src/scenery.cpp
parentcb13eb86db3593e723ce06c48a5cb2c94505d6ae (diff)
instantiate scenery in a uniform manner
Now using world::make_scenery(). Add `std::monostate` to the `scenery_proto` variant to catch potential bugs.
Diffstat (limited to 'src/scenery.cpp')
-rw-r--r--src/scenery.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp
index 4d47da5a..26213757 100644
--- a/src/scenery.cpp
+++ b/src/scenery.cpp
@@ -1,6 +1,7 @@
#include "scenery.hpp"
#include "compat/assert.hpp"
#include "compat/exception.hpp"
+#include "compat/overloaded.hpp"
#include "tile-constants.hpp"
#include "anim-atlas.hpp"
#include "rotation.inl"
@@ -32,9 +33,10 @@ scenery_proto::operator bool() const { return atlas != nullptr; }
enum scenery_type scenery_proto::scenery_type() const
{
- return std::visit(
+ return std::visit(overloaded {
+ [](std::monostate) { return scenery_type::none; },
[]<typename T>(const T&) { return T::scenery_type(); },
- subtype
+ }, subtype
);
}