39     template<
typename WagonType>
 
   48     template<
typename WagonType>
 
   65     void moveWagon(
unsigned int wagonPos, 
unsigned int targetPos);
 
  101     unsigned int size() 
const;
 
  129     std::vector<std::unique_ptr<AbstractWagon>> 
m_wagons;
 
~Train()
Definition: train.cpp:29
void addWagon()
Adds a wagon of the given WagonType to the end of the train. 
Definition: train.hpp:16
unsigned int size() const 
Returns the number of wagons in this train. 
Definition: train.cpp:137
void setVelocity(float velocity)
Definition: train.cpp:112
float m_velocity
Definition: train.h:133
AbstractPlayer * m_player
A pointer to the player that controls this train. 
Definition: train.h:145
Train(World &world, Track *track)
Definition: train.cpp:17
virtual void doForAllChildren(std::function< void(AbstractGraphicsObject &)> callback) override
override this method to make child objects known 
Definition: train.cpp:173
void follow(Train *train)
Definition: train.cpp:102
float travelledDistance() const 
Returns the travelled distance of the train's head on the spline. 
Definition: train.cpp:117
void setPlayer(AbstractPlayer *player)
Definition: train.cpp:142
bool m_hasEngine
Every train needs exactly one engine. 
Definition: train.h:131
AbstractWagon * wagonAt(unsigned int index) const 
Definition: train.cpp:87
void calculateWagonOffset()
Calculates offset for every wagon relative to train head. 
Definition: train.cpp:159
std::vector< std::unique_ptr< AbstractWagon > > m_wagons
The vector containing all wagons. 
Definition: train.h:129
AbstractPlayer & player() const 
Definition: train.cpp:148
The AbstractGraphicsObject class is the root of a class hierarchy of objects that contain independen ...
Definition: abstractgraphicsobject.h:27
void insertWagon(int targetPos)
Inserts a wagon of the given WagonType at the given position. 
Definition: train.hpp:22
float m_travelledDistance
Definition: train.h:136
QVector3D headPosition() const 
Definition: train.cpp:132
Train * m_followedTrain
Definition: train.h:134
Track * m_track
Definition: train.h:137
The World class represents a running game instance and contains all graphical (3D) elements of the sc...
Definition: world.h:46
void moveWagon(unsigned int wagonPos, unsigned int targetPos)
Moves the wagon at position wagonPos to position targetPos. 
Definition: train.cpp:44
virtual bool localRenderEnabled() const override
override this method to disable or enable rendering conditionally 
Definition: train.cpp:154
float travelledDistanceRelative() const 
Returns the ratio of travelled distance to track length. 
Definition: train.cpp:127
Definition: eventhandler.cpp:18
Track * track() const 
Definition: train.cpp:97
float velocity() const 
Definition: train.cpp:108
The AbstractWagon class provides a common interface for all wagon types and contains common functiona...
Definition: abstractwagon.h:25
void removeWagon(unsigned int index)
Removes the wagon at the given index. 
Definition: train.cpp:34
The Track class represents a track that a Train moves on. It is currently not rendered. The course is represented by a Polyline instance. 
Definition: track.h:16
void setTravelledDistance(float travelledDistance)
Set the travelled distance of the train's head on the spline. 
Definition: train.cpp:122
The AbstractPlayer class is the base class for interacting with a train and a camera. 
Definition: abstractplayer.h:21
void localUpdate() override
Update train. 
Definition: train.cpp:70
The Train class works as a logical container for all wagons one train consists of. 
Definition: train.h:25
static const float base_velocity
Definition: train.h:28