2019-11-08 17:45:43 +00:00
|
|
|
#ifndef CREATURELIB_SCRIPTSET_HPP
|
|
|
|
#define CREATURELIB_SCRIPTSET_HPP
|
|
|
|
|
|
|
|
#include <any>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "Script.hpp"
|
|
|
|
|
|
|
|
namespace CreatureLib::Battling{
|
|
|
|
class ScriptSet{
|
|
|
|
std::unordered_map<std::string, Script*> _scripts;
|
|
|
|
public:
|
|
|
|
void Add(Script* script){
|
|
|
|
auto f = _scripts.find(script->GetName());
|
|
|
|
if (f != _scripts.end()){
|
|
|
|
f->second->Stack();
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
_scripts.insert({script->GetName(), script});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Remove(const std::string& key){
|
|
|
|
_scripts.erase(key);
|
|
|
|
}
|
2019-11-09 11:15:45 +00:00
|
|
|
|
|
|
|
size_t Count() const{
|
|
|
|
return _scripts.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unordered_map<std::string, Script *> * GetIterator(){
|
|
|
|
return &_scripts;
|
|
|
|
}
|
2019-11-08 17:45:43 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //CREATURELIB_SCRIPTSET_HPP
|