]> git.lizzy.rs Git - nothing.git/blobdiff - src/game/level/level_editor/undo_history.h
Merge pull request #1093 from tsoding/1092
[nothing.git] / src / game / level / level_editor / undo_history.h
index 58abd6e7505f0a8ad899d2100f764a0a40ab8421..f9623f38f9c7f9bbc06608a49847ec81f94f8f22 100644 (file)
@@ -1,18 +1,24 @@
 #ifndef UNDO_HISTORY_H_
 #define UNDO_HISTORY_H_
 
-#include "layer.h"
+#include "stack.h"
 
-typedef struct {
-    LayerPtr layer;
-} Action;
+typedef void (*RevertAction)(void *context, size_t context_size);
 
-typedef struct UndoHistory UndoHistory;
+typedef struct {
+    Stack actions;
+} UndoHistory;
 
-UndoHistory *create_undo_history(void);
-void destroy_undo_history(UndoHistory *undo_history);
+static inline
+void destroy_undo_history(UndoHistory undo_history)
+{
+    destroy_stack(undo_history.actions);
+}
 
-void undo_history_push(UndoHistory *undo_history, Action action);
+void undo_history_push(UndoHistory *undo_history,
+                       RevertAction revert,
+                       void *context_data,
+                       size_t context_data_size);
 void undo_history_pop(UndoHistory *undo_history);
 
 #endif  // UNDO_HISTORY_H_