diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-04-13 12:26:26 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-04-13 12:26:26 +0200 |
commit | cb13eb86db3593e723ce06c48a5cb2c94505d6ae (patch) | |
tree | 9b56825b1debc908dc999feace69645eb56eb2f8 /editor/scenery-editor.cpp | |
parent | 2c042d30d96827941e5052d4eca0cc03965cacc8 (diff) |
use inheritance for scenery, not std::variant
It's still WIP because creating scenery has to branch on all subtypes.
This needs to be taken care of generically in `world::make_object()`.
Diffstat (limited to 'editor/scenery-editor.cpp')
-rw-r--r-- | editor/scenery-editor.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp index 7a99bbb0..28d94263 100644 --- a/editor/scenery-editor.cpp +++ b/editor/scenery-editor.cpp @@ -102,8 +102,26 @@ start: } } else + { + const auto sc_type = s.proto.scenery_type(); // todo check collision at pos - w.make_object<scenery>(w.make_id(), pos, s.proto); + switch (sc_type) + { + case scenery_type::none: + case scenery_type::COUNT: + break; + case scenery_type::generic: + w.make_object<generic_scenery>(w.make_id(), pos, std::get<generic_scenery_proto>(s.proto.subtype), s.proto); + goto ok; + case scenery_type::door: + w.make_object<door_scenery>(w.make_id(), pos, std::get<door_scenery_proto>(s.proto.subtype), s.proto); + goto ok; + } + fm_abort("place_tile: wrong scenery type %d", (int)sc_type); +ok: + void(); + } + } } // namespace floormat |