Implemented better script handling.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user