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