// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef FG_MPLAYER_AS
/******************************************************************
* $Id$
******************************************************************/
#include <sys/types.h>
-#ifndef _MSC_VER
+#if !(defined(_MSC_VER) || defined(__MINGW32__))
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
mDataRxSocket = new netSocket();
if (!mDataRxSocket->open(false)) {
// Failed to open rx socket
- cerr << "FGMultiplayRxMgr::Open - Failed to create data receive socket" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::Open - Failed to create data receive socket" );
bSuccess = false;
} else {
if (mDataRxSocket->bind(m_sRxAddress.c_str(), m_iRxPort) != 0) {
perror("bind");
// Failed to bind
- cerr << "FGMultiplayRxMgr::Open - Failed to bind receive socket" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::Open - Failed to bind receive socket" );
bSuccess = false;
}
m_bInitialised = bSuccess;
} else {
- cerr << "FGMultiplayRxMgr::OpenRx - Receiver open requested when receiver is already open" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::OpenRx - Receiver open requested when receiver is already open" );
bSuccess = false;
}
// Check if the player was added
if (!bActivePlayer) {
if (iPlayerCnt == MAX_PLAYERS) {
- cerr << "FGMultiplayRxMgr::MP_ProcessData - Unable to add new player (" << sCallsign << "). Too many players." << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::MP_ProcessData - Unable to add new player (" << sCallsign << "). Too many players." );
}
}
}
} else {
- cerr << "FGMultiplayRxMgr::MP_ProcessData - Position message received with insufficient data" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::MP_ProcessData - Position message received with insufficient data" );
}
break;
default:
- cerr << "FGMultiplayRxMgr::MP_ProcessData - Unknown message Id received: " << MsgHdr->MsgId << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::MP_ProcessData - Unknown message Id received: " << MsgHdr->MsgId );
break;
******************************************************************/
void FGMultiplayRxMgr::Update(void) {
- int iPlayerDataState;
+ MPPlayer::TPlayerDataState ePlayerDataState;
int iPlayerId;
for (iPlayerId = 0; iPlayerId < MAX_PLAYERS; iPlayerId++) {
if (m_Player[iPlayerId] != NULL) {
- iPlayerDataState = m_Player[iPlayerId]->Draw();
+ ePlayerDataState = m_Player[iPlayerId]->Draw();
// If the player has not received an update for some
// time then assume that the player has quit.
- if (iPlayerDataState == PLAYER_DATA_EXPIRED) {
+ if (ePlayerDataState == MPPlayer::PLAYER_DATA_EXPIRED) {
+ SG_LOG( SG_NETWORK, SG_BULK, "FGMultiplayRxMgr::Update - Deleting player from game. Callsign: "
+ << m_Player[iPlayerId]->Callsign() );
delete m_Player[iPlayerId];
m_Player[iPlayerId] = NULL;
}
}
+#endif // FG_MPLAYER_AS