Improve 3167 patch

This commit is contained in:
auria.mg
2018-03-31 21:03:56 -04:00
parent 9fe4e2c30e
commit 9250e66ff2

View File

@@ -66,66 +66,45 @@ void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
m_on_road ? test_nodes : NULL, ignore_vertical);
m_on_road = m_current_graph_node != Graph::UNKNOWN_SECTOR;
bool isValidQuad = true;
// If m_track_sector == UNKNOWN_SECTOR, then the kart is not on top of
// the road, so we have to use search for the closest graph node.
if(m_current_graph_node == Graph::UNKNOWN_SECTOR)
if (m_current_graph_node == Graph::UNKNOWN_SECTOR)
{
m_current_graph_node = Graph::get()->findOutOfRoadSector(xyz,
prev_sector, test_nodes, ignore_vertical);
}
// keep the current quad as the latest valid one IF the player has one
// of the required checklines
const DriveNode* dn = DriveGraph::get()->getNode(m_current_graph_node);
const std::vector<int>& checkline_requirements = dn->getChecklineRequirements();
// ArenaGraph (battle and soccer mode) doesn't need the code below
if (ag) return;
isValidQuad = false;
for (unsigned int i = 0; i<checkline_requirements.size(); i++)
// keep the current quad as the latest valid one IF the player has one
// of the required checklines
const DriveNode* dn = DriveGraph::get()->getNode(m_current_graph_node);
const std::vector<int>& checkline_requirements = dn->getChecklineRequirements();
bool isValidQuad = false;
if (checkline_requirements.size() == 0)
{
isValidQuad = true;
if (m_on_road)
m_last_valid_graph_node = m_current_graph_node;
}
else
{
for (unsigned int i=0; i<checkline_requirements.size(); i++)
{
if (m_last_triggered_checkline == checkline_requirements[i])
{
//has_prerequisite = true;
m_last_valid_graph_node = m_current_graph_node;
if (m_on_road)
m_last_valid_graph_node = m_current_graph_node;
isValidQuad = true;
break;
}
}
// ArenaGraph (battle and soccer mode) doesn't need the code below
if (ag) return;
}
else
{
if (ag) return;
// keep the current quad as the latest valid one IF the player has one
// of the required checklines
const DriveNode* dn = DriveGraph::get()->getNode(m_current_graph_node);
const std::vector<int>& checkline_requirements = dn->getChecklineRequirements();
// TODO: show a message when we detect a user cheated.
if (checkline_requirements.size() == 0)
{
m_last_valid_graph_node = m_current_graph_node;
}
else
{
//bool has_prerequisite = false;
isValidQuad = false;
for (unsigned int i=0; i<checkline_requirements.size(); i++)
{
if (m_last_triggered_checkline == checkline_requirements[i])
{
//has_prerequisite = true;
m_last_valid_graph_node = m_current_graph_node;
isValidQuad = true;
break;
}
}
// TODO: show a message when we detect a user cheated.
}
}
// Now determine the 'track' coords, i.e. ow far from the start of the