- name = document->GetAttributeValue("name");
- type = document->GetAttributeValue("type");
- SetType(type);
- if (!document->GetAttributeValue("port").empty() && type == string("SOCKET")) {
- port = atoi(document->GetAttributeValue("port").c_str());
- socket = new FGfdmSocket(name, port);
- } else if (!document->GetAttributeValue("port").empty() && type == string("FLIGHTGEAR")) {
- port = atoi(document->GetAttributeValue("port").c_str());
- if (!document->GetAttributeValue("protocol").empty())
- protocol = document->GetAttributeValue("protocol");
- if (protocol == "udp")
- flightGearSocket = new FGfdmSocket(name, port, FGfdmSocket::ptUDP); // create udp socket
- else
- flightGearSocket = new FGfdmSocket(name, port, FGfdmSocket::ptTCP); // create tcp socket (default)
+ if (!document) return false;
+
+ name = FDMExec->GetRootDir() + document->GetAttributeValue("name");
+ SetType(document->GetAttributeValue("type"));
+ Port = document->GetAttributeValue("port");
+ if (!Port.empty() && (Type == otSocket || Type == otFlightGear)) {
+ port = atoi(Port.c_str());
+ SetProtocol(document->GetAttributeValue("protocol"));
+ socket = new FGfdmSocket(name, port, Protocol);