#include <sigc++/trackable.h>
#include <msp/time/timestamp.h>
#include "block.h"
+#include "controller.h"
namespace Marklin {
-class ControlModel;
class Route;
class Timetable;
class Vehicle;
unsigned address;
std::string name;
int priority;
+ const Train *yielding_to;
std::vector<Vehicle *> vehicles;
std::list<BlockRef> cur_blocks;
std::list<BlockRef> rsv_blocks;
Block *pending_block;
- ControlModel *control;
+ bool reserving;
+ bool advancing;
+ Controller *controller;
Timetable *timetable;
bool active;
unsigned current_speed;
void set_name(const std::string &);
const std::string &get_name() const { return name; }
void set_priority(int);
+ void yield_to(const Train &);
int get_priority() const { return priority; }
- ControlModel &get_control() const { return *control; }
+ Controller &get_controller() const { return *controller; }
void add_vehicle(const VehicleType &);
void remove_vehicle(unsigned);
void set_active(bool);
void set_function(unsigned, bool);
float get_control(const std::string &) const;
+ float get_speed() const;
bool is_active() const { return active; }
bool get_function(unsigned) const;
unsigned get_functions() const { return functions; }
void go_to(const Track &);
const Route *get_route() const { return route; }
void place(Block &, unsigned);
+ void unplace();
bool is_placed() const { return !cur_blocks.empty(); }
bool free_block(Block &);
int get_entry_to_block(Block &) const;
void save(std::list<Msp::DataFile::Statement> &) const;
private:
+ void control_changed(const Controller::Control &);
void loco_speed_event(unsigned, unsigned, bool);
void loco_func_event(unsigned, unsigned, bool);
void sensor_event(unsigned, bool);
void halt_event(bool);
void block_reserved(const Block &, const Train *);
unsigned reserve_more();
+ float get_reserved_distance_until(const Block *, bool) const;
float get_real_speed(unsigned) const;
unsigned find_speed(float) const;
float get_travel_speed() const;