mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-24 17:46:19 -05:00
Add metatile swap
This commit is contained in:
@@ -25,6 +25,7 @@ public:
|
||||
if (head > 0) {
|
||||
return history.at(--head);
|
||||
}
|
||||
head = -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -37,9 +38,7 @@ public:
|
||||
|
||||
void push(T commit) {
|
||||
while (head + 1 < history.length()) {
|
||||
T item = history.last();
|
||||
history.removeLast();
|
||||
delete item;
|
||||
delete history.takeLast();
|
||||
}
|
||||
if (saved > head) {
|
||||
saved = -1;
|
||||
@@ -48,7 +47,7 @@ public:
|
||||
head++;
|
||||
}
|
||||
|
||||
T current() {
|
||||
T current() const {
|
||||
if (head < 0 || history.length() == 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -59,10 +58,30 @@ public:
|
||||
saved = head;
|
||||
}
|
||||
|
||||
bool isSaved() {
|
||||
bool isSaved() const {
|
||||
return saved == head;
|
||||
}
|
||||
|
||||
int length() const {
|
||||
return history.length();
|
||||
}
|
||||
|
||||
bool isEmpty() const {
|
||||
return history.isEmpty();
|
||||
}
|
||||
|
||||
int index() const {
|
||||
return head;
|
||||
}
|
||||
|
||||
bool canUndo() const {
|
||||
return head >= 0;
|
||||
}
|
||||
|
||||
bool canRedo() const {
|
||||
return (head + 1) < history.length();
|
||||
}
|
||||
|
||||
private:
|
||||
QList<T> history;
|
||||
int head = -1;
|
||||
|
||||
@@ -124,10 +124,13 @@ public:
|
||||
bool isWithinBounds(const QRect &rect) const;
|
||||
bool isWithinBorderBounds(int x, int y) const;
|
||||
|
||||
bool getBlock(int x, int y, Block *out);
|
||||
bool getBlock(int x, int y, Block *out) const;
|
||||
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
||||
void setBlockdata(Blockdata blockdata, bool enableScriptCallback = false);
|
||||
|
||||
uint16_t getMetatileId(int x, int y) const;
|
||||
bool setMetatileId(int x, int y, uint16_t metatileId, bool enableScriptCallback = false);
|
||||
|
||||
void adjustDimensions(const QMargins &margins, bool setNewBlockdata = true);
|
||||
void setDimensions(int newWidth, int newHeight, bool setNewBlockdata = true);
|
||||
void setBorderDimensions(int newWidth, int newHeight, bool setNewBlockdata = true, bool enableScriptCallback = false);
|
||||
|
||||
Reference in New Issue
Block a user