MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / RunActionsHelper

Method RunActionsHelper

lib/macro/macro.cpp:432–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432bool Macro::RunActionsHelper(
433 const std::deque<std::shared_ptr<MacroAction>> &actionsToRun,
434 bool ignorePause)
435{
436 if (_paused && !ignorePause) {
437 return true;
438 }
439
440 // Create copy of action list as elements might be removed, inserted, or
441 // reordered while actions are currently being executed.
442 auto actions = actionsToRun;
443
444 bool actionsExecutedSuccessfully = true;
445 for (auto &action : actions) {
446 if (!action) {
447 continue;
448 }
449 if (action->Enabled()) {
450 action->LogAction();
451 bool actionResult = false;
452 action->WithLock([&action, &actionResult]() {
453 actionResult = action->PerformAction();
454 });
455 action->ApplyVarMappings();
456 actionsExecutedSuccessfully =
457 actionsExecutedSuccessfully && actionResult;
458 } else {
459 vblog(LOG_INFO, "skipping disabled action %s",
460 action->GetId().c_str());
461 }
462 if (!actionsExecutedSuccessfully || (_paused && !ignorePause) ||
463 _stop || _die) {
464 break;
465 }
466 if (action->Enabled()) {
467 action->EnableHighlight();
468 }
469 }
470 return actionsExecutedSuccessfully;
471}
472
473bool Macro::RunActions(bool ignorePause)
474{

Callers

nothing calls this directly

Calls 8

WithLockMethod · 0.80
ApplyVarMappingsMethod · 0.80
EnabledMethod · 0.45
LogActionMethod · 0.45
PerformActionMethod · 0.45
c_strMethod · 0.45
GetIdMethod · 0.45
EnableHighlightMethod · 0.45

Tested by

no test coverage detected