Fix remaining issues
This commit is contained in:
parent
779a400de4
commit
a7b8934a1b
4 changed files with 9 additions and 9 deletions
|
@ -1592,7 +1592,7 @@ void Player::playCard(CardItem *c, bool faceDown, bool tapped)
|
||||||
QPoint gridPoint = QPoint(-1, 2 - tableRow);
|
QPoint gridPoint = QPoint(-1, 2 - tableRow);
|
||||||
cardToMove->set_face_down(faceDown);
|
cardToMove->set_face_down(faceDown);
|
||||||
cardToMove->set_pt(ci->getPowTough().toStdString());
|
cardToMove->set_pt(ci->getPowTough().toStdString());
|
||||||
cardToMove->set_tapped(tapped);
|
cardToMove->set_tapped(faceDown ? false : tapped);
|
||||||
if (tableRow != 3)
|
if (tableRow != 3)
|
||||||
cmd.set_target_zone("table");
|
cmd.set_target_zone("table");
|
||||||
cmd.set_x(gridPoint.x());
|
cmd.set_x(gridPoint.x());
|
||||||
|
|
|
@ -85,7 +85,7 @@ void Server_CardZone::insertCardIntoCoordMap(Server_Card *card, int x, int y)
|
||||||
|
|
||||||
coordinateMap[y].insert(x, card);
|
coordinateMap[y].insert(x, card);
|
||||||
if (!(x % 3)) {
|
if (!(x % 3)) {
|
||||||
if (!freePilesMap[y].contains(card->getName(), x) && card->getAttachedCards().isEmpty())
|
if (!card->getFaceDown() && !freePilesMap[y].contains(card->getName(), x) && card->getAttachedCards().isEmpty())
|
||||||
freePilesMap[y].insert(card->getName(), x);
|
freePilesMap[y].insert(card->getName(), x);
|
||||||
if (freeSpaceMap[y] == x) {
|
if (freeSpaceMap[y] == x) {
|
||||||
int nextFreeX = x;
|
int nextFreeX = x;
|
||||||
|
@ -141,11 +141,11 @@ Server_Card *Server_CardZone::getCard(int id, int *position, bool remove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Server_CardZone::getFreeGridColumn(int x, int y, const QString &cardName) const
|
int Server_CardZone::getFreeGridColumn(int x, int y, const QString &cardName, bool dontStackSameName) const
|
||||||
{
|
{
|
||||||
const QMap<int, Server_Card *> &coordMap = coordinateMap.value(y);
|
const QMap<int, Server_Card *> &coordMap = coordinateMap.value(y);
|
||||||
if (x == -1) {
|
if (x == -1) {
|
||||||
if (freePilesMap[y].contains(cardName)) {
|
if (!dontStackSameName && freePilesMap[y].contains(cardName)) {
|
||||||
x = (freePilesMap[y].value(cardName) / 3) * 3;
|
x = (freePilesMap[y].value(cardName) / 3) * 3;
|
||||||
if (!coordMap.contains(x))
|
if (!coordMap.contains(x))
|
||||||
return x;
|
return x;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
Server_Player *getPlayer() const { return player; }
|
Server_Player *getPlayer() const { return player; }
|
||||||
void getInfo(ServerInfo_Zone *info, Server_Player *playerWhosAsking, bool omniscient);
|
void getInfo(ServerInfo_Zone *info, Server_Player *playerWhosAsking, bool omniscient);
|
||||||
|
|
||||||
int getFreeGridColumn(int x, int y, const QString &cardName) const;
|
int getFreeGridColumn(int x, int y, const QString &cardName, bool dontStackSameName) const;
|
||||||
bool isColumnEmpty(int x, int y) const;
|
bool isColumnEmpty(int x, int y) const;
|
||||||
bool isColumnStacked(int x, int y) const;
|
bool isColumnStacked(int x, int y) const;
|
||||||
void fixFreeSpaces(GameEventStorage &ges);
|
void fixFreeSpaces(GameEventStorage &ges);
|
||||||
|
|
|
@ -439,11 +439,12 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, Server_Car
|
||||||
|
|
||||||
card->deleteLater();
|
card->deleteLater();
|
||||||
} else {
|
} else {
|
||||||
|
card->setFaceDown(faceDown);
|
||||||
if (!targetzone->hasCoords()) {
|
if (!targetzone->hasCoords()) {
|
||||||
y = 0;
|
y = 0;
|
||||||
card->resetState();
|
card->resetState();
|
||||||
} else
|
} else
|
||||||
newX = targetzone->getFreeGridColumn(newX, y, card->getName());
|
newX = targetzone->getFreeGridColumn(newX, y, card->getName(), faceDown);
|
||||||
|
|
||||||
targetzone->insertCard(card, newX, y);
|
targetzone->insertCard(card, newX, y);
|
||||||
|
|
||||||
|
@ -464,7 +465,6 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, Server_Car
|
||||||
int oldCardId = card->getId();
|
int oldCardId = card->getId();
|
||||||
if ((faceDown && (startzone != targetzone)) || (targetzone->getPlayer() != startzone->getPlayer()))
|
if ((faceDown && (startzone != targetzone)) || (targetzone->getPlayer() != startzone->getPlayer()))
|
||||||
card->setId(targetzone->getPlayer()->newCardId());
|
card->setId(targetzone->getPlayer()->newCardId());
|
||||||
card->setFaceDown(faceDown);
|
|
||||||
|
|
||||||
// The player does not get to see which card he moved if it moves between two parts of hidden zones which
|
// The player does not get to see which card he moved if it moves between two parts of hidden zones which
|
||||||
// are not being looked at.
|
// are not being looked at.
|
||||||
|
@ -1043,7 +1043,7 @@ Response::ResponseCode Server_Player::cmdAttachCard(const Command_AttachCard &cm
|
||||||
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY())) {
|
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY())) {
|
||||||
CardToMove *cardToMove = new CardToMove;
|
CardToMove *cardToMove = new CardToMove;
|
||||||
cardToMove->set_card_id(targetCard->getId());
|
cardToMove->set_card_id(targetCard->getId());
|
||||||
targetPlayer->moveCard(ges, targetzone, QList<const CardToMove *>() << cardToMove, targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName()), targetCard->getY(), targetCard->getFaceDown());
|
targetPlayer->moveCard(ges, targetzone, QList<const CardToMove *>() << cardToMove, targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName(), false), targetCard->getY(), targetCard->getFaceDown());
|
||||||
delete cardToMove;
|
delete cardToMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,7 +1080,7 @@ Response::ResponseCode Server_Player::cmdCreateToken(const Command_CreateToken &
|
||||||
int x = cmd.x();
|
int x = cmd.x();
|
||||||
int y = cmd.y();
|
int y = cmd.y();
|
||||||
if (zone->hasCoords())
|
if (zone->hasCoords())
|
||||||
x = zone->getFreeGridColumn(x, y, cardName);
|
x = zone->getFreeGridColumn(x, y, cardName, false);
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
|
|
Loading…
Reference in a new issue