Add macro action "random" (#353)

This should be expanded upon by adding the ability to add weights to each macro.
This commit is contained in:
WarmUpTill
2021-11-20 03:52:12 -08:00
committed by GitHub
parent cce6e240c2
commit a1cae263c1
7 changed files with 355 additions and 2 deletions

View File

@@ -303,13 +303,18 @@ void Macro::ResolveMacroRef()
MacroRefCondition *ref =
dynamic_cast<MacroRefCondition *>(c.get());
if (ref) {
ref->_macro.UpdateRef();
ref->ResolveMacroRef();
}
}
for (auto &a : _actions) {
MacroRefAction *ref = dynamic_cast<MacroRefAction *>(a.get());
if (ref) {
ref->_macro.UpdateRef();
ref->ResolveMacroRef();
}
MultiMacroRefAction *ref2 =
dynamic_cast<MultiMacroRefAction *>(a.get());
if (ref2) {
ref2->ResolveMacroRef();
}
}
}
@@ -586,3 +591,10 @@ void MacroRefAction::ResolveMacroRef()
{
_macro.UpdateRef();
}
void MultiMacroRefAction::ResolveMacroRef()
{
for (auto &m : _macros) {
m.UpdateRef();
}
}