3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_VEHICLE_H_
9 #define LIBMARKLIN_VEHICLE_H_
39 TrackPosition(Track *, unsigned, float);
41 TrackPoint get_point() const;
45 const VehicleType &type;
48 TrackPosition track_pos;
53 Vehicle(Layout &, const VehicleType &);
56 const VehicleType &get_type() const { return type; }
58 void attach_back(Vehicle &);
59 void attach_front(Vehicle &);
62 Vehicle *get_next() const { return next; }
63 Vehicle *get_previous() const { return prev; }
65 void place(Track *, unsigned, float, PlaceMode = CENTER);
67 Track *get_track() const { return track_pos.track; }
68 unsigned get_entry() const { return track_pos.ep; }
69 float get_offset() const { return track_pos.offs; }
70 const Point &get_position() const { return position; }
71 float get_direction() const { return direction; }
73 void update_position();
74 void update_position_from(const Vehicle &);
75 void propagate_position();
76 void propagate_forward();
77 void propagate_backward();
79 void adjust_for_distance(TrackPosition &, TrackPosition &, float, float = 0.5) const;
80 TrackPoint get_point(const Point &, const Point &, float = 0.5) const;
81 TrackPoint get_point(const TrackPosition &, float, float = 0.5) const;
84 } // namespace Marklin