Implemented better script handling.

This commit is contained in:
2019-11-09 12:15:45 +01:00
parent c3bfbb569e
commit ee14efe22e
7 changed files with 121 additions and 15 deletions

View File

@@ -9,12 +9,6 @@ namespace CreatureLib::Battling{
class ScriptSet{
std::unordered_map<std::string, Script*> _scripts;
public:
void Execute(Hook hook, const std::vector<std::any>& args){
for (auto s: _scripts){
s.second->Execute(hook, args);
}
}
void Add(Script* script){
auto f = _scripts.find(script->GetName());
if (f != _scripts.end()){
@@ -28,6 +22,14 @@ namespace CreatureLib::Battling{
void Remove(const std::string& key){
_scripts.erase(key);
}
size_t Count() const{
return _scripts.size();
}
std::unordered_map<std::string, Script *> * GetIterator(){
return &_scripts;
}
};
}