Move ScriptCategory enum outside of class scope of ScriptResolver.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f22c23d593
commit
d4fd7282f5
|
@ -38,6 +38,6 @@ const DamageLibrary* BattleLibrary::GetDamageLibrary() const { return _damageLib
|
||||||
|
|
||||||
const MiscLibrary* BattleLibrary::GetMiscLibrary() const { return _miscLibrary; }
|
const MiscLibrary* BattleLibrary::GetMiscLibrary() const { return _miscLibrary; }
|
||||||
|
|
||||||
Script* BattleLibrary::LoadScript(ScriptResolver::ScriptCategory category, const std::string& scriptName) const {
|
Script* BattleLibrary::LoadScript(ScriptCategory category, const std::string& scriptName) const {
|
||||||
return _scriptResolver->LoadScript(category, scriptName);
|
return _scriptResolver->LoadScript(category, scriptName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace CreatureLib::Battling {
|
||||||
[[nodiscard]] const MiscLibrary* GetMiscLibrary() const;
|
[[nodiscard]] const MiscLibrary* GetMiscLibrary() const;
|
||||||
[[nodiscard]] const ExperienceLibrary* GetExperienceLibrary() const { return _experienceLibrary; }
|
[[nodiscard]] const ExperienceLibrary* GetExperienceLibrary() const { return _experienceLibrary; }
|
||||||
|
|
||||||
[[nodiscard]] Script* LoadScript(ScriptResolver::ScriptCategory category, const std::string& scriptName) const;
|
[[nodiscard]] Script* LoadScript(ScriptCategory category, const std::string& scriptName) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace CreatureLib::Battling {
|
||||||
const std::vector<BattleSide*>& GetSides() const { return _sides; }
|
const std::vector<BattleSide*>& GetSides() const { return _sides; }
|
||||||
Script* GetVolatileScript(const std::string& key) const { return _volatile.Get(key); }
|
Script* GetVolatileScript(const std::string& key) const { return _volatile.Get(key); }
|
||||||
void AddVolatileScript(const std::string& key) {
|
void AddVolatileScript(const std::string& key) {
|
||||||
auto script = _library->LoadScript(ScriptResolver::ScriptCategory::Battle, key);
|
auto script = _library->LoadScript(ScriptCategory::Battle, key);
|
||||||
return _volatile.Add(script);
|
return _volatile.Add(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Battling::Creature::Creature(const BattleLibrary* library, const Library::Creatu
|
||||||
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
|
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
|
||||||
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem), _nickname(std::move(nickname)),
|
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem), _nickname(std::move(nickname)),
|
||||||
_talentIndex(talent), _hasOverridenTalent(false), _attacks(std::move(attacks)) {
|
_talentIndex(talent), _hasOverridenTalent(false), _attacks(std::move(attacks)) {
|
||||||
_activeTalent = _library->LoadScript(ScriptResolver::ScriptCategory::Talent, GetActiveTalent());
|
_activeTalent = _library->LoadScript(ScriptCategory::Talent, GetActiveTalent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battling::Creature::ChangeLevel(int8_t amount) {
|
void Battling::Creature::ChangeLevel(int8_t amount) {
|
||||||
|
@ -131,7 +131,7 @@ void Battling::Creature::OverrideActiveTalent(const std::string& talent) {
|
||||||
_activeTalent->OnRemove();
|
_activeTalent->OnRemove();
|
||||||
delete _activeTalent;
|
delete _activeTalent;
|
||||||
_overridenTalentName = talent;
|
_overridenTalentName = talent;
|
||||||
_activeTalent = this->_library->LoadScript(ScriptResolver::ScriptCategory::Talent, talent);
|
_activeTalent = this->_library->LoadScript(ScriptCategory::Talent, talent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<uint8_t>& Battling::Creature::GetTypes() const {
|
const std::vector<uint8_t>& Battling::Creature::GetTypes() const {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef CREATURELIB_SCRIPTCATEGORY_HPP
|
||||||
|
#define CREATURELIB_SCRIPTCATEGORY_HPP
|
||||||
|
|
||||||
|
ENUM(ScriptCategory, uint8_t, Attack, Talent, Status, Creature, Battle, Side)
|
||||||
|
|
||||||
|
#endif // CREATURELIB_SCRIPTCATEGORY_HPP
|
|
@ -4,6 +4,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../../Core/Enum.hpp"
|
#include "../../Core/Enum.hpp"
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
|
#include "ScriptCategory.hpp"
|
||||||
|
|
||||||
namespace CreatureLib::Battling {
|
namespace CreatureLib::Battling {
|
||||||
class BattleLibrary;
|
class BattleLibrary;
|
||||||
|
@ -12,8 +13,6 @@ namespace CreatureLib::Battling {
|
||||||
public:
|
public:
|
||||||
virtual ~ScriptResolver() = default;
|
virtual ~ScriptResolver() = default;
|
||||||
|
|
||||||
ENUM(ScriptCategory, uint8_t, Attack, Talent, Status, Creature, Battle, Side)
|
|
||||||
|
|
||||||
virtual void Initialize(BattleLibrary* library){};
|
virtual void Initialize(BattleLibrary* library){};
|
||||||
virtual Script* LoadScript(ScriptCategory category, const std::string& scriptName) { return nullptr; };
|
virtual Script* LoadScript(ScriptCategory category, const std::string& scriptName) { return nullptr; };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue