- map<unsigned, NetTrain *>::const_iterator i = trains.find(addr);
- if(i==trains.end())
- throw KeyError("Unknown train");
- return *i->second;
+ return *get_item(trains, addr);
+}
+
+void Client::receive(const DriverStatePacket &pkt)
+{
+ if(pkt.power!=power)
+ {
+ power = pkt.power;
+ signal_power_changed.emit(power);
+ }
+ if(pkt.halt!=halt)
+ {
+ halt = pkt.halt;
+ signal_halt_changed.emit(halt);
+ }
+}
+
+void Client::receive(const EmergencyPacket &pkt)
+{
+ signal_emergency.emit(pkt.message);