Undoable action for painting tiles on the overworld map. More...
#include <overworld_undo_actions.h>


Public Member Functions | |
| OverworldTilePaintAction (int map_id, int world, std::vector< OverworldTileChange > tile_changes, zelda3::Overworld *overworld, std::function< void()> refresh_fn) | |
| 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 &prev) const override |
| void | MergeWith (UndoAction &prev) override |
| int | map_id () const |
| int | world () const |
| const std::vector< OverworldTileChange > & | tile_changes () const |
Public Member Functions inherited from yaze::editor::UndoAction | |
| virtual | ~UndoAction ()=default |
Static Public Attributes | |
| static constexpr int | kMergeWindowMs = 500 |
| Merge window: consecutive paints within this duration become one step. | |
Private Attributes | |
| int | map_id_ |
| int | world_ |
| std::vector< OverworldTileChange > | tile_changes_ |
| zelda3::Overworld * | overworld_ |
| std::function< void()> | refresh_fn_ |
| std::chrono::steady_clock::time_point | timestamp_ |
Undoable action for painting tiles on the overworld map.
Captures a batch of tile changes (from a single paint stroke or rectangle fill) with both old and new values so that Undo() and Redo() are fully self-contained.
Consecutive paint actions on the same map within kMergeWindowMs are merged into a single undo step via CanMergeWith/MergeWith.
Definition at line 41 of file overworld_undo_actions.h.
|
inline |
| map_id | Overworld map index where painting occurred |
| world | World index (0=Light, 1=Dark, 2=Special) |
| tile_changes | Vector of individual tile changes with old+new values |
| overworld | Non-owning pointer to the Overworld data layer |
| refresh_fn | Callback to refresh map visuals after undo/redo |
Definition at line 53 of file overworld_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 65 of file overworld_undo_actions.h.
References yaze::zelda3::Overworld::GetMapTiles(), overworld_, refresh_fn_, tile_changes_, and world_.

|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 79 of file overworld_undo_actions.h.
References yaze::zelda3::Overworld::GetMapTiles(), overworld_, refresh_fn_, tile_changes_, and world_.

|
inlineoverridevirtual |
Human-readable description (e.g., "Paint 12 tiles on map 5")
Implements yaze::editor::UndoAction.
Definition at line 93 of file overworld_undo_actions.h.
References map_id_, and tile_changes_.
|
inlineoverridevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented from yaze::editor::UndoAction.
Definition at line 100 of file overworld_undo_actions.h.
References tile_changes_.
|
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 105 of file overworld_undo_actions.h.
References kMergeWindowMs, map_id_, timestamp_, and world_.
|
inlineoverridevirtual |
Absorb the previous action into this one. Precondition: CanMergeWith(prev) returned true.
Reimplemented from yaze::editor::UndoAction.
Definition at line 117 of file overworld_undo_actions.h.
References tile_changes_, and timestamp_.
|
inline |
Definition at line 148 of file overworld_undo_actions.h.
References map_id_.
|
inline |
Definition at line 149 of file overworld_undo_actions.h.
References world_.
|
inline |
Definition at line 150 of file overworld_undo_actions.h.
References tile_changes_.
|
staticconstexpr |
Merge window: consecutive paints within this duration become one step.
Definition at line 44 of file overworld_undo_actions.h.
Referenced by CanMergeWith().
|
private |
Definition at line 155 of file overworld_undo_actions.h.
Referenced by CanMergeWith(), Description(), and map_id().
|
private |
Definition at line 156 of file overworld_undo_actions.h.
Referenced by CanMergeWith(), Redo(), Undo(), and world().
|
private |
Definition at line 157 of file overworld_undo_actions.h.
Referenced by Description(), MemoryUsage(), MergeWith(), Redo(), tile_changes(), and Undo().
|
private |
Definition at line 158 of file overworld_undo_actions.h.
|
private |
Definition at line 159 of file overworld_undo_actions.h.
|
private |
Definition at line 160 of file overworld_undo_actions.h.
Referenced by CanMergeWith(), and MergeWith().