Add support for saving and getting the owner of a script in script.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
5fd8abb3a8
commit
949fc67831
|
@ -12,10 +12,14 @@ namespace CreatureLib::Battling {
|
|||
class Creature;
|
||||
|
||||
class BattleScript {
|
||||
ArbUt::OptionalBorrowedPtr<void> _owner;
|
||||
|
||||
public:
|
||||
BattleScript() = default;
|
||||
BattleScript(ArbUt::OptionalBorrowedPtr<void> owner) { _owner = owner; };
|
||||
NO_COPY_OR_MOVE(BattleScript);
|
||||
|
||||
inline ArbUt::OptionalBorrowedPtr<void> GetOwner() const noexcept { return _owner; }
|
||||
|
||||
virtual ~BattleScript() = default;
|
||||
|
||||
virtual BattleScript* Clone() = 0;
|
||||
|
|
|
@ -12,7 +12,7 @@ private:
|
|||
ArbUt::StringView _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(const ArbUt::StringView& name) : _name(name){};
|
||||
explicit TestScript(const ArbUt::StringView& name) : BattleScript(nullptr), _name(name){};
|
||||
|
||||
const ArbUt::StringView& GetName() const noexcept override { return _name; }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ private:
|
|||
ArbUt::StringView _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(const ArbUt::StringView& name) : _name(name){};
|
||||
explicit TestScript(const ArbUt::StringView& name) : BattleScript(nullptr), _name(name){};
|
||||
const ArbUt::StringView& GetName() const noexcept override { return _name; }
|
||||
|
||||
BattleScript* Clone() override { return new TestScript(_name); }
|
||||
|
|
|
@ -11,7 +11,7 @@ private:
|
|||
ArbUt::StringView _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(const ArbUt::StringView& name) : _name(name){};
|
||||
explicit TestScript(const ArbUt::StringView& name) : BattleScript(nullptr), _name(name){};
|
||||
const ArbUt::StringView& GetName() const noexcept override { return _name; }
|
||||
|
||||
void TestMethod(int& runCount) { runCount++; }
|
||||
|
|
Loading…
Reference in New Issue