Fix unknown sector in arena after rescue

This commit is contained in:
Benau 2016-09-30 08:15:36 +08:00
parent c22714951c
commit 3c24c73faa

View File

@ -55,11 +55,11 @@ void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
const ArenaGraph* ag = ArenaGraph::get();
std::vector<int>* test_nodes = NULL;
if (ag)
if (ag && m_on_road && prev_sector != Graph::UNKNOWN_SECTOR)
{
// For ArenaGraph, only test nodes around current node
if (prev_sector != Graph::UNKNOWN_SECTOR)
test_nodes = ag->getNode(prev_sector)->getNearbyNodes();
// For ArenaGraph, only test nodes around current node if previously
// is on road
test_nodes = ag->getNode(prev_sector)->getNearbyNodes();
}
Graph::get()->findRoadSector(xyz, &m_current_graph_node, test_nodes,