#include <sigc++/trackable.h>
#include <msp/time/timestamp.h>
#include "block.h"
+#include "blockiter.h"
#include "controller.h"
namespace Marklin {
sigc::signal<void, const std::string &> signal_status_changed;
private:
- struct BlockRef
- {
- Block *block;
- unsigned entry;
-
- BlockRef(Block *, unsigned);
- BlockRef next() const;
- };
-
struct RouteRef
{
const Route *route;
void add(float, float);
};
+ typedef std::list<BlockIter> BlockList;
+
Layout &layout;
const VehicleType &loco_type;
unsigned address;
int priority;
const Train *yielding_to;
std::vector<Vehicle *> vehicles;
- std::list<BlockRef> cur_blocks;
- std::list<BlockRef> rsv_blocks;
+ BlockList cur_blocks;
+ BlockList rsv_blocks;
Block *pending_block;
bool reserving;
bool advancing;
unsigned find_speed(float) const;
float get_travel_speed() const;
void set_status(const std::string &);
- void release_blocks(std::list<BlockRef> &);
- void release_blocks(std::list<BlockRef> &, std::list<BlockRef>::iterator, std::list<BlockRef>::iterator);
- void reverse_blocks(std::list<BlockRef> &) const;
+ void release_blocks(BlockList &);
+ void release_blocks(BlockList &, BlockList::iterator, BlockList::iterator);
+ void reverse_blocks(BlockList &) const;
bool advance_route(std::list<RouteRef>::iterator &, Track &);
Route *create_lead_route(Route *, const Route *);
bool is_valid_diversion(const Route &, Track &, unsigned);