Revert "fix card moving on server (#4413)"

This reverts commit c25bf491e4.
This commit is contained in:
ZeldaZach 2021-11-15 00:54:21 -05:00
parent 691bcb9338
commit 8b1daa21ef
4 changed files with 133 additions and 129 deletions

View file

@ -44,8 +44,6 @@ Server_CardZone::~Server_CardZone()
void Server_CardZone::shuffle(int start, int end)
{
cardsBeingLookedAt = 0;
// Size 0 or 1 decks are sorted
if (cards.size() < 2)
return;
@ -123,22 +121,11 @@ void Server_CardZone::insertCardIntoCoordMap(Server_Card *card, int x, int y)
}
int Server_CardZone::removeCard(Server_Card *card)
{
bool wasLookedAt;
return removeCard(card, wasLookedAt);
}
int Server_CardZone::removeCard(Server_Card *card, bool &wasLookedAt)
{
int index = cards.indexOf(card);
wasLookedAt = isCardAtPosLookedAt(index);
if (wasLookedAt && cardsBeingLookedAt > 0) {
cardsBeingLookedAt -= 1;
}
cards.removeAt(index);
if (has_coords) {
if (has_coords)
removeCardFromCoordMap(card, card->getX(), card->getY());
}
card->setZone(nullptr);
return index;
@ -174,11 +161,6 @@ Server_Card *Server_CardZone::getCard(int id, int *position, bool remove)
}
}
bool Server_CardZone::isCardAtPosLookedAt(int pos) const
{
return type == ServerInfo_Zone::HiddenZone && (cardsBeingLookedAt == -1 || cardsBeingLookedAt > pos);
}
int Server_CardZone::getFreeGridColumn(int x, int y, const QString &cardName, bool dontStackSameName) const
{
const QMap<int, Server_Card *> &coordMap = coordinateMap.value(y);
@ -292,11 +274,10 @@ void Server_CardZone::insertCard(Server_Card *card, int x, int y)
insertCardIntoCoordMap(card, x, y);
} else {
card->setCoords(0, 0);
if (x == -1) {
if (x == -1)
cards.append(card);
} else {
else
cards.insert(x, card);
}
}
card->setZone(this);
}
@ -310,7 +291,6 @@ void Server_CardZone::clear()
freePilesMap.clear();
freeSpaceMap.clear();
playersWithWritePermission.clear();
cardsBeingLookedAt = 0;
}
void Server_CardZone::addWritePermission(int playerId)