1 //
2 //  SuperTuxKart - a fun racing game with go-kart
3 //  Copyright (C) 2010-2015  Joerg Henrichs
4 //
5 //  This program is free software; you can redistribute it and/or
6 //  modify it under the terms of the GNU General Public License
7 //  as published by the Free Software Foundation; either version 3
8 //  of the License, or (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 #ifndef HEADER_CHECK_LAP_HPP
20 #define HEADER_CHECK_LAP_HPP
21 
22 #include "tracks/check_structure.hpp"
23 #include "utils/cpp2011.hpp"
24 
25 class XMLNode;
26 class CheckManager;
27 
28 /**
29  *  \brief Implements a simple lap test. A new lap is detected
30  *  when the distance along the track reduces by a certain amount
31  *  of time.
32  * \ingroup tracks
33  */
34 class CheckLap : public CheckStructure
35 {
36 private:
37     /** Store the previous distance along track. */
38     std::vector<float> m_previous_distance;
39 
40 public:
41                  CheckLap(const XMLNode &node, unsigned int index);
~CheckLap()42     virtual     ~CheckLap() {};
43     virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
44                              int indx) OVERRIDE;
45     virtual void reset(const Track &track) OVERRIDE;
triggeringCheckline() const46     virtual bool triggeringCheckline() const OVERRIDE { return true; }
47     // ------------------------------------------------------------------------
clone()48     virtual CheckStructure* clone() OVERRIDE    { return new CheckLap(*this); }
49 };   // CheckLap
50 
51 #endif
52 
53