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
28b18575
Commit
28b18575
authored
Jul 17, 2012
by
Max-Wilhelm Bruker
Browse files
fixed issue #66: game creators can't kick spectators; unfortunately, this fix is client-side
parent
a1e35ccd
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/tab_game.cpp
View file @
28b18575
...
...
@@ -819,17 +819,6 @@ AbstractClient *TabGame::getClientForPlayer(int playerId) const
return
clients
.
first
();
}
int
TabGame
::
getPlayerIdByName
(
const
QString
&
playerName
)
const
{
QMapIterator
<
int
,
Player
*>
playerIterator
(
players
);
while
(
playerIterator
.
hasNext
())
{
const
Player
*
const
p
=
playerIterator
.
next
().
value
();
if
(
p
->
getName
()
==
playerName
)
return
p
->
getId
();
}
return
-
1
;
}
void
TabGame
::
sendGameCommand
(
PendingCommand
*
pend
,
int
playerId
)
{
AbstractClient
*
client
=
getClientForPlayer
(
playerId
);
...
...
cockatrice/src/tab_game.h
View file @
28b18575
...
...
@@ -210,7 +210,6 @@ public:
bool
getSpectatorsSeeEverything
()
const
{
return
gameInfo
.
spectators_omniscient
();
}
Player
*
getActiveLocalPlayer
()
const
;
AbstractClient
*
getClientForPlayer
(
int
playerId
)
const
;
int
getPlayerIdByName
(
const
QString
&
playerName
)
const
;
void
setActiveCard
(
CardItem
*
_card
)
{
activeCard
=
_card
;
}
CardItem
*
getActiveCard
()
const
{
return
activeCard
;
}
...
...
cockatrice/src/user_context_menu.cpp
View file @
28b18575
...
...
@@ -182,7 +182,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
client
->
sendCommand
(
client
->
prepareSessionCommand
(
cmd
));
}
else
if
(
actionClicked
==
aKick
)
{
Command_KickFromGame
cmd
;
cmd
.
set_player_id
(
game
->
getPlayerIdByName
(
userName
)
);
cmd
.
set_player_id
(
playerId
);
game
->
sendGameCommand
(
cmd
);
}
else
if
(
actionClicked
==
aBan
)
{
Command_GetUserInfo
cmd
;
...
...
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