From 860773932a67fa0a30c5943336bef6e0be0414a1 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 1 Feb 2025 22:11:28 +0500 Subject: feat: select a tile --- src/tileset.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/tileset.cpp') diff --git a/src/tileset.cpp b/src/tileset.cpp index 8651a8f..5e5b47a 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -1,5 +1,7 @@ #include "tileset.hpp" +#include + namespace silly::editor { void Tileset::add_tile(const std::string &path, TilesetTileType type) { TilesetTile tile; @@ -11,18 +13,19 @@ namespace silly::editor { return; } - this->tiles.push_back(tile); + this->tiles.push_back(std::make_shared(tile)); } void Tileset::remove_tile(const TilesetTile &tile) { this->tiles.resize(std::distance( this->tiles.begin(), - std::remove_if( - this->tiles.begin(), this->tiles.end(), - [&tile](const TilesetTile &t) { return t.id == tile.id; }))); + std::remove_if(this->tiles.begin(), this->tiles.end(), + [&tile](const std::shared_ptr &t) { + return t.get()->id == tile.id; + }))); } - const std::vector &Tileset::get_tiles() const { + const std::vector> &Tileset::get_tiles() const { return this->tiles; } } \ No newline at end of file -- cgit v1.2.3