mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-13 20:36:19 -05:00
Add a current() method to History, so that consumers don't need to worry about bounds checking.
This commit is contained in:
4
map.cpp
4
map.cpp
@@ -618,7 +618,7 @@ void Map::_floodFillCollisionElevation(int x, int y, uint collision, uint elevat
|
||||
|
||||
void Map::undo() {
|
||||
if (blockdata) {
|
||||
Blockdata *commit = history.pop();
|
||||
Blockdata *commit = history.back();
|
||||
if (commit != NULL) {
|
||||
blockdata->copyFrom(commit);
|
||||
emit mapChanged(this);
|
||||
@@ -638,7 +638,7 @@ void Map::redo() {
|
||||
|
||||
void Map::commit() {
|
||||
if (blockdata) {
|
||||
if (!blockdata->equals(history.history.at(history.head))) {
|
||||
if (!blockdata->equals(history.current())) {
|
||||
Blockdata* commit = blockdata->copy();
|
||||
history.push(commit);
|
||||
emit mapChanged(this);
|
||||
|
||||
Reference in New Issue
Block a user