Added functions for battle to manipulate volatile scripts.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -21,12 +21,21 @@ namespace CreatureLib::Battling {
|
||||
auto f = _lookup.find(script->GetName());
|
||||
if (f != _lookup.end()) {
|
||||
_scripts[f.operator*().second]->Stack();
|
||||
delete script;
|
||||
return;
|
||||
}
|
||||
_scripts.push_back(script);
|
||||
_lookup.insert({script->GetName(), _scripts.size() - 1});
|
||||
}
|
||||
|
||||
Script* Get(const std::string& key) const {
|
||||
auto f = _lookup.find(key);
|
||||
if (f != _lookup.end()) {
|
||||
return _scripts[f->second];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Remove(const std::string& key) {
|
||||
auto find = _lookup.find(key);
|
||||
if (find != _lookup.end()) {
|
||||
|
||||
Reference in New Issue
Block a user