summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/app.cpp5
-rw-r--r--editor/app.hpp3
-rw-r--r--editor/camera.cpp1
-rw-r--r--editor/draw.cpp1
-rw-r--r--editor/ground-editor.cpp17
-rw-r--r--editor/ground-editor.hpp14
-rw-r--r--editor/imgui-editors.cpp9
-rw-r--r--editor/imgui.cpp1
-rw-r--r--editor/inspect-types.cpp2
-rw-r--r--editor/scenery-editor.cpp3
-rw-r--r--editor/scenery-editor.hpp3
-rw-r--r--editor/tests/hole-test.cpp1
-rw-r--r--editor/tests/path-test.cpp5
-rw-r--r--editor/tests/raycast-test.cpp4
-rw-r--r--editor/tests/region-test.cpp3
-rw-r--r--editor/tests/walk-test.cpp6
-rw-r--r--editor/vobj-editor.cpp10
-rw-r--r--editor/vobj-editor.hpp5
-rw-r--r--editor/wall-editor.cpp8
-rw-r--r--editor/wall-editor.hpp11
20 files changed, 58 insertions, 54 deletions
diff --git a/editor/app.cpp b/editor/app.cpp
index 36d4ad1b..b5d6b7a1 100644
--- a/editor/app.cpp
+++ b/editor/app.cpp
@@ -1,7 +1,7 @@
#include "app.hpp"
#include "compat/assert.hpp"
#include "compat/sysexits.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
+#include "compat/borrowed-ptr.inl"
#include "editor.hpp"
#include "src/anim-atlas.hpp"
#include "src/critter.hpp"
@@ -27,10 +27,11 @@ Optional<struct point> cursor_state::point() const
floormat_main& app::main() { return *M; }
const cursor_state& app::cursor_state() { return cursor; }
-shared_ptr_wrapper<critter> app::ensure_player_character(world& w)
+bptr<critter> app::ensure_player_character(world& w)
{
return w.ensure_player_character(_character_id);
}
+
void app::reset_world()
{
if (M)
diff --git a/editor/app.hpp b/editor/app.hpp
index aecd495b..b04da7dc 100644
--- a/editor/app.hpp
+++ b/editor/app.hpp
@@ -2,6 +2,7 @@
#include "compat/defs.hpp"
#include "compat/enum-bitset-fwd.hpp"
#include "compat/safe-ptr.hpp"
+#include "compat/borrowed-ptr-fwd.hpp"
#include "floormat/app.hpp"
#include "keys.hpp"
#include "src/global-coords.hpp"
@@ -82,7 +83,7 @@ struct app final : floormat_app
const struct cursor_state& cursor_state();
clickable* find_clickable_scenery(const Optional<Vector2i>& pixel);
Vector2 point_screen_pos(point pt);
- shared_ptr_wrapper<critter> ensure_player_character(world& w);
+ bptr<critter> ensure_player_character(world& w);
private:
explicit app(fm_settings&& opts);
diff --git a/editor/camera.cpp b/editor/camera.cpp
index 14618d5b..5fe28bc7 100644
--- a/editor/camera.cpp
+++ b/editor/camera.cpp
@@ -10,6 +10,7 @@
#include "src/camera-offset.hpp"
#include "src/timer.hpp"
#include "compat/enum-bitset.hpp"
+#include "compat/borrowed-ptr.inl"
#include <bit>
#include <Magnum/Math/Functions.h>
diff --git a/editor/draw.cpp b/editor/draw.cpp
index f5a906d2..d781c5a9 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -1,4 +1,5 @@
#include "app.hpp"
+#include "compat/borrowed-ptr.inl"
#include "src/tile-constants.hpp"
#include "floormat/main.hpp"
#include "floormat/draw-bounds.hpp"
diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp
index 49f636ce..f6b3c438 100644
--- a/editor/ground-editor.cpp
+++ b/editor/ground-editor.cpp
@@ -7,7 +7,6 @@
#include "keys.hpp"
#include "loader/loader.hpp"
#include "loader/ground-cell.hpp"
-#include <memory>
#include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Utility/Path.h>
@@ -18,7 +17,7 @@ typename std::map<StringView, ground_cell>::const_iterator ground_editor::end()
struct ground_editor::tuple
{
- std::shared_ptr<ground_atlas> atlas;
+ bptr<ground_atlas> atlas;
Array<variant_t> variant;
};
@@ -43,7 +42,7 @@ void ground_editor::load_atlases()
fm_assert(!_atlases.empty());
}
-std::shared_ptr<ground_atlas> ground_editor::maybe_atlas(StringView str)
+bptr<ground_atlas> ground_editor::maybe_atlas(StringView str)
{
if (auto it = _atlases.find(str); it != _atlases.end())
return it->second.atlas;
@@ -51,7 +50,7 @@ std::shared_ptr<ground_atlas> ground_editor::maybe_atlas(StringView str)
return nullptr;
}
-std::shared_ptr<ground_atlas> ground_editor::atlas(StringView str)
+bptr<ground_atlas> ground_editor::atlas(StringView str)
{
if (auto ptr = maybe_atlas(str))
return ptr;
@@ -68,7 +67,7 @@ void ground_editor::clear_selection()
_selection_mode = sel_none;
}
-void ground_editor::select_tile(const std::shared_ptr<ground_atlas>& atlas, size_t variant)
+void ground_editor::select_tile(const bptr<ground_atlas>& atlas, size_t variant)
{
fm_assert(atlas);
clear_selection();
@@ -76,7 +75,7 @@ void ground_editor::select_tile(const std::shared_ptr<ground_atlas>& atlas, size
_selected_tile = { atlas, variant_t(variant % atlas->num_tiles()) };
}
-void ground_editor::select_tile_permutation(const std::shared_ptr<ground_atlas>& atlas)
+void ground_editor::select_tile_permutation(const bptr<ground_atlas>& atlas)
{
fm_assert(atlas);
clear_selection();
@@ -84,19 +83,19 @@ void ground_editor::select_tile_permutation(const std::shared_ptr<ground_atlas>&
*_permutation = { atlas, {} };
}
-bool ground_editor::is_tile_selected(const std::shared_ptr<const ground_atlas>& atlas, size_t variant) const
+bool ground_editor::is_tile_selected(const bptr<const ground_atlas>& atlas, size_t variant) const
{
return atlas && _selection_mode == sel_tile && _selected_tile &&
atlas == _selected_tile.atlas && variant == _selected_tile.variant;
}
-bool ground_editor::is_permutation_selected(const std::shared_ptr<const ground_atlas>& atlas) const
+bool ground_editor::is_permutation_selected(const bptr<const ground_atlas>& atlas) const
{
const auto& [perm, _] = *_permutation;
return atlas && _selection_mode == sel_perm && perm == atlas;
}
-bool ground_editor::is_atlas_selected(const std::shared_ptr<const ground_atlas>& atlas) const
+bool ground_editor::is_atlas_selected(const bptr<const ground_atlas>& atlas) const
{
switch (_selection_mode)
{
diff --git a/editor/ground-editor.hpp b/editor/ground-editor.hpp
index 9745d14b..b27065f0 100644
--- a/editor/ground-editor.hpp
+++ b/editor/ground-editor.hpp
@@ -28,18 +28,18 @@ class ground_editor final
public:
ground_editor();
~ground_editor() noexcept;
- std::shared_ptr<ground_atlas> maybe_atlas(StringView str);
- std::shared_ptr<ground_atlas> atlas(StringView str);
+ bptr<ground_atlas> maybe_atlas(StringView str);
+ bptr<ground_atlas> atlas(StringView str);
typename std::map<StringView, ground_cell>::const_iterator begin() const noexcept;
typename std::map<StringView, ground_cell>::const_iterator end() const noexcept;
StringView name() const noexcept;
void clear_selection();
- void select_tile(const std::shared_ptr<ground_atlas>& atlas, size_t variant);
- void select_tile_permutation(const std::shared_ptr<ground_atlas>& atlas);
- bool is_tile_selected(const std::shared_ptr<const ground_atlas>& atlas, size_t variant) const;
- bool is_permutation_selected(const std::shared_ptr<const ground_atlas>& atlas) const;
- bool is_atlas_selected(const std::shared_ptr<const ground_atlas>& atlas) const;
+ void select_tile(const bptr<ground_atlas>& atlas, size_t variant);
+ void select_tile_permutation(const bptr<ground_atlas>& atlas);
+ bool is_tile_selected(const bptr<const ground_atlas>& atlas, size_t variant) const;
+ bool is_permutation_selected(const bptr<const ground_atlas>& atlas) const;
+ bool is_atlas_selected(const bptr<const ground_atlas>& atlas) const;
bool is_anything_selected() const;
tile_image_proto get_selected();
void place_tile(world& world, global_coords pos, const tile_image_proto& img);
diff --git a/editor/imgui-editors.cpp b/editor/imgui-editors.cpp
index b447984d..a36e7c00 100644
--- a/editor/imgui-editors.cpp
+++ b/editor/imgui-editors.cpp
@@ -2,6 +2,7 @@
#include "src/tile-constants.hpp"
#include "compat/array-size.hpp"
#include "compat/format.hpp"
+#include "compat/borrowed-ptr.inl"
#include "imgui-raii.hpp"
#include "ground-editor.hpp"
#include "wall-editor.hpp"
@@ -44,9 +45,9 @@ StringView scenery_path(const wall_cell& wa) { return wa.atlas->name(); }
StringView scenery_name(StringView, const scenery_& sc) { return sc.name; }
StringView scenery_name(StringView, const vobj_& vobj) { return vobj.descr; }
StringView scenery_name(StringView, const wall_cell& w) { return w.name; }
-std::shared_ptr<anim_atlas> get_atlas(const scenery_& sc) { return sc.proto.atlas; }
-std::shared_ptr<anim_atlas> get_atlas(const vobj_& vobj) { return vobj.factory->atlas(); }
-std::shared_ptr<wall_atlas> get_atlas(const wall_cell& w) { return w.atlas; }
+bptr<anim_atlas> get_atlas(const scenery_& sc) { return sc.proto.atlas; }
+bptr<anim_atlas> get_atlas(const vobj_& vobj) { return vobj.factory->atlas(); }
+bptr<wall_atlas> get_atlas(const wall_cell& w) { return w.atlas; }
Vector2ui get_size(const auto&, anim_atlas& atlas) { return atlas.frame(atlas.first_rotation(), 0).size; }
Vector2ui get_size(const auto&, wall_atlas& atlas) { auto sz = atlas.image_size(); return { std::max(1u, std::min(sz.y()*3/2, sz.x())), sz.y() }; }
bool is_selected(const scenery_editor& ed, const scenery_& sc) { return ed.is_item_selected(sc); }
@@ -58,7 +59,7 @@ void select_tile(wall_editor& wa, const wall_cell& sc) { wa.select_atlas(sc.atla
auto get_texcoords(const auto&, anim_atlas& atlas) { return atlas.texcoords_for_frame(atlas.first_rotation(), 0, !atlas.group(atlas.first_rotation()).mirror_from.isEmpty()); }
auto get_texcoords(const wall_cell& w, wall_atlas& atlas) { auto sz = get_size(w, atlas); return Quads::texcoords_at({}, sz, atlas.image_size()); }
-void draw_editor_tile_pane_atlas(ground_editor& ed, StringView name, const std::shared_ptr<ground_atlas>& atlas, Vector2 dpi)
+void draw_editor_tile_pane_atlas(ground_editor& ed, StringView name, const bptr<ground_atlas>& atlas, Vector2 dpi)
{
const auto b = push_id("tile-pane");
diff --git a/editor/imgui.cpp b/editor/imgui.cpp
index 2923c3ea..5e5acf90 100644
--- a/editor/imgui.cpp
+++ b/editor/imgui.cpp
@@ -1,6 +1,7 @@
#include "app.hpp"
#include "src/tile-constants.hpp"
#include "compat/format.hpp"
+#include "compat/borrowed-ptr.inl"
#include "editor.hpp"
#include "ground-editor.hpp"
#include "wall-editor.hpp"
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp
index fba0fc7b..da5a8c9f 100644
--- a/editor/inspect-types.cpp
+++ b/editor/inspect-types.cpp
@@ -184,7 +184,7 @@ template<> struct entity_accessors<hole, inspect_intent_t>
template<typename, typename = void> struct has_anim_atlas : std::false_type {};
template<typename T>
-requires requires (const T& x) { { x.atlas } -> std::convertible_to<const std::shared_ptr<anim_atlas>&>; }
+requires requires (const T& x) { { x.atlas } -> std::convertible_to<const bptr<anim_atlas>&>; }
struct has_anim_atlas<T> : std::true_type {
static const anim_atlas& get_atlas(const object& x) { return *x.atlas; }
};
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp
index 2c205e3e..0ba04028 100644
--- a/editor/scenery-editor.cpp
+++ b/editor/scenery-editor.cpp
@@ -6,6 +6,7 @@
#include "src/rotation.inl"
#include "app.hpp"
#include "src/scenery.hpp"
+#include "compat/borrowed-ptr.inl"
#include <Magnum/Math/Range.h>
@@ -68,7 +69,7 @@ auto scenery_editor::get_selected() const -> const scenery_&
return _selected;
}
-bool scenery_editor::is_atlas_selected(const std::shared_ptr<anim_atlas>& atlas) const
+bool scenery_editor::is_atlas_selected(const bptr<anim_atlas>& atlas) const
{
return atlas == _selected.proto.atlas;
}
diff --git a/editor/scenery-editor.hpp b/editor/scenery-editor.hpp
index 678b990f..6f15bf76 100644
--- a/editor/scenery-editor.hpp
+++ b/editor/scenery-editor.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "src/scenery-proto.hpp"
#include <map>
-#include <memory>
#include <Corrade/Containers/String.h>
namespace floormat {
@@ -30,7 +29,7 @@ public:
void select_tile(const scenery_& s);
void clear_selection();
const scenery_& get_selected() const;
- bool is_atlas_selected(const std::shared_ptr<anim_atlas>& atlas) const;
+ bool is_atlas_selected(const bptr<anim_atlas>& atlas) const;
bool is_item_selected(const scenery_& s) const;
bool is_anything_selected() const;
static void place_tile(world& w, global_coords pos, const scenery_& s, app& a);
diff --git a/editor/tests/hole-test.cpp b/editor/tests/hole-test.cpp
index 7b6041b2..b419f7e8 100644
--- a/editor/tests/hole-test.cpp
+++ b/editor/tests/hole-test.cpp
@@ -1,5 +1,4 @@
#include "../tests-private.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
#include "src/tile-constants.hpp"
#include "src/chunk-region.hpp"
#include "src/hole.hpp"
diff --git a/editor/tests/path-test.cpp b/editor/tests/path-test.cpp
index 63b59dd4..4b82af68 100644
--- a/editor/tests/path-test.cpp
+++ b/editor/tests/path-test.cpp
@@ -1,14 +1,15 @@
#include "../tests-private.hpp"
#include "../app.hpp"
#include "compat/array-size.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
#include "compat/vector-wrapper.hpp"
+#include "compat/borrowed-ptr.inl"
#include "floormat/main.hpp"
#include "src/search-astar.hpp"
#include "src/search-result.hpp"
#include "src/critter.hpp"
#include "shaders/shader.hpp"
#include "../imgui-raii.hpp"
+#include <cstdio>
#include <cr/Optional.h>
#include <mg/Functions.h>
#include <mg/Color.h>
@@ -59,7 +60,7 @@ bool path_test::handle_mouse_click(app& a, const mouse_button_event& e, bool is_
case mouse_button_left: {
auto& M = a.main();
auto& w = M.world();
- auto C = a.ensure_player_character(w).ptr;
+ auto C = a.ensure_player_character(w);
if (auto pt = a.cursor_state().point())
{
constexpr auto chunk_size = iTILE_SIZE2 * TILE_MAX_DIM;
diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp
index 6596303f..07b44eaf 100644
--- a/editor/tests/raycast-test.cpp
+++ b/editor/tests/raycast-test.cpp
@@ -2,12 +2,12 @@
#include "editor/app.hpp"
#include "floormat/main.hpp"
#include "compat/array-size.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
#include "../imgui-raii.hpp"
#include "src/critter.hpp"
#include "src/world.hpp"
#include "src/raycast-diag.hpp"
#include <cinttypes>
+#include <cstdio>
#include <array>
#include <vector>
#include <mg/Color.h>
@@ -73,7 +73,7 @@ struct raycast_test final : base_test
auto& w = M.world();
if (auto pt_ = a.cursor_state().point())
{
- auto C = a.ensure_player_character(w).ptr;
+ auto C = a.ensure_player_character(w);
auto pt0 = C->position();
pending = { .from = pt0, .to = *pt_, .self = C->id, .exists = true, };
return true;
diff --git a/editor/tests/region-test.cpp b/editor/tests/region-test.cpp
index 1206b1eb..0c51bf8a 100644
--- a/editor/tests/region-test.cpp
+++ b/editor/tests/region-test.cpp
@@ -1,5 +1,4 @@
#include "../tests-private.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
#include "src/tile-constants.hpp"
#include "src/chunk-region.hpp"
#include "src/object.hpp"
@@ -153,7 +152,7 @@ void region_test::do_region_extraction(app& a, chunk_coords_ coord)
{
auto& M = a.main();
auto& w = M.world();
- auto C = a.ensure_player_character(w).ptr;
+ auto C = a.ensure_player_character(w);
if (auto* c = w.at(coord))
{
auto C_coord = Vector2i{ Vector2i(C->coord.local()) * iTILE_SIZE2 + Vector2i(C->offset) };
diff --git a/editor/tests/walk-test.cpp b/editor/tests/walk-test.cpp
index a317928f..f04fc869 100644
--- a/editor/tests/walk-test.cpp
+++ b/editor/tests/walk-test.cpp
@@ -1,5 +1,4 @@
#include "../tests-private.hpp"
-#include "compat/shared-ptr-wrapper.hpp"
#include "editor/app.hpp"
#include "src/critter.hpp"
#include "src/critter-script.hpp"
@@ -8,6 +7,7 @@
#include "floormat/main.hpp"
#include "../imgui-raii.hpp"
#include "src/search-astar.hpp"
+#include "compat/borrowed-ptr.inl"
#include <mg/Functions.h>
namespace floormat::tests {
@@ -43,7 +43,7 @@ bool pf_test::handle_mouse_click(app& a, const mouse_button_event& e, bool is_do
{
if (auto ptʹ = a.cursor_state().point())
{
- auto C = a.ensure_player_character(m.world()).ptr;
+ auto C = a.ensure_player_character(m.world());
fm_assert(C->is_dynamic());
constexpr auto chunk_size = iTILE_SIZE2 * TILE_MAX_DIM;
@@ -63,7 +63,7 @@ bool pf_test::handle_mouse_click(app& a, const mouse_button_event& e, bool is_do
}
else if (e.button == mouse_button_right && is_down)
{
- auto C = a.ensure_player_character(m.world()).ptr;
+ auto C = a.ensure_player_character(m.world());
C->script.do_clear(C);
}
return false;
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp
index 9eb36e39..d4497fda 100644
--- a/editor/vobj-editor.cpp
+++ b/editor/vobj-editor.cpp
@@ -13,7 +13,7 @@ namespace floormat {
StringView vobj_factory::name() const { return info().name; }
StringView vobj_factory::descr() const { return info().descr; }
-std::shared_ptr<anim_atlas> vobj_factory::atlas() const { return info().atlas; }
+bptr<anim_atlas> vobj_factory::atlas() const { return info().atlas; }
vobj_factory::vobj_factory() = default;
vobj_factory::~vobj_factory() noexcept = default;
@@ -81,7 +81,7 @@ struct light_factory final : vobj_factory
{
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;
+ bptr<object> make(world& w, object_id id, global_coords pos) const override;
};
object_type light_factory::type() const { return object_type::light; }
@@ -95,7 +95,7 @@ const vobj_cell& light_factory::info() const
return ret;
}
-std::shared_ptr<object> light_factory::make(world& w, object_id id, global_coords pos) const
+bptr<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;
@@ -105,7 +105,7 @@ struct hole_factory final : vobj_factory
{
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;
+ bptr<object> make(world& w, object_id id, global_coords pos) const override;
};
object_type hole_factory::type() const { return object_type::hole; }
@@ -119,7 +119,7 @@ const vobj_cell& hole_factory::info() const
return ret;
}
-std::shared_ptr<object> hole_factory::make(world& w, object_id id, global_coords pos) const
+bptr<object> hole_factory::make(world& w, object_id id, global_coords pos) const
{
auto ret = w.make_object<hole>(id, pos, hole_proto{});
return ret;
diff --git a/editor/vobj-editor.hpp b/editor/vobj-editor.hpp
index 0057504c..c614b4e7 100644
--- a/editor/vobj-editor.hpp
+++ b/editor/vobj-editor.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "src/object-type.hpp"
#include "src/object-id.hpp"
+#include "compat/borrowed-ptr-fwd.hpp"
#include <memory>
#include <map>
#include <cr/String.h>
@@ -20,11 +21,11 @@ struct vobj_factory
virtual ~vobj_factory() noexcept;
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;
+ virtual bptr<object> make(world& w, object_id id, global_coords pos) const = 0;
StringView name() const;
StringView descr() const;
- std::shared_ptr<anim_atlas> atlas() const;
+ bptr<anim_atlas> atlas() const;
};
class vobj_editor final
diff --git a/editor/wall-editor.cpp b/editor/wall-editor.cpp
index 57cdb8ed..ee458547 100644
--- a/editor/wall-editor.cpp
+++ b/editor/wall-editor.cpp
@@ -71,13 +71,13 @@ StringView wall_editor::name() const { return "wall"_s; }
enum rotation wall_editor::rotation() const { return _r; }
void wall_editor::set_rotation(enum rotation r) { _r = r; }
void wall_editor::toggle_rotation() { _r = next_rot(_r); }
-std::shared_ptr<wall_atlas> wall_editor::get_selected() const { return _selected_atlas; }
-void wall_editor::select_atlas(const std::shared_ptr<wall_atlas>& atlas) { _selected_atlas = atlas; }
+bptr<wall_atlas> wall_editor::get_selected() const { return _selected_atlas; }
+void wall_editor::select_atlas(const bptr<wall_atlas>& atlas) { _selected_atlas = atlas; }
void wall_editor::clear_selection() { _selected_atlas = nullptr; }
-bool wall_editor::is_atlas_selected(const std::shared_ptr<wall_atlas>& atlas) const { return _selected_atlas == atlas; }
+bool wall_editor::is_atlas_selected(const bptr<wall_atlas>& atlas) const { return _selected_atlas == atlas; }
bool wall_editor::is_anything_selected() const { return _selected_atlas != nullptr; }
-void wall_editor::place_tile(world& w, global_coords coords, const std::shared_ptr<wall_atlas>& atlas)
+void wall_editor::place_tile(world& w, global_coords coords, const bptr<wall_atlas>& atlas)
{
auto [c, t] = w[coords];
switch (_r)
diff --git a/editor/wall-editor.hpp b/editor/wall-editor.hpp
index 22f018d1..063729c7 100644
--- a/editor/wall-editor.hpp
+++ b/editor/wall-editor.hpp
@@ -3,7 +3,6 @@
#include "src/rotation.hpp"
#include "src/global-coords.hpp"
#include "loader/wall-cell.hpp"
-#include <memory>
#include <map>
namespace floormat {
@@ -14,7 +13,7 @@ class wall_atlas;
class wall_editor
{
std::map<StringView, wall_cell> _atlases;
- std::shared_ptr<wall_atlas> _selected_atlas;
+ bptr<wall_atlas> _selected_atlas;
enum rotation _r = rotation::N;
void load_atlases();
@@ -32,13 +31,13 @@ public:
void set_rotation(enum rotation r);
void toggle_rotation();
- std::shared_ptr<wall_atlas> get_selected() const;
- void select_atlas(const std::shared_ptr<wall_atlas>& atlas);
+ bptr<wall_atlas> get_selected() const;
+ void select_atlas(const bptr<wall_atlas>& atlas);
void clear_selection();
- bool is_atlas_selected(const std::shared_ptr<wall_atlas>& atlas) const;
+ bool is_atlas_selected(const bptr<wall_atlas>& atlas) const;
bool is_anything_selected() const;
- void place_tile(world& w, global_coords coords, const std::shared_ptr<wall_atlas>& atlas);
+ void place_tile(world& w, global_coords coords, const bptr<wall_atlas>& atlas);
editor_snap_mode check_snap(int mods) const;
};