summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/vobj-editor.cpp37
-rw-r--r--editor/vobj-editor.hpp4
2 files changed, 23 insertions, 18 deletions
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp
index ea9b8659..bfe88d71 100644
--- a/editor/vobj-editor.cpp
+++ b/editor/vobj-editor.cpp
@@ -1,7 +1,8 @@
#include "vobj-editor.hpp"
-#include "loader/loader.hpp"
#include "src/world.hpp"
#include "src/light.hpp"
+#include "loader/loader.hpp"
+#include "loader/vobj-cell.hpp"
#include "app.hpp"
#include <array>
#include <utility>
@@ -68,23 +69,27 @@ start: while (auto id = a.get_object_colliding_with_cursor())
struct light_factory final : vobj_factory
{
- object_type type() const override { return object_type::light; }
+ object_type type() const override;
+ const vobj_cell& info() const override;
+ std::shared_ptr<object> make(world& w, object_id id, global_coords pos) const override;
+};
- const vobj_info& info() const override
- {
- constexpr auto NAME = "light"_s;
- static const vobj_info& ret = loader.vobj(NAME);
- fm_debug_assert(ret.name == NAME);
- fm_debug_assert(ret.atlas != nullptr);
- return ret;
- }
+object_type light_factory::type() const { return object_type::light; }
- std::shared_ptr<object> make(world& w, object_id id, global_coords pos) const override
- {
- auto ret = w.make_object<light>(id, pos, light_proto{});
- return ret;
- }
-};
+const vobj_cell& light_factory::info() const
+{
+ constexpr auto NAME = "light"_s;
+ static const vobj_cell& ret = loader.vobj(NAME);
+ fm_debug_assert(ret.name == NAME);
+ fm_debug_assert(ret.atlas != nullptr);
+ return ret;
+}
+
+std::shared_ptr<object> light_factory::make(world& w, object_id id, global_coords pos) const
+{
+ auto ret = w.make_object<light>(id, pos, light_proto{});
+ return ret;
+}
auto vobj_editor::make_vobj_type_map() -> std::map<StringView, vobj_>
{
diff --git a/editor/vobj-editor.hpp b/editor/vobj-editor.hpp
index 962212c7..7bcc32b6 100644
--- a/editor/vobj-editor.hpp
+++ b/editor/vobj-editor.hpp
@@ -11,14 +11,14 @@ class world;
struct global_coords;
struct object;
class anim_atlas;
-struct vobj_info;
+struct vobj_cell;
struct app;
struct vobj_factory
{
vobj_factory();
virtual ~vobj_factory() noexcept;
- virtual const vobj_info& info() const = 0;
+ virtual const vobj_cell& info() const = 0;
virtual object_type type() const = 0;
virtual std::shared_ptr<object> make(world& w, object_id id, global_coords pos) const = 0;