yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::OverworldItemsEditAction Class Reference

Undoable action for overworld item mutations. More...

#include <overworld_undo_actions.h>

Inheritance diagram for yaze::editor::OverworldItemsEditAction:
Collaboration diagram for yaze::editor::OverworldItemsEditAction:

Public Types

using RestoreFn = std::function<void(const OverworldItemsSnapshot&)>
 

Public Member Functions

 OverworldItemsEditAction (OverworldItemsSnapshot before, OverworldItemsSnapshot 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

OverworldItemsSnapshot before_
 
OverworldItemsSnapshot after_
 
RestoreFn restore_
 
std::string description_
 

Detailed Description

Undoable action for overworld item mutations.

Stores before/after snapshots and applies them through a restore callback.

Definition at line 180 of file overworld_undo_actions.h.

Member Typedef Documentation

◆ RestoreFn

Definition at line 182 of file overworld_undo_actions.h.

Constructor & Destructor Documentation

◆ OverworldItemsEditAction()

yaze::editor::OverworldItemsEditAction::OverworldItemsEditAction ( OverworldItemsSnapshot before,
OverworldItemsSnapshot after,
RestoreFn restore,
std::string description )
inline

Definition at line 184 of file overworld_undo_actions.h.

Member Function Documentation

◆ Undo()

absl::Status yaze::editor::OverworldItemsEditAction::Undo ( )
inlineoverridevirtual

Implements yaze::editor::UndoAction.

Definition at line 192 of file overworld_undo_actions.h.

References before_, and restore_.

◆ Redo()

absl::Status yaze::editor::OverworldItemsEditAction::Redo ( )
inlineoverridevirtual

Implements yaze::editor::UndoAction.

Definition at line 201 of file overworld_undo_actions.h.

References after_, and restore_.

◆ Description()

std::string yaze::editor::OverworldItemsEditAction::Description ( ) const
inlineoverridevirtual

Human-readable description (e.g., "Paint 12 tiles on map 5")

Implements yaze::editor::UndoAction.

Definition at line 210 of file overworld_undo_actions.h.

References description_.

◆ MemoryUsage()

size_t yaze::editor::OverworldItemsEditAction::MemoryUsage ( ) const
inlineoverridevirtual

Approximate memory footprint for budget enforcement.

Reimplemented from yaze::editor::UndoAction.

Definition at line 212 of file overworld_undo_actions.h.

References after_, before_, and yaze::editor::OverworldItemsSnapshot::items.

◆ CanMergeWith()

bool yaze::editor::OverworldItemsEditAction::CanMergeWith ( const UndoAction & ) const
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 220 of file overworld_undo_actions.h.

Member Data Documentation

◆ before_

OverworldItemsSnapshot yaze::editor::OverworldItemsEditAction::before_
private

Definition at line 223 of file overworld_undo_actions.h.

Referenced by MemoryUsage(), and Undo().

◆ after_

OverworldItemsSnapshot yaze::editor::OverworldItemsEditAction::after_
private

Definition at line 224 of file overworld_undo_actions.h.

Referenced by MemoryUsage(), and Redo().

◆ restore_

RestoreFn yaze::editor::OverworldItemsEditAction::restore_
private

Definition at line 225 of file overworld_undo_actions.h.

Referenced by Redo(), and Undo().

◆ description_

std::string yaze::editor::OverworldItemsEditAction::description_
private

Definition at line 226 of file overworld_undo_actions.h.

Referenced by Description().


The documentation for this class was generated from the following file: