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;
51 std::vector<float> bogie_dirs;
52 unsigned front_sensor;
56 Vehicle(Layout &, const VehicleType &);
59 const VehicleType &get_type() const { return type; }
61 void attach_back(Vehicle &);
62 void attach_front(Vehicle &);
65 Vehicle *get_next() const { return next; }
66 Vehicle *get_previous() const { return prev; }
68 void place(Track *, unsigned, float, PlaceMode = CENTER);
70 Track *get_track() const { return track_pos.track; }
71 unsigned get_entry() const { return track_pos.ep; }
72 float get_offset() const { return track_pos.offs; }
73 const Point &get_position() const { return position; }
74 float get_direction() const { return direction; }
75 float get_bogie_direction(unsigned) const;
77 void update_position();
78 void update_position_from(const Vehicle &);
79 void propagate_position();
80 void propagate_forward();
81 void propagate_backward();
82 void check_sensor(float, unsigned &);
84 void adjust_for_distance(TrackPosition &, TrackPosition &, float, float = 0.5) const;
85 TrackPoint get_point(const Point &, const Point &, float = 0.5) const;
86 TrackPoint get_point(const TrackPosition &, float, float = 0.5) const;
89 } // namespace Marklin