More tweaks to improved rescue, plus as a bonus use the additional info we now have to let users know when they missed a checkline
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9809 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d8a5d710e9
commit
1f19560a29
@ -137,6 +137,16 @@ public:
|
||||
* \param kart_index Index of the kart. */
|
||||
bool isOnRoad(unsigned int kart_index) const
|
||||
{ return m_kart_info[kart_index].getSector()->isOnRoad(); }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
int getKartLap(unsigned int kart_index) const
|
||||
{
|
||||
if (kart_index >= 0 && kart_index < m_kart_info.size())
|
||||
return m_kart_info[kart_index].m_race_lap;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
}; // LinearWorld
|
||||
|
||||
#endif
|
||||
|
@ -81,7 +81,7 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, int indx)
|
||||
CheckManager* cm = World::getWorld()->getTrack()->getCheckManager();
|
||||
for (int n=0; n<cm->getCheckStructureCount(); n++)
|
||||
{
|
||||
cm->getCheckStructure(n)->resetVisits();
|
||||
cm->getCheckStructure(n)->resetVisitsFor(indx);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -129,12 +129,9 @@ public:
|
||||
return m_was_visited[kart_id];
|
||||
}
|
||||
|
||||
void resetVisits()
|
||||
void resetVisitsFor(unsigned int kart_index)
|
||||
{
|
||||
for (unsigned int n=0; n<m_was_visited.size(); n++)
|
||||
{
|
||||
m_was_visited[n] = false;
|
||||
}
|
||||
m_was_visited[kart_index] = false;
|
||||
}
|
||||
|
||||
}; // CheckStructure
|
||||
|
@ -17,6 +17,7 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/check_manager.hpp"
|
||||
#include "tracks/check_structure.hpp"
|
||||
@ -75,7 +76,8 @@ void TrackSector::update(const Vec3 &xyz, Kart* kart, Track* track)
|
||||
}
|
||||
else
|
||||
{
|
||||
// keep the current quad as the latest valid one IF the player has one of the required checklines
|
||||
// keep the current quad as the latest valid one IF the player has one
|
||||
// of the required checklines
|
||||
const std::vector<int>& checkline_requirements =
|
||||
QuadGraph::get()->getNode(m_current_graph_node).getChecklineRequirements();
|
||||
|
||||
@ -95,14 +97,18 @@ void TrackSector::update(const Vec3 &xyz, Kart* kart, Track* track)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool has_prerequisite = false;
|
||||
|
||||
for (unsigned int i=0; i<checkline_requirements.size(); i++)
|
||||
{
|
||||
//for (int k=0; k<cm->getCheckStructureCount(); k++)
|
||||
// printf(" Check %i visited : %i\n", k, cm->getCheckStructure(k)->wasVisitedForKart(kart_id));
|
||||
// printf(" Check %i visited : %i\n", k,
|
||||
// cm->getCheckStructure(k)->wasVisitedForKart(kart_id));
|
||||
|
||||
if (checkline_requirements[i] < (int)count &&
|
||||
cm->getCheckStructure(checkline_requirements[i])->wasVisitedForKart(kart_id))
|
||||
{
|
||||
has_prerequisite = true;
|
||||
//if (m_last_valid_graph_node != m_current_graph_node)
|
||||
// printf("[2] m_last_valid_graph_node : %i\n", m_last_valid_graph_node);
|
||||
|
||||
@ -110,6 +116,19 @@ void TrackSector::update(const Vec3 &xyz, Kart* kart, Track* track)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_prerequisite)
|
||||
{
|
||||
World* w = World::getWorld();
|
||||
if (dynamic_cast<LinearWorld*>(w) != NULL &&
|
||||
dynamic_cast<LinearWorld*>(w)->getKartLap(kart_id) > -1)
|
||||
{
|
||||
RaceGUIBase* race_gui = w->getRaceGUI();
|
||||
race_gui->addMessage(_("CHEATER!"), kart, -1.0f /* time */,
|
||||
video::SColor(255,255,255,255), true /* important */,
|
||||
true /* big font */);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user