Undoable action for screen editor edits. More...
#include <screen_undo_actions.h>


Public Types | |
| using | RestoreFn = std::function<void(const ScreenSnapshot&)> |
Public Member Functions | |
| ScreenEditAction (ScreenSnapshot before, ScreenSnapshot after, RestoreFn restore, std::string description) | |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| std::string | Description () const override |
| Human-readable description (e.g., "Paint 12 tiles on map 5") | |
| size_t | MemoryUsage () const override |
| Approximate memory footprint for budget enforcement. | |
| bool | CanMergeWith (const UndoAction &) const override |
Public Member Functions inherited from yaze::editor::UndoAction | |
| virtual | ~UndoAction ()=default |
| virtual void | MergeWith (UndoAction &) |
Private Attributes | |
| ScreenSnapshot | before_ |
| ScreenSnapshot | after_ |
| RestoreFn | restore_ |
| std::string | description_ |
Undoable action for screen editor edits.
Stores before and after snapshots and uses a caller-provided restore callback to apply them back into the ScreenEditor. Follows the same pattern as DungeonObjectsAction and Tile16EditAction.
Definition at line 72 of file screen_undo_actions.h.
| using yaze::editor::ScreenEditAction::RestoreFn = std::function<void(const ScreenSnapshot&)> |
Definition at line 74 of file screen_undo_actions.h.
|
inline |
Definition at line 76 of file screen_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 83 of file screen_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 91 of file screen_undo_actions.h.
|
inlineoverridevirtual |
Human-readable description (e.g., "Paint 12 tiles on map 5")
Implements yaze::editor::UndoAction.
Definition at line 99 of file screen_undo_actions.h.
References description_.
|
inlineoverridevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented from yaze::editor::UndoAction.
Definition at line 101 of file screen_undo_actions.h.
References after_, before_, yaze::editor::ScreenSnapshot::dungeon_map, yaze::zelda3::DungeonMap::floor_gfx, yaze::zelda3::DungeonMap::floor_rooms, and yaze::editor::DungeonMapSnapshot::map_data.
|
inlineoverridevirtual |
Whether this action can merge with the previous action on the stack. Called only when both actions have the same concrete type.
Reimplemented from yaze::editor::UndoAction.
Definition at line 115 of file screen_undo_actions.h.
|
private |
Definition at line 118 of file screen_undo_actions.h.
Referenced by MemoryUsage(), and Undo().
|
private |
Definition at line 119 of file screen_undo_actions.h.
Referenced by MemoryUsage(), and Redo().
|
private |
Definition at line 120 of file screen_undo_actions.h.
|
private |
Definition at line 121 of file screen_undo_actions.h.
Referenced by Description().