Fix build on Linux.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-11-11 20:04:59 +01:00
parent 859cd02478
commit cdd1ac992f
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 7 additions and 9 deletions

View File

@ -10,19 +10,17 @@
namespace CreatureLib::Battling{ namespace CreatureLib::Battling{
class ScriptAggregator{ class ScriptAggregator{
__gnu_cxx::__normal_iterator<ScriptWrapper *, std::vector<ScriptWrapper>> _selfIterator; std::vector<ScriptWrapper> _scripts;
__gnu_cxx::__normal_iterator<ScriptWrapper *, std::vector<ScriptWrapper>> _selfEnd; int _index = 0;
bool _isSetSet = false; bool _isSetSet = false;
std::__detail::_Node_const_iterator<std::pair<const std::string, Script *>, false, true> _setIterator; std::__detail::_Node_const_iterator<std::pair<const std::string, Script *>, false, true> _setIterator;
std::__detail::_Node_const_iterator<std::pair<const std::string, Script *>, false, true> _setEnd; std::__detail::_Node_const_iterator<std::pair<const std::string, Script *>, false, true> _setEnd;
public: public:
ScriptAggregator(std::vector<ScriptWrapper> scripts){ ScriptAggregator(std::vector<ScriptWrapper> scripts) : _scripts(std::move(scripts)){
_selfIterator = scripts.begin();
_selfEnd = scripts.end();
}; };
bool HasNext(){ bool HasNext(){
return _selfIterator != _selfEnd || (_isSetSet && _setIterator != _setEnd); return _index < _scripts.size() || (_isSetSet && _setIterator != _setEnd);
} }
Script* GetNext(){ Script* GetNext(){
@ -39,10 +37,10 @@ namespace CreatureLib::Battling{
} }
return s; return s;
} }
if (_selfIterator == _selfEnd) if (_index >= _scripts.size())
return nullptr; return nullptr;
auto next = *_selfIterator; auto next = _scripts[_index];
_selfIterator++; _index++;
if (!next.IsSet()){ if (!next.IsSet()){
auto scriptPtr = next.GetScript(); auto scriptPtr = next.GetScript();
if (scriptPtr == nullptr) if (scriptPtr == nullptr)