Functions to control the undo/redo memory.


GCUndo.MarkBefore( element: string ): void

Mark an undo point by recording the current state of a specific part of the map data before it is modified. Once GCUndo.MarkBefore is called, the function should not be called again until either GCUndo.MarkAfter or GCUndo.Abort are called.

If the marking fails, the function returns false. Check for this and do not modify the map. The element string parameter describes what data to record into the undo memory and can be one of:

element Description
"custom-tiles" Record the state of all color, mono custom tiles and custom tile groups in the map.
"document" Record the whole map. Very inefficient and not recommended.

Note: It is strongly recommended that GCKernel.SetBlockingMode(true) is called prior to this call, to prevent user actions from generating conflicting undo states.


GCUndo.MarkAfter(): void

Mark the successful end of modifications to the previously specified element of map data. After this call, the user will be able to undo back to the state where GCUndo.MarkBefore was called, and redo back to the point recorded by this GCUndo.MarkAfter call.


GCUndo.Abort(): void

If no modifications were made to the map data after a call to GCUndo.MarkBefore, then this function allows the undo memory to be reverted back to the initial state, rather than generating additional steps in the undo memory.