-/* $Id$
-
-This file is part of R²C²
-Copyright © 2009-2011 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include <msp/net/inet.h>
#include "libr2c2/driver.h"
#include "libr2c2/route.h"
pkt.loco_type = train.get_locomotive_type().get_article_number().str();
pkt.name = train.get_name();
send(pkt);
+
+ TrainStatus *status = new TrainStatus(train);
+ status->set_tag("server:status");
+ status->signal_changed.connect(sigc::bind<0>(sigc::mem_fun(this, &Server::train_status_changed), sigc::ref(train)));
}
void Server::train_control_changed(const Train &train, const string &control, float value)
pkt.functions = train.get_functions();
comm.send(pkt);
}
+ if(TrainStatus *status = dynamic_cast<TrainStatus *>(train.get_tagged_ai("server:status")))
{
TrainStatusPacket pkt;
pkt.address = train.get_address();
- pkt.status = train.get_status();
+ pkt.status = status->get_status();
comm.send(pkt);
}
if(train.get_route())