Do not kick the player from the server on game admin timeout - just remove the player from the game.

This commit is contained in:
lotodore
2008-03-07 21:45:26 +00:00
parent 4bc902b229
commit d8d816f8dc
5 changed files with 22 additions and 7 deletions
+1
View File
@@ -811,6 +811,7 @@ Remove Reason:
0x0001 - Game is full
0x0002 - Game is already running
0x0003 - Kicked from the game
0x0004 - Timeout
0xFFFF - Other reason
+7 -1
View File
@@ -3060,6 +3060,7 @@ void mainWindowImpl::paintStartSplash() {
void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
hideTimeoutDialog();
switch (errorID) {
case ERR_SOCK_SERVERADDR_NOT_SET:
{QMessageBox::warning(this, tr("Network Error"),
@@ -3272,7 +3273,6 @@ void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
QMessageBox::Close); }
}
// close dialogs
hideTimeoutDialog();
myGameLobbyDialog->reject();
myConnectToServerDialog->reject();
myStartNetworkGameDialog->reject();
@@ -3280,6 +3280,7 @@ void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
void mainWindowImpl::networkNotification(int notificationId)
{
hideTimeoutDialog();
switch (notificationId)
{
case NTF_NET_REMOVED_KICKED:
@@ -3299,6 +3300,11 @@ void mainWindowImpl::networkNotification(int notificationId)
tr("Unable to join - the server has already started the game."),
QMessageBox::Close); }
break;
case NTF_NET_REMOVED_TIMEOUT:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Your admin state timed out due to inactivity. Feel free to create a new game!"),
QMessageBox::Close); }
break;
case NTF_NET_JOIN_INVALID_PASSWORD:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Invalid password when joining the game.\nPlease reenter the password and try again."),
+7
View File
@@ -97,6 +97,7 @@ using namespace std;
#define NET_REMOVED_GAME_FULL 0x0001
#define NET_REMOVED_GAME_ALREADY_RUNNING 0x0002
#define NET_REMOVED_KICKED 0x0003
#define NET_REMOVED_TIMEOUT 0x0004
#define NET_REMOVED_OTHER_REASON 0xFFFF
// Reasons for timeout warning
@@ -4268,6 +4269,9 @@ NetPacketRemovedFromGame::SetData(const NetPacketRemovedFromGame::Data &inData)
case NTF_NET_REMOVED_KICKED :
tmpData->removeReason = htons(NET_REMOVED_KICKED);
break;
case NTF_NET_REMOVED_TIMEOUT :
tmpData->removeReason = htons(NET_REMOVED_TIMEOUT);
break;
default :
tmpData->removeReason = htons(NET_REMOVED_OTHER_REASON);
break;
@@ -4297,6 +4301,9 @@ NetPacketRemovedFromGame::GetData(NetPacketRemovedFromGame::Data &outData) const
case NET_REMOVED_KICKED :
outData.removeReason = NTF_NET_REMOVED_KICKED;
break;
case NET_REMOVED_TIMEOUT :
outData.removeReason = NTF_NET_REMOVED_TIMEOUT;
break;
default :
outData.removeReason = NTF_NET_INTERNAL;
break;
+1 -1
View File
@@ -340,7 +340,7 @@ ServerGameStateInit::Process(ServerGameThread &server)
SessionWrapper session = server.GetSessionManager().GetSessionByUniquePlayerId(server.GetAdminPlayerId());
if (session.sessionData.get())
{
server.RemovePlayer(session.playerData->GetUniqueId(), ERR_NET_SESSION_TIMED_OUT);
server.MoveSessionToLobby(session, NTF_NET_REMOVED_TIMEOUT);
}
}
return AbstractServerGameStateReceiving::Process(server);
+6 -5
View File
@@ -90,15 +90,16 @@
#define NTF_NET_REMOVED_GAME_FULL 203
#define NTF_NET_REMOVED_ALREADY_RUNNING 204
#define NTF_NET_REMOVED_KICKED 205
#define NTF_NET_REMOVED_TIMEOUT 206
// Notifications - join failed
#define NTF_NET_JOIN_GAME_FULL 206
#define NTF_NET_JOIN_ALREADY_RUNNING 207
#define NTF_NET_JOIN_INVALID_PASSWORD 208
#define NTF_NET_JOIN_GAME_FULL 210
#define NTF_NET_JOIN_ALREADY_RUNNING 211
#define NTF_NET_JOIN_INVALID_PASSWORD 212
// Notifications - version
#define NTF_NET_NEW_RELEASE_AVAILABLE 209
#define NTF_NET_OUTDATED_BETA 210
#define NTF_NET_NEW_RELEASE_AVAILABLE 220
#define NTF_NET_OUTDATED_BETA 221
// This is an internal message which is not reported.
#define MSG_SOCK_INTERNAL_PENDING 0