Adds C Interface for Item choice
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-04-23 18:26:46 +02:00
parent 0e7b9ae1fd
commit a8c80a3c66
2 changed files with 28 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ namespace CreatureLib::Battling {
std::optional<CreatureIndex> _target;
public:
ItemTurnChoice(ArbUt::BorrowedPtr<Creature> user, const ArbUt::BorrowedPtr<Library::Item>& item,
ItemTurnChoice(ArbUt::BorrowedPtr<Creature> user, const ArbUt::BorrowedPtr<const Library::Item>& item,
const std::optional<CreatureIndex>& target)
: BaseTurnChoice(user), _item(item), _target(target) {}
~ItemTurnChoice() override = default;
@@ -19,6 +19,14 @@ namespace CreatureLib::Battling {
[[nodiscard]] const ArbUt::BorrowedPtr<const Library::Item>& GetItem() const noexcept { return _item; }
[[nodiscard]] const std::optional<CreatureIndex>& GetTarget() const noexcept { return _target; }
protected:
size_t ScriptCount() const override { return GetUser()->ScriptCount(); }
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override {
GetOwnScripts(scripts);
GetUser()->GetActiveScripts(scripts);
}
void GetOwnScripts(ArbUt::List<ScriptWrapper>&) override {}
};
}