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
54632555
Commit
54632555
authored
Mar 19, 2015
by
Fabio Bas
Browse files
Added whitelist for game commands
parent
8be55635
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/server_protocolhandler.cpp
View file @
54632555
...
@@ -184,6 +184,18 @@ Response::ResponseCode Server_ProtocolHandler::processRoomCommandContainer(const
...
@@ -184,6 +184,18 @@ Response::ResponseCode Server_ProtocolHandler::processRoomCommandContainer(const
Response
::
ResponseCode
Server_ProtocolHandler
::
processGameCommandContainer
(
const
CommandContainer
&
cont
,
ResponseContainer
&
rc
)
Response
::
ResponseCode
Server_ProtocolHandler
::
processGameCommandContainer
(
const
CommandContainer
&
cont
,
ResponseContainer
&
rc
)
{
{
static
QList
<
GameCommand
::
GameCommandType
>
antifloodCommandsWhiteList
=
QList
<
GameCommand
::
GameCommandType
>
()
// draw, undraw cards (eg: drawing 10 cards one by one from the deck)
<<
GameCommand
::
DRAW_CARDS
<<
GameCommand
::
UNDO_DRAW
// create, delete arrows (eg: targeting with 10 cards during an attack)
<<
GameCommand
::
CREATE_ARROW
<<
GameCommand
::
DELETE_ARROW
// set card attributes (eg: tapping 10 cards at once)
<<
GameCommand
::
SET_CARD_ATTR
// increment / decrement counter (eg: -10 lifepoints one by one)
<<
GameCommand
::
INC_COUNTER
;
if
(
authState
==
NotLoggedIn
)
if
(
authState
==
NotLoggedIn
)
return
Response
::
RespLoginNeeded
;
return
Response
::
RespLoginNeeded
;
...
@@ -229,7 +241,10 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
...
@@ -229,7 +241,10 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
int
totalCount
=
0
;
int
totalCount
=
0
;
if
(
commandCountOverTime
.
isEmpty
())
if
(
commandCountOverTime
.
isEmpty
())
commandCountOverTime
.
prepend
(
0
);
commandCountOverTime
.
prepend
(
0
);
++
commandCountOverTime
[
0
];
if
(
!
antifloodCommandsWhiteList
.
contains
((
GameCommand
::
GameCommandType
)
getPbExtension
(
sc
)))
++
commandCountOverTime
[
0
];
for
(
int
i
=
0
;
i
<
commandCountOverTime
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
commandCountOverTime
.
size
();
++
i
)
totalCount
+=
commandCountOverTime
[
i
];
totalCount
+=
commandCountOverTime
[
i
];
...
...
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