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);
71 Track *get_track() const { return track_pos.track; }
72 unsigned get_entry() const { return track_pos.ep; }
73 float get_offset() const { return track_pos.offs; }
74 const Point &get_position() const { return position; }
75 float get_direction() const { return direction; }
76 float get_bogie_direction(unsigned) const;
78 void update_position();
79 void update_position_from(const Vehicle &);
80 void propagate_position();
81 void propagate_forward();
82 void propagate_backward();
83 void check_sensor(float, unsigned &);
85 void adjust_for_distance(TrackPosition &, TrackPosition &, float, float = 0.5) const;
86 TrackPoint get_point(const Point &, const Point &, float = 0.5) const;
87 TrackPoint get_point(const TrackPosition &, float, float = 0.5) const;
90 } // namespace Marklin