Fix Snapshot Load and Save Functions

Were just pointers to the map before. Fix to be actual clones of the map.
This commit is contained in:
Unknown 2018-10-19 20:49:59 +02:00
parent 37bff59f83
commit 2ea974bbd5
2 changed files with 12 additions and 6 deletions

View file

@ -154,6 +154,10 @@ class Simulation {
_dirty = true;
}
void saveSnapshot() => _snapshot = map;
Grid<bool> loadSnapshot() => map = _snapshot;
void saveSnapshot() => _snapshot = Grid.from(map);
Grid<bool> loadSnapshot() {
map = Grid.from(_snapshot);
_dirty = true;
return map;
}
}