Permalink
Browse files

Workaround invalid nodes in saves

  • Loading branch information...
SupSuper committed Sep 9, 2018
1 parent bad6d71 commit 50c2cb7685995a76a8f6d99749b4952562502e21
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/Battlescape/AIModule.cpp
@@ -89,11 +89,12 @@ void AIModule::load(const YAML::Node &node)
toNodeID = node["toNode"].as<int>(-1);
_AIMode = node["AIMode"].as<int>(AI_PATROL);
_wasHitBy = node["wasHitBy"].as<std::vector<int> >(_wasHitBy);
if (fromNodeID != -1)
// TODO: Figure out why AI are sometimes left with junk nodes
if (fromNodeID >= 0 && fromNodeID < _save->getNodes()->size())
{
_fromNode = _save->getNodes()->at(fromNodeID);
}
if (toNodeID != -1)
if (toNodeID >= 0 && toNodeID < _save->getNodes()->size())
{
_toNode = _save->getNodes()->at(toNodeID);
}

0 comments on commit 50c2cb7

Please sign in to comment.