From 925763752f7465f7c042481f1ab11f2aca240431 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 8 Feb 2020 14:52:45 +0100 Subject: [PATCH] Add function to set variants for a species, and a function to get the count of species in a species library. --- src/Library/CreatureData/CreatureSpecies.hpp | 2 ++ src/Library/SpeciesLibrary.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Library/CreatureData/CreatureSpecies.hpp b/src/Library/CreatureData/CreatureSpecies.hpp index ea362c2..09d9e33 100644 --- a/src/Library/CreatureData/CreatureSpecies.hpp +++ b/src/Library/CreatureData/CreatureSpecies.hpp @@ -39,6 +39,8 @@ namespace CreatureLib::Library { [[nodiscard]] const SpeciesVariant* GetVariant(const std::string& key) const; [[nodiscard]] Gender GetRandomGender(Core::Random& rand) const; [[nodiscard]] const std::string& GetName() const; + + void SetVariant(const std::string& name, const SpeciesVariant* variant) { _variants[name] = variant; } }; } diff --git a/src/Library/SpeciesLibrary.hpp b/src/Library/SpeciesLibrary.hpp index ebaf13f..9d95686 100644 --- a/src/Library/SpeciesLibrary.hpp +++ b/src/Library/SpeciesLibrary.hpp @@ -26,6 +26,8 @@ namespace CreatureLib::Library { void LoadSpecies(const std::string& name, const CreatureSpecies* species); void DeleteSpecies(const std::string& name); + + size_t GetCount() const { return _species.count(); } }; }