CreatureLib/src/Library/AttackLibrary.hpp

31 lines
848 B
C++
Raw Normal View History

2019-10-06 11:50:52 +00:00
#ifndef CREATURELIB_ATTACKLIBRARY_HPP
#define CREATURELIB_ATTACKLIBRARY_HPP
#include <string>
#include <unordered_map>
#include "Attacks/AttackData.hpp"
namespace CreatureLib::Library {
class AttackLibrary {
private:
std::unordered_map<std::string, const AttackData*> _attacks;
public:
AttackLibrary() = default;
~AttackLibrary(){
2019-10-31 12:30:22 +00:00
for (auto attack: _attacks){
delete attack.second;
}
2019-10-06 11:50:52 +00:00
_attacks.clear();
}
[[nodiscard]] const AttackData* GetAttack(const std::string& name) const;
[[nodiscard]] const AttackData* operator[] (const std::string& name) const;
void LoadAttack(const std::string& name, const AttackData* attack);
void DeleteAttack(const std::string& name);
};
}
#endif //CREATURELIB_ATTACKLIBRARY_HPP