diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-04-13 17:42:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-04-13 17:42:30 +0200 |
commit | 2260ab972100f1d6679690b730b6f0aa7409b014 (patch) | |
tree | 18386a59968c1e7933db702281fc13fe62ff9b1e /src/scenery.cpp | |
parent | cb13eb86db3593e723ce06c48a5cb2c94505d6ae (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.cpp | 6 |
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 ); } |