mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 07:10:25 -08:00
Disallow arrows pointing at or originating from cards in hidden/private zones. This fixes bug #0000024.
This commit is contained in:
@@ -672,6 +672,10 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(Command_AttachCard *cmd, Comm
|
|||||||
targetzone = targetPlayer->getZones().value(cmd->getTargetZone());
|
targetzone = targetPlayer->getZones().value(cmd->getTargetZone());
|
||||||
if (targetzone)
|
if (targetzone)
|
||||||
targetCard = targetzone->getCard(cmd->getTargetCardId(), false);
|
targetCard = targetzone->getCard(cmd->getTargetCardId(), false);
|
||||||
|
// This is currently enough to make sure cards don't get attached to a card that is not on the table.
|
||||||
|
// Possibly a flag will have to be introduced for this sometime.
|
||||||
|
if (!startzone->hasCoords() || !targetzone->hasCoords())
|
||||||
|
return RespContextError;
|
||||||
|
|
||||||
// Get all arrows pointing to or originating from the card being attached and delete them.
|
// Get all arrows pointing to or originating from the card being attached and delete them.
|
||||||
QMapIterator<int, Server_Player *> playerIterator(game->getPlayers());
|
QMapIterator<int, Server_Player *> playerIterator(game->getPlayers());
|
||||||
@@ -759,7 +763,7 @@ ResponseCode Server_ProtocolHandler::cmdCreateArrow(Command_CreateArrow *cmd, Co
|
|||||||
Server_Card *targetCard = 0;
|
Server_Card *targetCard = 0;
|
||||||
if (!playerTarget)
|
if (!playerTarget)
|
||||||
targetCard = targetZone->getCard(cmd->getTargetCardId(), false);
|
targetCard = targetZone->getCard(cmd->getTargetCardId(), false);
|
||||||
if (!startCard || (!targetCard && !playerTarget) || (startCard == targetCard))
|
if (!startCard || (!targetCard && !playerTarget) || (startCard == targetCard) || (startZone->getType() != PublicZone) || (targetZone->getType() != PublicZone))
|
||||||
return RespContextError;
|
return RespContextError;
|
||||||
|
|
||||||
Server_ArrowTarget *targetItem;
|
Server_ArrowTarget *targetItem;
|
||||||
|
|||||||
Reference in New Issue
Block a user