SetQuestsCommand.h header
#include <ew/core/SetQuestsCommand.h>
Namespace ew::core
SetQuestsCommand class
class ew::core::SetQuestsCommand
Command that replaces the project's quest registry (used to add, edit or remove one by pushing the new list). Undo restores the previous list.
Whole-list rather than per-quest, for the reason SetVariablesCommand gives: there is no natural command already in play when a panel edits a project-wide registry, so the tempting shortcut is to call the setter directly – which compiles, works, and silently makes the edit un-undoable.
A quest edit is usually two lists at once, because a quest owns state variables that have to be created, renamed and re-seeded alongside it. The caller pushes both this and a SetVariablesCommand inside one undo group, so a single Ctrl+Z takes back the whole edit rather than leaving a quest whose variables belong to the version before it.
Members
ew::core::branching::SetQuestsCommand::SetQuestsCommand(ew::core::project::Project &project, std::vector< Quest > quests)
Creates a command that sets the quest registry to quests when applied.
ew::core::branching::SetQuestsCommand::~SetQuestsCommand() override
Destroys the command.
void ew::core::branching::SetQuestsCommand::apply() override
Records the current quests and applies the new list.
void ew::core::branching::SetQuestsCommand::undo() override
Restores the previous quests.
QString ew::core::branching::SetQuestsCommand::description() const override
Returns a short description for the undo/redo UI.
ew::core::foundation::OperationSubject ew::core::branching::SetQuestsCommand::subject() const override
Returns the subject this command changes. See Command::subject().