Used ClangFormat style guide I'm happy with.
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:
@@ -5,14 +5,15 @@
|
||||
#include <unordered_map>
|
||||
#include "Script.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
class ScriptSet{
|
||||
namespace CreatureLib::Battling {
|
||||
class ScriptSet {
|
||||
std::vector<Script*> _scripts;
|
||||
std::unordered_map<std::string, size_t> _lookup;
|
||||
|
||||
public:
|
||||
void Add(Script* script){
|
||||
void Add(Script* script) {
|
||||
auto f = _lookup.find(script->GetName());
|
||||
if (f != _lookup.end()){
|
||||
if (f != _lookup.end()) {
|
||||
_scripts[f.operator*().second]->Stack();
|
||||
return;
|
||||
}
|
||||
@@ -20,22 +21,18 @@ namespace CreatureLib::Battling{
|
||||
_lookup.insert({script->GetName(), _scripts.size() - 1});
|
||||
}
|
||||
|
||||
void Remove(const std::string& key){
|
||||
void Remove(const std::string& key) {
|
||||
auto find = _lookup.find(key);
|
||||
if (find != _lookup.end()){
|
||||
if (find != _lookup.end()) {
|
||||
_scripts.erase(_scripts.begin() + find.operator*().second);
|
||||
_lookup.erase(key);
|
||||
}
|
||||
}
|
||||
|
||||
size_t Count() const{
|
||||
return _scripts.size();
|
||||
}
|
||||
size_t Count() const { return _scripts.size(); }
|
||||
|
||||
const std::vector<Script *> * GetIterator() const{
|
||||
return &_scripts;
|
||||
}
|
||||
const std::vector<Script*>* GetIterator() const { return &_scripts; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif //CREATURELIB_SCRIPTSET_HPP
|
||||
#endif // CREATURELIB_SCRIPTSET_HPP
|
||||
|
||||
Reference in New Issue
Block a user