SuperTuxKart
Loading...
Searching...
No Matches
check_manager.hpp
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
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_MANAGER_HPP
20#define HEADER_CHECK_MANAGER_HPP
21
22#include "utils/no_copy.hpp"
23
24#include <assert.h>
25#include <string>
26#include <vector>
27
28class AbstractKart;
29class CheckStructure;
30class Flyable;
31class Track;
32class XMLNode;
33class Vec3;
34
39class CheckManager : public NoCopy
40{
41private:
42 std::vector<CheckStructure*> m_all_checks;
43public:
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);
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
67
68#endif
69
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Controls all checks structures of a track.
Definition: check_manager.hpp:40
void update(float dt)
Updates all animations.
Definition: check_manager.cpp:181
CheckStructure * getCheckStructure(unsigned int n) const
Returns the nth.
Definition: check_manager.hpp:61
void addFlyableToCannons(Flyable *flyable)
Adds a flyable object to be tested against cannons.
Definition: check_manager.cpp:151
~CheckManager()
Private destructor (to make sure it is only called using the static destroy function).
Definition: check_manager.cpp:101
void load(const XMLNode &node)
Loads all check structure informaiton from the specified xml file.
Definition: check_manager.cpp:38
unsigned int getCheckStructureCount() const
Returns the number of check structures defined.
Definition: check_manager.hpp:57
int getChecklineTriggering(const Vec3 &from, const Vec3 &to) const
Returns the check line index that is triggered when going from 'from' to 'to'.
Definition: check_manager.cpp:219
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
void resetAfterKartMove(AbstractKart *kart)
Called after a kart is moved (e.g.
Definition: check_manager.cpp:125
void reset(const Track &track)
Resets all checks.
Definition: check_manager.cpp:112
void removeFlyableFromCannons(Flyable *flyable)
Removes a flyable from all cannons.
Definition: check_manager.cpp:166
Virtual base class for a check structure.
Definition: check_structure.hpp:52
Definition: flyable.hpp:50
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: track.hpp:114
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48