mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
fixed another faceDown bug
This commit is contained in:
parent
af8e357487
commit
80967b59e3
2 changed files with 9 additions and 27 deletions
|
|
@ -39,8 +39,6 @@ Server_CardZone::~Server_CardZone()
|
|||
|
||||
void Server_CardZone::shuffle()
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
QList<Server_Card *> temp;
|
||||
for (int i = cards.size(); i; i--)
|
||||
temp.append(cards.takeAt(rng->getNumber(0, i - 1)));
|
||||
|
|
@ -49,8 +47,6 @@ void Server_CardZone::shuffle()
|
|||
|
||||
int Server_CardZone::removeCard(Server_Card *card)
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
int index = cards.indexOf(card);
|
||||
cards.removeAt(index);
|
||||
card->setZone(0);
|
||||
|
|
@ -60,8 +56,6 @@ int Server_CardZone::removeCard(Server_Card *card)
|
|||
|
||||
Server_Card *Server_CardZone::getCard(int id, int *position)
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
if (type != ServerInfo_Zone::HiddenZone) {
|
||||
QListIterator<Server_Card *> CardIterator(cards);
|
||||
int i = 0;
|
||||
|
|
@ -87,8 +81,6 @@ Server_Card *Server_CardZone::getCard(int id, int *position)
|
|||
|
||||
int Server_CardZone::getFreeGridColumn(int x, int y, const QString &cardName) const
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
QMap<int, Server_Card *> coordMap;
|
||||
for (int i = 0; i < cards.size(); ++i)
|
||||
if (cards[i]->getY() == y)
|
||||
|
|
@ -135,8 +127,6 @@ bool Server_CardZone::isColumnStacked(int x, int y) const
|
|||
if (!has_coords)
|
||||
return false;
|
||||
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
QMap<int, Server_Card *> coordMap;
|
||||
for (int i = 0; i < cards.size(); ++i)
|
||||
if (cards[i]->getY() == y)
|
||||
|
|
@ -150,8 +140,6 @@ bool Server_CardZone::isColumnEmpty(int x, int y) const
|
|||
if (!has_coords)
|
||||
return true;
|
||||
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
QMap<int, Server_Card *> coordMap;
|
||||
for (int i = 0; i < cards.size(); ++i)
|
||||
if (cards[i]->getY() == y)
|
||||
|
|
@ -162,13 +150,11 @@ bool Server_CardZone::isColumnEmpty(int x, int y) const
|
|||
|
||||
void Server_CardZone::moveCard(GameEventStorage &ges, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y)
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
coordMap.remove(card->getY() * 10000 + card->getX());
|
||||
|
||||
CardToMove *cardToMove = new CardToMove;
|
||||
cardToMove->set_card_id(card->getId());
|
||||
player->moveCard(ges, this, QList<const CardToMove *>() << cardToMove, this, x, y, card->getFaceDown(), false);
|
||||
player->moveCard(ges, this, QList<const CardToMove *>() << cardToMove, this, x, y, false, false);
|
||||
delete cardToMove;
|
||||
|
||||
coordMap.insert(y * 10000 + x, card);
|
||||
|
|
@ -176,8 +162,6 @@ void Server_CardZone::moveCard(GameEventStorage &ges, QMap<int, Server_Card *> &
|
|||
|
||||
void Server_CardZone::fixFreeSpaces(GameEventStorage &ges)
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
QMap<int, Server_Card *> coordMap;
|
||||
QSet<int> placesToLook;
|
||||
for (int i = 0; i < cards.size(); ++i) {
|
||||
|
|
@ -207,8 +191,6 @@ void Server_CardZone::fixFreeSpaces(GameEventStorage &ges)
|
|||
|
||||
void Server_CardZone::insertCard(Server_Card *card, int x, int y)
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
if (hasCoords()) {
|
||||
card->setCoords(x, y);
|
||||
cards.append(card);
|
||||
|
|
@ -221,8 +203,6 @@ void Server_CardZone::insertCard(Server_Card *card, int x, int y)
|
|||
|
||||
void Server_CardZone::clear()
|
||||
{
|
||||
QMutexLocker locker(&player->getGame()->gameMutex);
|
||||
|
||||
for (int i = 0; i < cards.size(); i++)
|
||||
delete cards.at(i);
|
||||
cards.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue