#734: MP cannot be enabled without 'AI' module
Add and improve error messages.
This commit is contained in:
parent
44e672c256
commit
b8f61df80f
1 changed files with 17 additions and 10 deletions
|
@ -403,9 +403,16 @@ FGMultiplayMgr::init (void)
|
|||
SG_LOG(SG_NETWORK, SG_WARN, "FGMultiplayMgr::init - already initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fgSetBool("/sim/multiplay/online", false);
|
||||
|
||||
|
||||
if (!fgGetBool("/sim/ai/enabled"))
|
||||
{
|
||||
SG_LOG(SG_NETWORK, SG_ALERT,
|
||||
"Cannot enable multiplayer mode: AI subsystem is disabled (to enable start with '--enable-ai-models').");
|
||||
return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set members from property values
|
||||
//////////////////////////////////////////////////
|
||||
|
@ -428,8 +435,8 @@ FGMultiplayMgr::init (void)
|
|||
if (strncmp (mServer.getHost(), "0.0.0.0", 8) == 0) {
|
||||
mHaveServer = false;
|
||||
SG_LOG(SG_NETWORK, SG_ALERT,
|
||||
"FGMultiplayMgr - Could not resolve '"
|
||||
<< txAddress << "'. Multiplayer mode disabled.");
|
||||
"Cannot enable multiplayer mode: resolving MP server address '"
|
||||
<< txAddress << "' failed.");
|
||||
return;
|
||||
} else {
|
||||
SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr - have server");
|
||||
|
@ -438,13 +445,13 @@ FGMultiplayMgr::init (void)
|
|||
if (rxPort <= 0)
|
||||
rxPort = txPort;
|
||||
} else {
|
||||
SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr - no transmission address. Multiplayer mode disabled");
|
||||
SG_LOG(SG_NETWORK, SG_ALERT, "Cannot enable multiplayer mode: missing a valid server address.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rxPort <= 0) {
|
||||
SG_LOG(SG_NETWORK, SG_INFO,
|
||||
"FGMultiplayMgr - No receiver port. Multiplayer mode disabled.");
|
||||
SG_LOG(SG_NETWORK, SG_ALERT,
|
||||
"Cannot enable multiplayer mode: No receiver port specified.");
|
||||
return;
|
||||
}
|
||||
if (mCallsign.empty())
|
||||
|
@ -457,14 +464,14 @@ FGMultiplayMgr::init (void)
|
|||
|
||||
mSocket.reset(new simgear::Socket());
|
||||
if (!mSocket->open(false)) {
|
||||
SG_LOG( SG_NETWORK, SG_WARN,
|
||||
"FGMultiplayMgr - Failed to create data socket. Multiplayer mode disabled." );
|
||||
SG_LOG( SG_NETWORK, SG_ALERT,
|
||||
"Cannot enable multiplayer mode: creating data socket failed." );
|
||||
return;
|
||||
}
|
||||
mSocket->setBlocking(false);
|
||||
if (mSocket->bind(rxAddress.c_str(), rxPort) != 0) {
|
||||
SG_LOG( SG_NETWORK, SG_ALERT,
|
||||
"FGMultiplayMgr - Failed to bind receive socket. Multiplayer mode disabled. "
|
||||
"Cannot enable multiplayer mode: binding receive socket failed. "
|
||||
<< strerror(errno) << "(errno " << errno << ")");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue