Improve performance for findOutOfRoadSector on ArenaGraph
This commit is contained in:
parent
3c24c73faa
commit
62dfef1fb9
@ -52,18 +52,18 @@ void TrackSector::reset()
|
|||||||
void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
|
void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
|
||||||
{
|
{
|
||||||
int prev_sector = m_current_graph_node;
|
int prev_sector = m_current_graph_node;
|
||||||
|
|
||||||
const ArenaGraph* ag = ArenaGraph::get();
|
const ArenaGraph* ag = ArenaGraph::get();
|
||||||
std::vector<int>* test_nodes = NULL;
|
std::vector<int>* test_nodes = NULL;
|
||||||
if (ag && m_on_road && prev_sector != Graph::UNKNOWN_SECTOR)
|
|
||||||
|
if (ag && prev_sector != Graph::UNKNOWN_SECTOR)
|
||||||
{
|
{
|
||||||
// For ArenaGraph, only test nodes around current node if previously
|
// For ArenaGraph, only test nodes around current node
|
||||||
// is on road
|
|
||||||
test_nodes = ag->getNode(prev_sector)->getNearbyNodes();
|
test_nodes = ag->getNode(prev_sector)->getNearbyNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph::get()->findRoadSector(xyz, &m_current_graph_node, test_nodes,
|
// Don't only test nodes around if it was not on road
|
||||||
ignore_vertical);
|
Graph::get()->findRoadSector(xyz, &m_current_graph_node,
|
||||||
|
m_on_road ? test_nodes : NULL, ignore_vertical);
|
||||||
m_on_road = m_current_graph_node != Graph::UNKNOWN_SECTOR;
|
m_on_road = m_current_graph_node != Graph::UNKNOWN_SECTOR;
|
||||||
|
|
||||||
// If m_track_sector == UNKNOWN_SECTOR, then the kart is not on top of
|
// If m_track_sector == UNKNOWN_SECTOR, then the kart is not on top of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user