public void Undo(Bitmap selection, RegionFile region, Bitmap terrainOverlay, Bitmap biomeOverlay, ref String[,] tooltips, Bitmap populateOverlay, UpdateStatus updateStatus)
{
while (undoStack.Count > 0 && undoStack.Last.Value.PreviousAction == null)
{
redoStack.AddLast(undoStack.Last.Value);
undoStack.RemoveLast();
}
if (undoStack.Count == 0)
return;
IAction previous = undoStack.Last.Value.PreviousAction;
if (previous == null)
{
throw new Exception("Undo sanity check failed.");
}
if (previous is SelectionAction)
{
ApplySelectionState((SelectionAction)previous, selection);
}
else if (previous is BiomeAction)
{
ApplyBiomeState((BiomeAction)previous, region, terrainOverlay, biomeOverlay, ref tooltips, updateStatus);
}
else if (previous is PopulateAction)
{
ApplyPopulateState((PopulateAction)previous, region, populateOverlay);
}
MovePrevious();
OnChange();
}