Saturday, April 4, 2015

FMod - Toward Easier Undo

It comes to mind that the way I've been having all the tools collect the undo history is really inconvenient for me and that there's a better way. Currently, every tool has to get the current tile before replacing it and push a big Tuple(Of UShort, UShort, Byte, UShort, UShort) to the ModdedTiles list in the TileUndo instance it's using to represent the action.

I've grown rather tired of coding that, so I think I should do something different. Since tools can only modify the level through the instance of IAbiatharLevelWrapper they're given, I could add methods to that interface that cause it to track modified tiles and automatically spit out the complete IUndoableAction. Tile changes already go through a property on that interface, so it would be a simple matter of adding a few lines to its implementation.

I haven't done this yet, but I probably will if I ever have to make serious additions to the toolbox.

No comments:

Post a Comment