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
3714e1cb
Commit
3714e1cb
authored
Jan 26, 2010
by
Max-Wilhelm Bruker
Browse files
server crash fix
parent
9c4264b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
common/server_player.cpp
View file @
3714e1cb
...
...
@@ -17,6 +17,9 @@ Server_Player::Server_Player(Server_Game *_game, int _playerId, const QString &_
Server_Player
::~
Server_Player
()
{
delete
deck
;
if
(
handler
)
handler
->
playerRemovedFromGame
(
game
);
}
int
Server_Player
::
newCardId
()
...
...
common/server_protocolhandler.cpp
View file @
3714e1cb
...
...
@@ -45,7 +45,13 @@ Server_ProtocolHandler::~Server_ProtocolHandler()
chatChannelIterator
.
next
().
value
()
->
removeClient
(
this
);
}
void
Server_ProtocolHandler
::
processCommand
(
Command
*
command
)
void
Server_ProtocolHandler
::
playerRemovedFromGame
(
Server_Game
*
game
)
{
qDebug
()
<<
"Server_ProtocolHandler::playerRemovedFromGame(): gameId ="
<<
game
->
getGameId
();
games
.
remove
(
game
->
getGameId
());
}
void
Server_ProtocolHandler
::
processCommandHelper
(
Command
*
command
)
{
lastCommandTime
=
QDateTime
::
currentDateTime
();
...
...
@@ -77,6 +83,7 @@ void Server_ProtocolHandler::processCommand(Command *command)
}
if
(
!
games
.
contains
(
gameCommand
->
getGameId
()))
{
qDebug
()
<<
"invalid game"
;
sendProtocolItem
(
new
ProtocolResponse
(
gameCommand
->
getCmdId
(),
RespNameNotFound
));
return
;
}
...
...
@@ -128,6 +135,11 @@ void Server_ProtocolHandler::processCommand(Command *command)
}
if
(
response
!=
RespNothing
)
sendProtocolItem
(
new
ProtocolResponse
(
command
->
getCmdId
(),
response
));
}
void
Server_ProtocolHandler
::
processCommand
(
Command
*
command
)
{
processCommandHelper
(
command
);
delete
command
;
...
...
@@ -293,7 +305,6 @@ ResponseCode Server_ProtocolHandler::cmdJoinGame(Command_JoinGame *cmd)
ResponseCode
Server_ProtocolHandler
::
cmdLeaveGame
(
Command_LeaveGame
*
/*cmd*/
,
Server_Game
*
game
,
Server_Player
*
player
)
{
games
.
remove
(
game
->
getGameId
());
game
->
removePlayer
(
player
);
return
RespOk
;
}
...
...
common/server_protocolhandler.h
View file @
3714e1cb
...
...
@@ -72,11 +72,14 @@ private:
ResponseCode
cmdSetActivePhase
(
Command_SetActivePhase
*
cmd
,
Server_Game
*
game
,
Server_Player
*
player
);
ResponseCode
cmdDumpZone
(
Command_DumpZone
*
cmd
,
Server_Game
*
game
,
Server_Player
*
player
);
ResponseCode
cmdStopDumpZone
(
Command_StopDumpZone
*
cmd
,
Server_Game
*
game
,
Server_Player
*
player
);
void
processCommandHelper
(
Command
*
command
);
private
slots
:
void
pingClockTimeout
();
public:
Server_ProtocolHandler
(
Server
*
_server
,
QObject
*
parent
=
0
);
~
Server_ProtocolHandler
();
void
playerRemovedFromGame
(
Server_Game
*
game
);
bool
getAcceptsGameListChanges
()
const
{
return
acceptsGameListChanges
;
}
bool
getAcceptsChatChannelListChanges
()
const
{
return
acceptsChatChannelListChanges
;
}
...
...
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