From: durk Date: Sat, 19 Apr 2008 10:42:06 +0000 (+0000) Subject: Small patch that prevents displaying a "local echo" of one's own aircraft X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9416c13477e3ee69cc447fe5be8aab44814b7458;p=flightgear.git Small patch that prevents displaying a "local echo" of one's own aircraft under some circumstances. The history of this patch is somewhat unclear, but was brought to my attention by Martin Spott, while preparing for the Lelystad FSWeekend show. See also my posting on FlightGear devel, on November 22, 2007 "(Multiplayer Local Echo Patch)", but wasn't committed then because I/we assumed that had been superseded by other code modifications. The local echo problem still persists, however, albeit under specific circumstances. The current patch reportedly prevents this from happening. --- diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx index a31325a55..7a0e71847 100644 --- a/src/MultiPlayer/multiplaymgr.cxx +++ b/src/MultiPlayer/multiplaymgr.cxx @@ -233,21 +233,29 @@ FGMultiplayMgr::init (void) // Set members from property values ////////////////////////////////////////////////// short rxPort = fgGetInt("/sim/multiplay/rxport"); - if (rxPort <= 0) - rxPort = 5000; - mCallsign = fgGetString("/sim/multiplay/callsign"); - if (mCallsign.empty()) - // FIXME: use getpwuid - mCallsign = "JohnDoe"; string rxAddress = fgGetString("/sim/multiplay/rxhost"); - if (rxAddress.empty()) - rxAddress = "127.0.0.1"; short txPort = fgGetInt("/sim/multiplay/txport"); string txAddress = fgGetString("/sim/multiplay/txhost"); + mCallsign = fgGetString("/sim/multiplay/callsign"); if (txPort > 0 && !txAddress.empty()) { - mHaveServer = true; mServer.set(txAddress.c_str(), txPort); + if (strncmp (mServer.getHost(), "0.0.0.0", 8) == 0) { + mHaveServer = false; + SG_LOG(SG_NETWORK, SG_ALERT, + "FGMultiplayMgr - could not resolve '" + << txAddress << "', Multiplayermode disabled"); + } else { + mHaveServer = true; + } + rxPort = txPort; + } + if (rxPort <= 0) { + SG_LOG(SG_NETWORK, SG_ALERT, + "FGMultiplayMgr - No receiver port, Multiplayermode disabled"); + return (false); } + if (mCallsign.empty()) + mCallsign = "JohnDoe"; // FIXME: use getpwuid SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-txaddress= "<MsgLen - sizeof(T_MsgHdr) - 1] = '\0'; T_ChatMsg* ChatMsg = (T_ChatMsg *)(Msg + sizeof(T_MsgHdr)); - SG_LOG ( SG_NETWORK, SG_ALERT, "Chat [" << MsgHdr->Callsign << "]" - << " " << MsgBuf << endl); + SG_LOG (SG_NETWORK, SG_ALERT, "Chat [" << MsgHdr->Callsign << "]" + << " " << MsgBuf); delete [] MsgBuf; } // FGMultiplayMgr::ProcessChatMsg ()