-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#ifndef LIBR2C2_TIMETABLE_H_
#define LIBR2C2_TIMETABLE_H_
#include <vector>
#include <sigc++/trackable.h>
#include <msp/datafile/objectloader.h>
-#include <msp/time/timestamp.h>
+#include "block.h"
+#include "trainai.h"
namespace R2C2 {
-class Block;
class Track;
class Train;
class Zone;
-class Timetable: public sigc::trackable
+class Timetable: public TrainAI, public sigc::trackable
{
public:
class Loader: public Msp::DataFile::ObjectLoader<Timetable>
};
private:
- Train &train;
bool enabled;
std::vector<Row> rows;
unsigned current_row;
unsigned get_n_rows() const { return rows.size(); }
const Row &get_row(unsigned) const;
- void tick(const Msp::Time::TimeStamp &);
+ void tick(const Msp::Time::TimeStamp &, const Msp::Time::TimeDelta &);
void save(std::list<Msp::DataFile::Statement> &) const;
private:
- Track &get_sensor(unsigned);
+ Block &get_sensor(unsigned);
Track &get_turnout(unsigned);
Zone &get_zone(const std::string &);
- void sensor_event(unsigned, bool);
+ void block_state_changed(Block &, Block::State);
void block_reserved(Block &, Train *);
void train_advanced(Block &);
- void train_arrived();
+ void event(TrainAI &, const Message &);
};
} // namespace R2C2