Now handles lobby errors more gracefully

This commit is contained in:
mathusummut 2018-09-20 19:58:12 +02:00
parent d992eaa4bb
commit 5b0737190d
2 changed files with 5 additions and 5 deletions

View File

@ -560,7 +560,8 @@ namespace Glest {
serverFTPPort = networkMessageIntro.getFtpPort();
if (playerIndex < 0 || playerIndex >= GameConstants::maxPlayers) {
throw megaglest_runtime_error("playerIndex < 0 || playerIndex >= GameConstants::maxPlayers");
printf("playerIndex < 0 || playerIndex >= GameConstants::maxPlayers\n");
return;
}
MutexSafeWrapper safeMutexFlags(flagAccessor, CODE_AT_LINE);
@ -925,9 +926,8 @@ namespace Glest {
} else {
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType());
char szBuf[1024] = "";
snprintf(szBuf, 1023, "In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType());
throw megaglest_runtime_error(szBuf);
printf("In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType());
//throw megaglest_runtime_error(szBuf);
}
networkMessageLaunch.buildGameSettings(&gameSettings);

View File

@ -191,7 +191,7 @@ namespace Glest {
//sanity check new message type
if (messageType < 0 || messageType >= nmtCount) {
if (getConnectHasHandshaked() == true) {
throw megaglest_runtime_error("Invalid message type: " + intToStr(messageType));
printf("%s%d\n", "Invalid message type: ", messageType);
} else {
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] Invalid message type = %d (no packet handshake yet so ignored)\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, messageType);
}