Jazz2::Editor::InsertLayerCommand class

Adds a layer or removes one.

Only the layer itself is kept, compressed while it isn't in the level, not the whole level. The ground lines follow the layers after it, those of a removed layer come back with it.

Base classes

class EditCommand
Undoable change of a level being edited.

Public static functions

static auto Add(const LevelDocument& document, std::int32_t index, const DocumentLayer& layer, String name) -> std::unique_ptr<InsertLayerCommand>
Creates an addition of a layer at index.
static auto Remove(const LevelDocument& document, std::int32_t index, String name) -> std::unique_ptr<InsertLayerCommand>
Creates a removal of the layer at index.

Public functions

void Do(LevelDocument& document, DocumentChanges& changes) override
Applies the change to the document, again after it was undone.
void Undo(LevelDocument& document, DocumentChanges& changes) override
Reverts the change.
auto GetName() const -> String override
Returns the name shown in the history.
auto GetMemoryUsage() const -> std::size_t override
Returns the memory the command takes.