Remove display script hook functions, replace them with easy to use interface on Creature class.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-02-03 16:49:28 +01:00
parent 07700008f7
commit c4d0a73df6
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 16 additions and 12 deletions

View File

@ -148,13 +148,15 @@ void Battling::Creature::AddExperience(uint32_t amount) {
_experience = exp; _experience = exp;
_level = level; _level = level;
} }
const Library::CreatureSpecies* Battling::Creature::GetDisplaySpecies() { const Library::CreatureSpecies* Battling::Creature::GetDisplaySpecies() const {
auto species = _species; auto species = _displaySpecies;
HOOK(OverrideDisplaySpecies, this, this, &species); if (species == nullptr)
species = _species;
return species; return species;
} }
const Library::SpeciesVariant* Battling::Creature::GetDisplayVariant() { const Library::SpeciesVariant* Battling::Creature::GetDisplayVariant() const {
auto variant = _variant; auto variant = _displayVariant;
HOOK(OverrideDisplayVariant, this, this, &variant); if (variant == nullptr)
variant = _variant;
return variant; return variant;
} }

View File

@ -22,6 +22,9 @@ namespace CreatureLib::Battling {
const Library::CreatureSpecies* _species; const Library::CreatureSpecies* _species;
const Library::SpeciesVariant* _variant; const Library::SpeciesVariant* _variant;
const Library::CreatureSpecies* _displaySpecies = nullptr;
const Library::SpeciesVariant* _displayVariant = nullptr;
uint8_t _level; uint8_t _level;
uint32_t _experience; uint32_t _experience;
uint32_t _uniqueIdentifier; uint32_t _uniqueIdentifier;
@ -106,8 +109,11 @@ namespace CreatureLib::Battling {
std::vector<LearnedAttack*>& GetAttacks() { return _attacks; } std::vector<LearnedAttack*>& GetAttacks() { return _attacks; }
const Library::CreatureSpecies* GetDisplaySpecies(); const Library::CreatureSpecies* GetDisplaySpecies() const;
const Library::SpeciesVariant* GetDisplayVariant(); const Library::SpeciesVariant* GetDisplayVariant() const;
const void SetDisplaySpecies(Library::CreatureSpecies* species) { _displaySpecies = species; }
const void SetDisplayVariant(Library::SpeciesVariant* variant) { _displayVariant = variant; };
// region Stat APIs // region Stat APIs

View File

@ -25,10 +25,6 @@ namespace CreatureLib::Battling {
const std::string& GetName() { return _name; } const std::string& GetName() { return _name; }
virtual void OverrideDisplaySpecies(Creature* creature,
const CreatureLib::Library::CreatureSpecies** species){};
virtual void OverrideDisplayVariant(Creature* creature, const CreatureLib::Library::SpeciesVariant** variant){};
virtual void OnBeforeTurn(const BaseTurnChoice* choice){}; virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){}; virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){};