Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
9c4264b4
Commit
9c4264b4
authored
Jan 18, 2010
by
Max-Wilhelm Bruker
Browse files
fixed server crash bug
parent
b1e8f08e
Changes
5
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/tab_server.cpp
View file @
9c4264b4
...
...
@@ -65,7 +65,7 @@ void GameSelector::checkResponse(ResponseCode response)
switch
(
response
)
{
case
RespWrongPassword
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Wrong password."
));
break
;
case
RespSpectatorsNotAllowed
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Spectators are not allowed in this game."
));
break
;
case
Resp
ContextError
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game is already full."
));
break
;
case
Resp
GameFull
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game is already full."
));
break
;
case
RespNameNotFound
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game does not exist any more."
));
break
;
default:
;
}
...
...
common/protocol.cpp
View file @
9c4264b4
...
...
@@ -144,6 +144,7 @@ void ProtocolResponse::initializeHash()
responseHash
.
insert
(
"login_needed"
,
RespLoginNeeded
);
responseHash
.
insert
(
"function_not_allowed"
,
RespFunctionNotAllowed
);
responseHash
.
insert
(
"game_not_started"
,
RespGameNotStarted
);
responseHash
.
insert
(
"game_full"
,
RespGameFull
);
responseHash
.
insert
(
"context_error"
,
RespContextError
);
responseHash
.
insert
(
"wrong_password"
,
RespWrongPassword
);
responseHash
.
insert
(
"spectators_not_allowed"
,
RespSpectatorsNotAllowed
);
...
...
common/protocol_datastructures.h
View file @
9c4264b4
...
...
@@ -8,7 +8,7 @@
class
DeckList
;
enum
ResponseCode
{
RespNothing
,
RespOk
,
RespInvalidCommand
,
RespInvalidData
,
RespNameNotFound
,
RespLoginNeeded
,
RespFunctionNotAllowed
,
RespGameNotStarted
,
RespContextError
,
RespWrongPassword
,
RespSpectatorsNotAllowed
};
enum
ResponseCode
{
RespNothing
,
RespOk
,
RespInvalidCommand
,
RespInvalidData
,
RespNameNotFound
,
RespLoginNeeded
,
RespFunctionNotAllowed
,
RespGameNotStarted
,
RespGameFull
,
RespContextError
,
RespWrongPassword
,
RespSpectatorsNotAllowed
};
// PrivateZone: Contents of the zone are always visible to the owner,
// but not to anyone else.
...
...
common/server_game.cpp
View file @
9c4264b4
...
...
@@ -156,7 +156,7 @@ ResponseCode Server_Game::checkJoin(const QString &_password, bool spectator)
if
(
!
spectatorsAllowed
)
return
RespSpectatorsNotAllowed
;
}
else
if
(
gameStarted
||
(
getPlayerCount
()
>=
getMaxPlayers
()))
return
Resp
ContextError
;
return
Resp
GameFull
;
return
RespOk
;
}
...
...
common/server_protocolhandler.cpp
View file @
9c4264b4
...
...
@@ -274,6 +274,9 @@ ResponseCode Server_ProtocolHandler::cmdCreateGame(Command_CreateGame *cmd)
ResponseCode
Server_ProtocolHandler
::
cmdJoinGame
(
Command_JoinGame
*
cmd
)
{
if
(
games
.
contains
(
cmd
->
getGameId
()))
return
RespContextError
;
Server_Game
*
g
=
server
->
getGame
(
cmd
->
getGameId
());
if
(
!
g
)
return
RespNameNotFound
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment