mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-11 10:25:43 -05:00
create edit history for region map tilemap and layout
This commit is contained in:
@@ -19,32 +19,6 @@ using std::shared_ptr;
|
||||
|
||||
class Project;
|
||||
|
||||
enum RegionMapEditorBox {
|
||||
BackgroundImage = 1,
|
||||
CityMapImage = 2,
|
||||
};
|
||||
|
||||
class RegionMapHistoryItem {
|
||||
public:
|
||||
int which;
|
||||
int mapWidth = 0;
|
||||
int mapHeight = 0;
|
||||
QVector<uint8_t> tiles;
|
||||
QString cityMap;
|
||||
RegionMapHistoryItem(int which, QVector<uint8_t> tiles, QString cityMap) {
|
||||
this->which = which;
|
||||
this->tiles = tiles;
|
||||
this->cityMap = cityMap;
|
||||
}
|
||||
RegionMapHistoryItem(int which, QVector<uint8_t> tiles, int width, int height) {
|
||||
this->which = which;
|
||||
this->tiles = tiles;
|
||||
this->mapWidth = width;
|
||||
this->mapHeight = height;
|
||||
}
|
||||
~RegionMapHistoryItem() {}
|
||||
};
|
||||
|
||||
struct LayoutSquare
|
||||
{
|
||||
QString map_section;
|
||||
@@ -69,9 +43,9 @@ public:
|
||||
RegionMap() = delete;
|
||||
RegionMap(Project *);
|
||||
|
||||
Project *project = nullptr;
|
||||
~RegionMap() {}
|
||||
|
||||
History<RegionMapHistoryItem*> history; // TODO
|
||||
Project *project = nullptr;
|
||||
|
||||
bool loadMapData(poryjson::Json);
|
||||
bool loadTilemap(poryjson::Json);
|
||||
@@ -121,6 +95,9 @@ public:
|
||||
QByteArray getTilemap();
|
||||
void setTilemap(QByteArray newTilemap);
|
||||
|
||||
QList<LayoutSquare> getLayout(QString layer);
|
||||
void setLayout(QString layer, QList<LayoutSquare> layout);
|
||||
|
||||
QStringList getLayers() { return this->layout_layers; }
|
||||
void setLayer(QString layer) { this->current_layer = layer; }
|
||||
QString getLayer() { return this->current_layer; }
|
||||
@@ -146,6 +123,12 @@ public:
|
||||
|
||||
QString fullPath(QString local);
|
||||
|
||||
void commit(QUndoCommand *command);
|
||||
QUndoStack editHistory;
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
private:
|
||||
// TODO: defaults needed?
|
||||
tsl::ordered_map<QString, MapSectionEntry> *region_map_entries = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user