1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2009-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
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.
22 #include "utils/no_copy.hpp"
24 #include <assert.h>
25 #include <string>
26 #include <vector>
28 class AbstractKart;
29 class CheckStructure;
30 class Flyable;
31 class Track;
32 class XMLNode;
33 class Vec3;
39 class CheckManager : public NoCopy
40 {
41 private:
42  std::vector<CheckStructure*> m_all_checks;
43 public:
44  ~CheckManager();
45  void add(CheckStructure* strct) { m_all_checks.push_back(strct); }
46  void addFlyableToCannons(Flyable *flyable);
47  void removeFlyableFromCannons(Flyable *flyable);
48  void load(const XMLNode &node);
49  void update(float dt);
50  void reset(const Track &track);
51  void resetAfterKartMove(AbstractKart *kart);
52  void resetAfterRewind();
53  unsigned int getLapLineIndex() const;
54  int getChecklineTriggering(const Vec3 &from, const Vec3 &to) const;
55  // ------------------------------------------------------------------------
57  unsigned int getCheckStructureCount() const
58  { return (unsigned int) m_all_checks.size(); }
59  // ------------------------------------------------------------------------
61  CheckStructure *getCheckStructure(unsigned int n) const
62  {
63  assert(n < m_all_checks.size());
64  return m_all_checks[n];
65  }
66 }; // CheckManager
68 #endif
void removeFlyableFromCannons(Flyable *flyable)
Removes a flyable from all cannons.
Definition: check_manager.cpp:166
CheckStructure * getCheckStructure(unsigned int n) const
Returns the nth.
Definition: check_manager.hpp:61
A wrapper around bullets btVector3 to include conventient conversion functions (e.g.
Definition: vec3.hpp:34
void resetAfterKartMove(AbstractKart *kart)
Called after a kart is moved (e.g.
Definition: check_manager.cpp:125
unsigned int getLapLineIndex() const
Returns the index of the first check structures that triggers a new lap to be counted.
Definition: check_manager.cpp:192
Private destructor (to make sure it is only called using the static destroy function).
Definition: check_manager.cpp:101
unsigned int getCheckStructureCount() const
Returns the number of check structures defined.
Definition: check_manager.hpp:57
void addFlyableToCannons(Flyable *flyable)
Adds a flyable object to be tested against cannons.
Definition: check_manager.cpp:151
Controls all checks structures of a track.
Definition: check_manager.hpp:39
void update(float dt)
Updates all animations.
Definition: check_manager.cpp:181
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:25
void load(const XMLNode &node)
Loads all check structure informaiton from the specified xml file.
Definition: check_manager.cpp:38
void reset(const Track &track)
Resets all checks.
Definition: check_manager.cpp:112
Definition: script_track.cpp:52
utility class used to parse XML files
Definition: xml_node.hpp:47
Virtual base class for a check structure.
Definition: check_structure.hpp:51
Definition: flyable.hpp:48
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:61
int getChecklineTriggering(const Vec3 &from, const Vec3 &to) const
Returns the check line index that is triggered when going from &#39;from&#39; to &#39;to&#39;.
Definition: check_manager.cpp:219