/* $Id$
-This file is part of the MSP Märklin suite
+This file is part of R²C²
Copyright © 2009-2010 Mikkosoft Productions, Mikko Rasa
Distributed under the GPL
*/
#include <msp/net/inet.h>
-#include "libmarklin/locotype.h"
-#include "libmarklin/route.h"
-#include "libmarklin/train.h"
+#include "libr2c2/route.h"
+#include "libr2c2/train.h"
+#include "libr2c2/vehicletype.h"
#include "server.h"
using namespace std;
using namespace Msp;
-namespace Marklin {
+namespace R2C2 {
Server::Server(Layout &l):
layout(l),
TrainInfoPacket pkt;
pkt.address = train.get_address();
- pkt.loco_type = train.get_locomotive_type().get_article_number();
+ pkt.loco_type = train.get_locomotive_type().get_article_number().str();
pkt.name = train.get_name();
send(pkt);
}
void Server::Connection::handshake_done()
{
- const map<string, Route *> &routes = server.layout.get_routes();
- for(map<string, Route *>::const_iterator i=routes.begin(); i!=routes.end(); ++i)
+ const set<Route *> &routes = server.layout.get_routes();
+ for(set<Route *>::const_iterator i=routes.begin(); i!=routes.end(); ++i)
{
RouteInfoPacket pkt;
- pkt.name = i->first;
+ pkt.name = (*i)->get_name();
comm.send(pkt);
}
{
TrainInfoPacket pkt;
pkt.address = train.get_address();
- pkt.loco_type = train.get_locomotive_type().get_article_number();
+ pkt.loco_type = train.get_locomotive_type().get_article_number().str();
pkt.name = train.get_name();
comm.send(pkt);
}
comm.send(pkt);
}
-} // namespace Marklin
+} // namespace R2C2