From efa8640aabb3b4df31531ecd41ed1073dda63ed2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 24 Sep 2014 17:39:36 +0200 Subject: Make MapContext keep a complete copy of the map --- src/model/Map.cpp | 4 ++-- src/model/Map.hpp | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/model') diff --git a/src/model/Map.cpp b/src/model/Map.cpp index aff05d1..21fbe00 100644 --- a/src/model/Map.cpp +++ b/src/model/Map.cpp @@ -31,8 +31,8 @@ namespace RPGEdit { namespace Model { -std::shared_ptr Map::load(__attribute__((unused)) const std::string &name) { - std::shared_ptr map(new Map(16, 16, 2)); +std::unique_ptr Map::load(__attribute__((unused)) const std::string &name) { + std::unique_ptr map(new Map(16, 16, 2)); map->tileset.push_back("dirt"); map->tileset.push_back("horizontal_bar"); diff --git a/src/model/Map.hpp b/src/model/Map.hpp index 77a67be..421b487 100644 --- a/src/model/Map.hpp +++ b/src/model/Map.hpp @@ -27,6 +27,7 @@ #pragma once #include +#include #include #include #include @@ -44,7 +45,7 @@ private: size_t width, height; std::vector> tiles; - std::vector entities; + std::deque entities; Map(size_t width0, size_t height0, size_t layers) @@ -62,11 +63,11 @@ public: return tileset; } - std::vector & getEntities() { + std::deque & getEntities() { return entities; } - const std::vector & getEntities() const { + const std::deque & getEntities() const { return entities; } @@ -96,7 +97,7 @@ public: return tiles[layer][y*width + x]; } - static std::shared_ptr load(const std::string &name); + static std::unique_ptr load(const std::string &name); }; } -- cgit v1.2.3