Rework ScriptAggregator so it only needs to be created once, and can then be reset.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -7,18 +7,20 @@
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
class ScriptWrapper {
|
||||
std::variant<Script**, ScriptSet*> _value;
|
||||
union {
|
||||
Script** _script;
|
||||
ScriptSet* _scriptSet;
|
||||
};
|
||||
bool _isSet;
|
||||
|
||||
public:
|
||||
ScriptWrapper(Script** s) : _value(s), _isSet(false) {}
|
||||
ScriptWrapper(ScriptSet* s) : _value(s), _isSet(true) {}
|
||||
ScriptWrapper(Script** s) : _script(s), _isSet(false) {}
|
||||
ScriptWrapper(ScriptSet* s) : _scriptSet(s), _isSet(true) {}
|
||||
|
||||
bool IsSet() const { return _isSet; }
|
||||
|
||||
Script** GetScript() const { return std::get<Script**>(_value); }
|
||||
|
||||
ScriptSet* GetScriptSet() const { return std::get<ScriptSet*>(_value); }
|
||||
Script** GetScript() const { return _script; }
|
||||
ScriptSet* GetScriptSet() const { return _scriptSet; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user