From 0d30e9b57229905f78e7bd60fe5d3cde72851f28 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 16 Mar 2015 16:53:05 -0400 Subject: Rewrote map editor so a single file contains all maps Maps are viewed in a tree control on the left. They can be dragged and dropped. Maps are bolded when they are dirty. Saving saves expansion status and order of maps in tree. --- tools/mapedit/src/map.h | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'tools/mapedit/src/map.h') diff --git a/tools/mapedit/src/map.h b/tools/mapedit/src/map.h index a2b9cb8..5753cae 100644 --- a/tools/mapedit/src/map.h +++ b/tools/mapedit/src/map.h @@ -1,12 +1,16 @@ #ifndef MAP_H #define MAP_H +class Map; + #include #include #include #include #include "object.h" #include +#include "world.h" +#include class MapeditFrame; @@ -57,36 +61,45 @@ struct MapObjectEntry { class Map { public: - Map(); - Map(std::string name); + Map(int id, World* world); Map(const Map& map); Map(Map&& map); ~Map(); Map& operator= (Map other); friend void swap(Map& first, Map& second); + int getID() const; std::string getTitle() const; - void setTitle(std::string title); - void save(std::string name); - bool hasUnsavedChanges() const; - void setTileAt(int x, int y, int tile); int getTileAt(int x, int y) const; const std::list>& getObjects() const; - void addObject(std::shared_ptr& obj); - void removeObject(std::shared_ptr& obj); - bool getDirty() const; + std::shared_ptr getLeftmap() const; + std::shared_ptr getRightmap() const; + wxTreeItemId getTreeItemId() const; + std::list> getChildren() const; + bool getExpanded() const; - MapeditFrame* frame; + void setTitle(std::string title, bool dirty = true); + void setTileAt(int x, int y, int tile, bool dirty = true); + void setMapdata(int* mapdata, bool dirty = true); + void addObject(std::shared_ptr& obj, bool dirty = true); + void removeObject(std::shared_ptr& obj, bool dirty = true); + void setLeftmap(int id, bool dirty = true); + void setRightmap(int id, bool dirty = true); + void setTreeItemId(wxTreeItemId id); + void addChild(int id); + void setExpanded(bool exp); private: - void setDirty(bool dirty); - + int id; + World* world; std::list> objects; int* mapdata; - std::string title; - std::string leftmap; - std::string rightmap; - bool dirty; + std::string title {"Untitled Map"}; + std::list children; + int leftmap = -1; + int rightmap = -1; + wxTreeItemId treeItemId; + bool expanded = false; }; #endif -- cgit 1.4.1