Files
CreatureLib/src/Library/TypeLibrary.hpp
Deukhoofd 4d3dc28606
All checks were successful
continuous-integration/drone/push Build is passing
Allow most libraries to reserve capacity for their database.
2019-12-31 10:48:52 +01:00

25 lines
852 B
C++

#ifndef CREATURELIB_TYPELIBRARY_HPP
#define CREATURELIB_TYPELIBRARY_HPP
#include <unordered_map>
#include <vector>
namespace CreatureLib::Library {
class TypeLibrary {
std::unordered_map<std::string, uint8_t> _types;
std::vector<std::vector<float>> _effectiveness;
public:
TypeLibrary(size_t initialCapacity = 20) : _types(std::unordered_map<std::string, uint8_t>(initialCapacity)) {}
uint8_t GetTypeId(const std::string& s) const;
float GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const;
float GetEffectiveness(uint8_t attacking, const std::vector<uint8_t>& defensive) const;
uint8_t RegisterType(const std::string& typeName);
void SetEffectiveness(uint8_t attacking, uint8_t defensive, float effectiveness);
};
}
#endif // CREATURELIB_TYPELIBRARY_HPP