Merge branch 'master' of git://cockatrice.git.sourceforge.net/gitroot/cockatrice/cockatrice into translation
This commit is contained in:
commit
fb1110874d
39 changed files with 3134 additions and 2049 deletions
|
@ -173,7 +173,8 @@ TRANSLATIONS += \
|
||||||
translations/cockatrice_es.ts \
|
translations/cockatrice_es.ts \
|
||||||
translations/cockatrice_pt.ts \
|
translations/cockatrice_pt.ts \
|
||||||
translations/cockatrice_pt-br.ts \
|
translations/cockatrice_pt-br.ts \
|
||||||
translations/cockatrice_fr.ts
|
translations/cockatrice_fr.ts \
|
||||||
|
translations/cockatrice_jp.ts
|
||||||
win32 {
|
win32 {
|
||||||
RC_FILE = cockatrice.rc
|
RC_FILE = cockatrice.rc
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<file>translations/cockatrice_pt.qm</file>
|
<file>translations/cockatrice_pt.qm</file>
|
||||||
<file>translations/cockatrice_pt-br.qm</file>
|
<file>translations/cockatrice_pt-br.qm</file>
|
||||||
<file>translations/cockatrice_fr.qm</file>
|
<file>translations/cockatrice_fr.qm</file>
|
||||||
|
<file>translations/cockatrice_jp.qm</file>
|
||||||
<file>resources/appicon.svg</file>
|
<file>resources/appicon.svg</file>
|
||||||
<file>resources/add_to_sideboard.svg</file>
|
<file>resources/add_to_sideboard.svg</file>
|
||||||
<file>resources/decrement.svg</file>
|
<file>resources/decrement.svg</file>
|
||||||
|
|
|
@ -72,17 +72,18 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
QPointF sp = pos();
|
QPointF sp = pos();
|
||||||
sc->removeItem(this);
|
sc->removeItem(this);
|
||||||
|
|
||||||
|
QList<CardDragItem *> dragItemList;
|
||||||
CardZone *startZone = static_cast<CardItem *>(item)->getZone();
|
CardZone *startZone = static_cast<CardItem *>(item)->getZone();
|
||||||
if (currentZone && !(static_cast<CardItem *>(item)->getAttachedTo() && (startZone == currentZone))) {
|
if (currentZone && !(static_cast<CardItem *>(item)->getAttachedTo() && (startZone == currentZone))) {
|
||||||
if (!occupied)
|
dragItemList.append(this);
|
||||||
currentZone->handleDropEvent(this, startZone, (sp - currentZone->scenePos()).toPoint(), faceDown);
|
|
||||||
for (int i = 0; i < childDrags.size(); i++) {
|
for (int i = 0; i < childDrags.size(); i++) {
|
||||||
CardDragItem *c = static_cast<CardDragItem *>(childDrags[i]);
|
CardDragItem *c = static_cast<CardDragItem *>(childDrags[i]);
|
||||||
if (!(static_cast<CardItem *>(c->item)->getAttachedTo() && (startZone == currentZone)) && !c->occupied)
|
if (!(static_cast<CardItem *>(c->item)->getAttachedTo() && (startZone == currentZone)) && !c->occupied)
|
||||||
currentZone->handleDropEvent(static_cast<CardDragItem *>(c), startZone, (sp - currentZone->scenePos() + c->getHotSpot()).toPoint(), faceDown);
|
dragItemList.append(c);
|
||||||
sc->removeItem(c);
|
sc->removeItem(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
currentZone->handleDropEvent(dragItemList, startZone, (sp - currentZone->scenePos()).toPoint(), faceDown);
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
#include "tab_game.h"
|
#include "tab_game.h"
|
||||||
|
|
||||||
CardItem::CardItem(Player *_owner, const QString &_name, int _cardid, QGraphicsItem *parent)
|
CardItem::CardItem(Player *_owner, const QString &_name, int _cardid, bool _revealedCard, QGraphicsItem *parent)
|
||||||
: AbstractCardItem(_name, _owner, parent), zone(0), id(_cardid), attacking(false), facedown(false), destroyOnZoneChange(false), doesntUntap(false), dragItem(0), attachedTo(0)
|
: AbstractCardItem(_name, _owner, parent), zone(0), id(_cardid), revealedCard(_revealedCard), attacking(false), facedown(false), destroyOnZoneChange(false), doesntUntap(false), dragItem(0), attachedTo(0)
|
||||||
{
|
{
|
||||||
owner->addCard(this);
|
owner->addCard(this);
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@ CardItem::CardItem(Player *_owner, const QString &_name, int _cardid, QGraphicsI
|
||||||
|
|
||||||
aPlay = new QAction(this);
|
aPlay = new QAction(this);
|
||||||
connect(aPlay, SIGNAL(triggered()), this, SLOT(actPlay()));
|
connect(aPlay, SIGNAL(triggered()), this, SLOT(actPlay()));
|
||||||
|
aHide = new QAction(this);
|
||||||
|
connect(aHide, SIGNAL(triggered()), this, SLOT(actHide()));
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
QAction *tempAddCounter = new QAction(this);
|
QAction *tempAddCounter = new QAction(this);
|
||||||
|
@ -128,7 +130,9 @@ void CardItem::updateCardMenu()
|
||||||
{
|
{
|
||||||
cardMenu->clear();
|
cardMenu->clear();
|
||||||
|
|
||||||
if (owner->getLocal()) {
|
if (revealedCard)
|
||||||
|
cardMenu->addAction(aHide);
|
||||||
|
else if (owner->getLocal()) {
|
||||||
if (zone) {
|
if (zone) {
|
||||||
if (zone->getName() == "table") {
|
if (zone->getName() == "table") {
|
||||||
cardMenu->addAction(aTap);
|
cardMenu->addAction(aTap);
|
||||||
|
@ -169,6 +173,7 @@ void CardItem::updateCardMenu()
|
||||||
void CardItem::retranslateUi()
|
void CardItem::retranslateUi()
|
||||||
{
|
{
|
||||||
aPlay->setText(tr("&Play"));
|
aPlay->setText(tr("&Play"));
|
||||||
|
aHide->setText(tr("&Hide"));
|
||||||
|
|
||||||
aTap->setText(tr("&Tap"));
|
aTap->setText(tr("&Tap"));
|
||||||
aUntap->setText(tr("&Untap"));
|
aUntap->setText(tr("&Untap"));
|
||||||
|
@ -426,7 +431,10 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
cardMenu->exec(event->screenPos());
|
cardMenu->exec(event->screenPos());
|
||||||
} else if ((event->button() == Qt::LeftButton) && !settingsCache->getDoubleClickToPlay()) {
|
} else if ((event->button() == Qt::LeftButton) && !settingsCache->getDoubleClickToPlay()) {
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::OpenHandCursor);
|
||||||
playCard(event->modifiers().testFlag(Qt::ShiftModifier));
|
if (revealedCard)
|
||||||
|
actHide();
|
||||||
|
else
|
||||||
|
playCard(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractCardItem::mouseReleaseEvent(event);
|
AbstractCardItem::mouseReleaseEvent(event);
|
||||||
|
@ -434,8 +442,12 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (settingsCache->getDoubleClickToPlay())
|
if (settingsCache->getDoubleClickToPlay()) {
|
||||||
playCard(event->modifiers().testFlag(Qt::ShiftModifier));
|
if (revealedCard)
|
||||||
|
actHide();
|
||||||
|
else
|
||||||
|
playCard(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||||
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,4 +495,9 @@ void CardItem::actCardCounterTrigger()
|
||||||
void CardItem::actPlay()
|
void CardItem::actPlay()
|
||||||
{
|
{
|
||||||
playCard(false);
|
playCard(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardItem::actHide()
|
||||||
|
{
|
||||||
|
zone->removeCard(this);
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ class CardItem : public AbstractCardItem {
|
||||||
private:
|
private:
|
||||||
CardZone *zone;
|
CardZone *zone;
|
||||||
int id;
|
int id;
|
||||||
|
bool revealedCard;
|
||||||
bool attacking;
|
bool attacking;
|
||||||
bool facedown;
|
bool facedown;
|
||||||
QMap<int, int> counters;
|
QMap<int, int> counters;
|
||||||
|
@ -31,6 +32,7 @@ private:
|
||||||
|
|
||||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||||
QAction *aPlay,
|
QAction *aPlay,
|
||||||
|
*aHide,
|
||||||
*aTap, *aUntap, *aDoesntUntap, *aAttach, *aUnattach, *aSetPT, *aSetAnnotation, *aFlip, *aClone,
|
*aTap, *aUntap, *aDoesntUntap, *aAttach, *aUnattach, *aSetPT, *aSetAnnotation, *aFlip, *aClone,
|
||||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile;
|
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile;
|
||||||
QMenu *cardMenu, *moveMenu;
|
QMenu *cardMenu, *moveMenu;
|
||||||
|
@ -45,12 +47,13 @@ private slots:
|
||||||
void actSetPT();
|
void actSetPT();
|
||||||
void actSetAnnotation();
|
void actSetAnnotation();
|
||||||
void actPlay();
|
void actPlay();
|
||||||
|
void actHide();
|
||||||
public slots:
|
public slots:
|
||||||
void deleteLater();
|
void deleteLater();
|
||||||
public:
|
public:
|
||||||
enum { Type = typeCard };
|
enum { Type = typeCard };
|
||||||
int type() const { return Type; }
|
int type() const { return Type; }
|
||||||
CardItem(Player *_owner, const QString &_name = QString(), int _cardid = -1, QGraphicsItem *parent = 0);
|
CardItem(Player *_owner, const QString &_name = QString(), int _cardid = -1, bool revealedCard = false, QGraphicsItem *parent = 0);
|
||||||
~CardItem();
|
~CardItem();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
CardZone *getZone() const { return zone; }
|
CardZone *getZone() const { return zone; }
|
||||||
|
|
|
@ -157,16 +157,25 @@ CardItem *CardZone::takeCard(int position, int cardId, bool /*canResize*/)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CardZone::removeCard(CardItem *card)
|
||||||
|
{
|
||||||
|
cards.removeAt(cards.indexOf(card));
|
||||||
|
reorganizeCards();
|
||||||
|
emit cardCountChanged();
|
||||||
|
player->deleteCard(card);
|
||||||
|
}
|
||||||
|
|
||||||
void CardZone::moveAllToZone()
|
void CardZone::moveAllToZone()
|
||||||
{
|
{
|
||||||
QList<QVariant> data = static_cast<QAction *>(sender())->data().toList();
|
QList<QVariant> data = static_cast<QAction *>(sender())->data().toList();
|
||||||
QString targetZone = data[0].toString();
|
QString targetZone = data[0].toString();
|
||||||
int targetX = data[1].toInt();
|
int targetX = data[1].toInt();
|
||||||
|
|
||||||
// Cards need to be moved in reverse order so that the other
|
QList<CardId *> idList;
|
||||||
// cards' list index doesn't change
|
for (int i = 0; i < cards.size(); ++i)
|
||||||
for (int i = cards.size() - 1; i >= 0; i--)
|
idList.append(new CardId(cards[i]->getId()));
|
||||||
player->sendGameCommand(new Command_MoveCard(-1, getName(), cards.at(i)->getId(), player->getId(), targetZone, targetX));
|
|
||||||
|
player->sendGameCommand(new Command_MoveCard(-1, getName(), idList, player->getId(), targetZone, targetX));
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF CardZone::closestGridPoint(const QPointF &point)
|
QPointF CardZone::closestGridPoint(const QPointF &point)
|
||||||
|
|
|
@ -35,7 +35,7 @@ public slots:
|
||||||
public:
|
public:
|
||||||
enum { Type = typeZone };
|
enum { Type = typeZone };
|
||||||
int type() const { return Type; }
|
int type() const { return Type; }
|
||||||
virtual void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown) = 0;
|
virtual void handleDropEvent(const QList<CardDragItem *> &dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown) = 0;
|
||||||
CardZone(Player *_player, const QString &_name, bool _hasCardAttr, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent = 0, bool isView = false);
|
CardZone(Player *_player, const QString &_name, bool _hasCardAttr, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent = 0, bool isView = false);
|
||||||
~CardZone();
|
~CardZone();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
@ -54,6 +54,7 @@ public:
|
||||||
CardItem *getCard(int cardId, const QString &cardName);
|
CardItem *getCard(int cardId, const QString &cardName);
|
||||||
// takeCard() finds a card by position and removes it from the zone and from all of its views.
|
// takeCard() finds a card by position and removes it from the zone and from all of its views.
|
||||||
virtual CardItem *takeCard(int position, int cardId, bool canResize = true);
|
virtual CardItem *takeCard(int position, int cardId, bool canResize = true);
|
||||||
|
void removeCard(CardItem *card);
|
||||||
ZoneViewZone *getView() const { return view; }
|
ZoneViewZone *getView() const { return view; }
|
||||||
void setView(ZoneViewZone *_view) { view = _view; }
|
void setView(ZoneViewZone *_view) { view = _view; }
|
||||||
virtual void reorganizeCards() = 0;
|
virtual void reorganizeCards() = 0;
|
||||||
|
|
|
@ -37,9 +37,13 @@ void HandZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||||
card->update();
|
card->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandZone::handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||||
{
|
{
|
||||||
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), dragItem->getId(), player->getId(), getName(), cards.size(), -1, false));
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
idList.append(new CardId(dragItems[i]->getId()));
|
||||||
|
|
||||||
|
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), idList, player->getId(), getName(), cards.size(), -1, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF HandZone::boundingRect() const
|
QRectF HandZone::boundingRect() const
|
||||||
|
|
|
@ -14,7 +14,7 @@ public slots:
|
||||||
void updateOrientation();
|
void updateOrientation();
|
||||||
public:
|
public:
|
||||||
HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = 0);
|
HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = 0);
|
||||||
void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
void reorganizeCards();
|
void reorganizeCards();
|
||||||
|
|
|
@ -48,9 +48,13 @@ void PileZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||||
card->setParentItem(this);
|
card->setParentItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PileZone::handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
void PileZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||||
{
|
{
|
||||||
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), dragItem->getId(), player->getId(), getName(), 0, 0, false));
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
idList.append(new CardId(dragItems[i]->getId()));
|
||||||
|
|
||||||
|
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), idList, player->getId(), getName(), 0, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PileZone::reorganizeCards()
|
void PileZone::reorganizeCards()
|
||||||
|
|
|
@ -9,7 +9,7 @@ public:
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
void reorganizeCards();
|
void reorganizeCards();
|
||||||
void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
|
@ -563,9 +563,10 @@ void Player::actMoveTopCardsToGrave()
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
if (number > maxCards)
|
if (number > maxCards)
|
||||||
number = maxCards;
|
number = maxCards;
|
||||||
|
QList<CardId *> idList;
|
||||||
for (int i = 0; i < number; ++i)
|
for (int i = 0; i < number; ++i)
|
||||||
commandList.append(new Command_MoveCard(-1, "deck", 0, getId(), "grave", 0, 0, false));
|
idList.append(new CardId(i));
|
||||||
sendCommandContainer(new CommandContainer(commandList));
|
sendGameCommand(new Command_MoveCard(-1, "deck", idList, getId(), "grave", 0, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::actMoveTopCardsToExile()
|
void Player::actMoveTopCardsToExile()
|
||||||
|
@ -578,14 +579,15 @@ void Player::actMoveTopCardsToExile()
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
if (number > maxCards)
|
if (number > maxCards)
|
||||||
number = maxCards;
|
number = maxCards;
|
||||||
|
QList<CardId *> idList;
|
||||||
for (int i = 0; i < number; ++i)
|
for (int i = 0; i < number; ++i)
|
||||||
commandList.append(new Command_MoveCard(-1, "deck", 0, getId(), "rfg", 0, 0, false));
|
idList.append(new CardId(i));
|
||||||
sendCommandContainer(new CommandContainer(commandList));
|
sendGameCommand(new Command_MoveCard(-1, "deck", idList, getId(), "rfg", 0, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::actMoveTopCardToBottom()
|
void Player::actMoveTopCardToBottom()
|
||||||
{
|
{
|
||||||
sendGameCommand(new Command_MoveCard(-1, "deck", 0, getId(), "deck", -1, 0, false));
|
sendGameCommand(new Command_MoveCard(-1, "deck", QList<CardId *>() << new CardId(0), getId(), "deck", -1, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::actUntapAll()
|
void Player::actUntapAll()
|
||||||
|
@ -1088,10 +1090,10 @@ void Player::playCard(CardItem *c, bool faceDown, bool tapped)
|
||||||
{
|
{
|
||||||
CardInfo *ci = c->getInfo();
|
CardInfo *ci = c->getInfo();
|
||||||
if (ci->getTableRow() == 3)
|
if (ci->getTableRow() == 3)
|
||||||
sendGameCommand(new Command_MoveCard(-1, c->getZone()->getName(), c->getId(), getId(), "stack", 0, 0, false));
|
sendGameCommand(new Command_MoveCard(-1, c->getZone()->getName(), QList<CardId *>() << new CardId(c->getId()), getId(), "stack", 0, 0, false));
|
||||||
else {
|
else {
|
||||||
QPoint gridPoint = QPoint(-1, 2 - ci->getTableRow());
|
QPoint gridPoint = QPoint(-1, 2 - ci->getTableRow());
|
||||||
sendGameCommand(new Command_MoveCard(-1, c->getZone()->getName(), c->getId(), getId(), "table", gridPoint.x(), gridPoint.y(), faceDown, tapped));
|
sendGameCommand(new Command_MoveCard(-1, c->getZone()->getName(), QList<CardId *>() << new CardId(c->getId()), getId(), "table", gridPoint.x(), gridPoint.y(), faceDown, tapped));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,42 +1278,54 @@ bool Player::clearCardsToDelete()
|
||||||
void Player::cardMenuAction(QAction *a)
|
void Player::cardMenuAction(QAction *a)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> sel = scene()->selectedItems();
|
QList<QGraphicsItem *> sel = scene()->selectedItems();
|
||||||
|
QList<CardItem *> cardList;
|
||||||
|
while (!sel.isEmpty())
|
||||||
|
cardList.append(qgraphicsitem_cast<CardItem *>(sel.takeFirst()));
|
||||||
|
|
||||||
QList<Command *> commandList;
|
QList<Command *> commandList;
|
||||||
while (!sel.isEmpty()) {
|
if (a->data().toInt() <= 4)
|
||||||
unsigned int i = (unsigned int) (((double) sel.size()) * qrand() / (RAND_MAX + 1.0));
|
for (int i = 0; i < cardList.size(); ++i) {
|
||||||
CardItem *card = qgraphicsitem_cast<CardItem *>(sel.takeAt(i));
|
CardItem *card = cardList[i];
|
||||||
|
switch (a->data().toInt()) {
|
||||||
switch (a->data().toInt()) {
|
case 0:
|
||||||
case 0:
|
if (!card->getTapped())
|
||||||
if (!card->getTapped())
|
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "tapped", "1"));
|
||||||
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "tapped", "1"));
|
break;
|
||||||
break;
|
case 1:
|
||||||
case 1:
|
if (card->getTapped())
|
||||||
if (card->getTapped())
|
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "tapped", "0"));
|
||||||
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "tapped", "0"));
|
break;
|
||||||
break;
|
case 2:
|
||||||
case 2:
|
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "doesnt_untap", QString::number(!card->getDoesntUntap())));
|
||||||
commandList.append(new Command_SetCardAttr(-1, card->getZone()->getName(), card->getId(), "doesnt_untap", QString::number(!card->getDoesntUntap())));
|
break;
|
||||||
break;
|
case 3: {
|
||||||
case 3: {
|
QString zone = card->getZone()->getName();
|
||||||
QString zone = card->getZone()->getName();
|
commandList.append(new Command_FlipCard(-1, zone, card->getId(), !card->getFaceDown()));
|
||||||
commandList.append(new Command_FlipCard(-1, zone, card->getId(), !card->getFaceDown()));
|
break;
|
||||||
break;
|
}
|
||||||
|
case 4:
|
||||||
|
commandList.append(new Command_CreateToken(-1, card->getZone()->getName(), card->getName(), card->getColor(), card->getPT(), card->getAnnotation(), true, -1, card->getGridPoint().y()));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
}
|
||||||
commandList.append(new Command_CreateToken(-1, card->getZone()->getName(), card->getName(), card->getColor(), card->getPT(), card->getAnnotation(), true, -1, card->getGridPoint().y()));
|
else {
|
||||||
break;
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < cardList.size(); ++i)
|
||||||
|
idList.append(new CardId(cardList[i]->getId()));
|
||||||
|
QString startZone = cardList[0]->getZone()->getName();
|
||||||
|
|
||||||
|
switch (a->data().toInt()) {
|
||||||
case 5:
|
case 5:
|
||||||
commandList.append(new Command_MoveCard(-1, card->getZone()->getName(), card->getId(), getId(), "deck", 0, 0, false));
|
commandList.append(new Command_MoveCard(-1, startZone, idList, getId(), "deck", 0, 0, false));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
commandList.append(new Command_MoveCard(-1, card->getZone()->getName(), card->getId(), getId(), "deck", -1, 0, false));
|
commandList.append(new Command_MoveCard(-1, startZone, idList, getId(), "deck", -1, 0, false));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
commandList.append(new Command_MoveCard(-1, card->getZone()->getName(), card->getId(), getId(), "grave", 0, 0, false));
|
commandList.append(new Command_MoveCard(-1, startZone, idList, getId(), "grave", 0, 0, false));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
commandList.append(new Command_MoveCard(-1, card->getZone()->getName(), card->getId(), getId(), "rfg", 0, 0, false));
|
commandList.append(new Command_MoveCard(-1, startZone, idList, getId(), "rfg", 0, 0, false));
|
||||||
break;
|
break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,16 @@ void StackZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*optio
|
||||||
painter->fillRect(boundingRect(), QBrush(bgPixmap));
|
painter->fillRect(boundingRect(), QBrush(bgPixmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackZone::handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||||
{
|
{
|
||||||
if (startZone == this)
|
if (startZone == this)
|
||||||
return;
|
return;
|
||||||
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), dragItem->getId(), player->getId(), getName(), 0, 0, false));
|
|
||||||
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
idList.append(new CardId(dragItems[i]->getId()));
|
||||||
|
|
||||||
|
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), idList, player->getId(), getName(), 0, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackZone::reorganizeCards()
|
void StackZone::reorganizeCards()
|
||||||
|
|
|
@ -12,7 +12,7 @@ private slots:
|
||||||
void updateBgPixmap();
|
void updateBgPixmap();
|
||||||
public:
|
public:
|
||||||
StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = 0);
|
StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = 0);
|
||||||
void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
void reorganizeCards();
|
void reorganizeCards();
|
||||||
|
|
|
@ -85,14 +85,18 @@ void TableZone::addCardImpl(CardItem *card, int _x, int _y)
|
||||||
card->update();
|
card->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown)
|
void TableZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown)
|
||||||
{
|
{
|
||||||
handleDropEventByGrid(dragItem, startZone, mapToGrid(dropPoint), faceDown);
|
handleDropEventByGrid(dragItems, startZone, mapToGrid(dropPoint), faceDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::handleDropEventByGrid(CardDragItem *dragItem, CardZone *startZone, const QPoint &gridPoint, bool faceDown, bool tapped)
|
void TableZone::handleDropEventByGrid(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &gridPoint, bool faceDown, bool tapped)
|
||||||
{
|
{
|
||||||
static_cast<CardItem *>(dragItem->getItem())->getZone()->getPlayer()->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), dragItem->getId(), player->getId(), getName(), gridPoint.x(), gridPoint.y(), faceDown, tapped));
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
idList.append(new CardId(dragItems[i]->getId()));
|
||||||
|
|
||||||
|
startZone->getPlayer()->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), idList, player->getId(), getName(), gridPoint.x(), gridPoint.y(), faceDown, tapped));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::reorganizeCards()
|
void TableZone::reorganizeCards()
|
||||||
|
|
|
@ -29,8 +29,8 @@ public:
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
void toggleTapped();
|
void toggleTapped();
|
||||||
void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown = false);
|
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown = false);
|
||||||
void handleDropEventByGrid(CardDragItem *dragItem, CardZone *startZone, const QPoint &gridPoint, bool faceDown = false, bool tapped = false);
|
void handleDropEventByGrid(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &gridPoint, bool faceDown = false, bool tapped = false);
|
||||||
CardItem *getCardFromGrid(const QPoint &gridPoint) const;
|
CardItem *getCardFromGrid(const QPoint &gridPoint) const;
|
||||||
CardItem *getCardFromCoords(const QPointF &point) const;
|
CardItem *getCardFromCoords(const QPointF &point) const;
|
||||||
QPointF mapFromGrid(QPoint gridPoint) const;
|
QPointF mapFromGrid(QPoint gridPoint) const;
|
||||||
|
|
|
@ -159,8 +159,10 @@ void MainWindow::actAbout()
|
||||||
+ "<br><br><br><b>" + tr("Authors:") + "</b><br>Max-Wilhelm Bruker<br>Marcus Schütz<br><br>"
|
+ "<br><br><br><b>" + tr("Authors:") + "</b><br>Max-Wilhelm Bruker<br>Marcus Schütz<br><br>"
|
||||||
+ "<b>" + tr("Translators:") + "</b><br>"
|
+ "<b>" + tr("Translators:") + "</b><br>"
|
||||||
+ tr("Spanish:") + " Víctor Martínez<br>"
|
+ tr("Spanish:") + " Víctor Martínez<br>"
|
||||||
+ tr("Portugese:") + " Milton Gonçalves<br>"
|
+ tr("Portugese (Portugal):") + " Milton Gonçalves<br>"
|
||||||
|
+ tr("Portugese (Brazil):") + " Thiago Queiroz<br>"
|
||||||
+ tr("French:") + " Yannick Hammer<br>"
|
+ tr("French:") + " Yannick Hammer<br>"
|
||||||
|
+ tr("Japanese:") + " Takumi Nakase<br>"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ void ZoneViewZone::initializeCards(const QList<ServerInfo_Card *> &cardList)
|
||||||
{
|
{
|
||||||
if (!cardList.isEmpty()) {
|
if (!cardList.isEmpty()) {
|
||||||
for (int i = 0; i < cardList.size(); ++i)
|
for (int i = 0; i < cardList.size(); ++i)
|
||||||
addCard(new CardItem(player, cardList[i]->getName(), cardList[i]->getId(), this), false, i);
|
addCard(new CardItem(player, cardList[i]->getName(), cardList[i]->getId(), revealZone, this), false, i);
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
} else if (!origZone->contentsKnown()) {
|
} else if (!origZone->contentsKnown()) {
|
||||||
Command_DumpZone *command = new Command_DumpZone(-1, player->getId(), name, numberCards);
|
Command_DumpZone *command = new Command_DumpZone(-1, player->getId(), name, numberCards);
|
||||||
|
@ -44,7 +44,7 @@ void ZoneViewZone::initializeCards(const QList<ServerInfo_Card *> &cardList)
|
||||||
int number = numberCards == -1 ? c.size() : (numberCards < c.size() ? numberCards : c.size());
|
int number = numberCards == -1 ? c.size() : (numberCards < c.size() ? numberCards : c.size());
|
||||||
for (int i = 0; i < number; i++) {
|
for (int i = 0; i < number; i++) {
|
||||||
CardItem *card = c.at(i);
|
CardItem *card = c.at(i);
|
||||||
addCard(new CardItem(player, card->getName(), card->getId(), this), false, i);
|
addCard(new CardItem(player, card->getName(), card->getId(), revealZone, this), false, i);
|
||||||
}
|
}
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ void ZoneViewZone::zoneDumpReceived(ProtocolResponse *r)
|
||||||
|
|
||||||
const QList<ServerInfo_Card *> &respCardList = resp->getZone()->getCardList();
|
const QList<ServerInfo_Card *> &respCardList = resp->getZone()->getCardList();
|
||||||
for (int i = 0; i < respCardList.size(); i++) {
|
for (int i = 0; i < respCardList.size(); i++) {
|
||||||
CardItem *card = new CardItem(player, respCardList[i]->getName(), respCardList[i]->getId(), this);
|
CardItem *card = new CardItem(player, respCardList[i]->getName(), respCardList[i]->getId(), revealZone, this);
|
||||||
addCard(card, false, i);
|
addCard(card, false, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ void ZoneViewZone::reorganizeCards()
|
||||||
cols = 2;
|
cols = 2;
|
||||||
|
|
||||||
qDebug() << "reorganizeCards: rows=" << rows << "cols=" << cols;
|
qDebug() << "reorganizeCards: rows=" << rows << "cols=" << cols;
|
||||||
qDebug() << "SORT BY NAME:" << sortByName << "SORT BY TYPE:" << sortByType;
|
|
||||||
|
|
||||||
CardList cardsToDisplay(cards);
|
CardList cardsToDisplay(cards);
|
||||||
if (sortByName || sortByType)
|
if (sortByName || sortByType)
|
||||||
|
@ -125,9 +124,13 @@ void ZoneViewZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||||
card->update();
|
card->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewZone::handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
void ZoneViewZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||||
{
|
{
|
||||||
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), dragItem->getId(), player->getId(), getName(), 0, 0, false));
|
QList<CardId *> idList;
|
||||||
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
idList.append(new CardId(dragItems[i]->getId()));
|
||||||
|
|
||||||
|
player->sendGameCommand(new Command_MoveCard(-1, startZone->getName(), idList, player->getId(), getName(), 0, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewZone::removeCard(int position)
|
void ZoneViewZone::removeCard(int position)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ZoneViewZone : public SelectZone, public QGraphicsLayoutItem {
|
||||||
private:
|
private:
|
||||||
QRectF bRect, optimumRect;
|
QRectF bRect, optimumRect;
|
||||||
int minRows, numberCards;
|
int minRows, numberCards;
|
||||||
void handleDropEvent(CardDragItem *dragItem, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
||||||
CardZone *origZone;
|
CardZone *origZone;
|
||||||
bool revealZone;
|
bool revealZone;
|
||||||
bool sortByName, sortByType;
|
bool sortByName, sortByType;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,7 @@ void ProtocolItem::initializeHash()
|
||||||
registerSerializableItem("player_ping", ServerInfo_PlayerPing::newItem);
|
registerSerializableItem("player_ping", ServerInfo_PlayerPing::newItem);
|
||||||
registerSerializableItem("file", DeckList_File::newItem);
|
registerSerializableItem("file", DeckList_File::newItem);
|
||||||
registerSerializableItem("directory", DeckList_Directory::newItem);
|
registerSerializableItem("directory", DeckList_Directory::newItem);
|
||||||
|
registerSerializableItem("card_id", CardId::newItem);
|
||||||
|
|
||||||
registerSerializableItem("containercmd", CommandContainer::newItem);
|
registerSerializableItem("containercmd", CommandContainer::newItem);
|
||||||
registerSerializableItem("containergame_event", GameEventContainer::newItem);
|
registerSerializableItem("containergame_event", GameEventContainer::newItem);
|
||||||
|
@ -34,6 +35,7 @@ void ProtocolItem::initializeHash()
|
||||||
registerSerializableItem("cmddeck_upload", Command_DeckUpload::newItem);
|
registerSerializableItem("cmddeck_upload", Command_DeckUpload::newItem);
|
||||||
registerSerializableItem("cmddeck_select", Command_DeckSelect::newItem);
|
registerSerializableItem("cmddeck_select", Command_DeckSelect::newItem);
|
||||||
registerSerializableItem("cmdset_sideboard_plan", Command_SetSideboardPlan::newItem);
|
registerSerializableItem("cmdset_sideboard_plan", Command_SetSideboardPlan::newItem);
|
||||||
|
registerSerializableItem("cmdmove_card", Command_MoveCard::newItem);
|
||||||
|
|
||||||
registerSerializableItem("resp", ProtocolResponse::newItem);
|
registerSerializableItem("resp", ProtocolResponse::newItem);
|
||||||
ProtocolResponse::initializeHash();
|
ProtocolResponse::initializeHash();
|
||||||
|
@ -198,6 +200,21 @@ QList<MoveCardToZone *> Command_SetSideboardPlan::getMoveList() const
|
||||||
return typecastItemList<MoveCardToZone *>();
|
return typecastItemList<MoveCardToZone *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, const QList<CardId *> &_cardIds, int _targetPlayerId, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped)
|
||||||
|
: GameCommand("move_card", _gameId)
|
||||||
|
{
|
||||||
|
insertItem(new SerializableItem_String("start_zone", _startZone));
|
||||||
|
insertItem(new SerializableItem_Int("target_player_id", _targetPlayerId));
|
||||||
|
insertItem(new SerializableItem_String("target_zone", _targetZone));
|
||||||
|
insertItem(new SerializableItem_Int("x", _x));
|
||||||
|
insertItem(new SerializableItem_Int("y", _y));
|
||||||
|
insertItem(new SerializableItem_Bool("face_down", _faceDown));
|
||||||
|
insertItem(new SerializableItem_Bool("tapped", _tapped));
|
||||||
|
|
||||||
|
for (int i = 0; i < _cardIds.size(); ++i)
|
||||||
|
itemList.append(_cardIds[i]);
|
||||||
|
}
|
||||||
|
|
||||||
QHash<QString, ResponseCode> ProtocolResponse::responseHash;
|
QHash<QString, ResponseCode> ProtocolResponse::responseHash;
|
||||||
|
|
||||||
ProtocolResponse::ProtocolResponse(int _cmdId, ResponseCode _responseCode, const QString &_itemName)
|
ProtocolResponse::ProtocolResponse(int _cmdId, ResponseCode _responseCode, const QString &_itemName)
|
||||||
|
|
|
@ -25,6 +25,7 @@ enum ItemId {
|
||||||
ItemId_Command_DeckUpload = ItemId_Other + 100,
|
ItemId_Command_DeckUpload = ItemId_Other + 100,
|
||||||
ItemId_Command_DeckSelect = ItemId_Other + 101,
|
ItemId_Command_DeckSelect = ItemId_Other + 101,
|
||||||
ItemId_Command_SetSideboardPlan = ItemId_Other + 102,
|
ItemId_Command_SetSideboardPlan = ItemId_Other + 102,
|
||||||
|
ItemId_Command_MoveCard = ItemId_Other + 103,
|
||||||
ItemId_Event_ListRooms = ItemId_Other + 200,
|
ItemId_Event_ListRooms = ItemId_Other + 200,
|
||||||
ItemId_Event_JoinRoom = ItemId_Other + 201,
|
ItemId_Event_JoinRoom = ItemId_Other + 201,
|
||||||
ItemId_Event_ListGames = ItemId_Other + 203,
|
ItemId_Event_ListGames = ItemId_Other + 203,
|
||||||
|
@ -200,6 +201,22 @@ public:
|
||||||
QList<MoveCardToZone *> getMoveList() const;
|
QList<MoveCardToZone *> getMoveList() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Command_MoveCard : public GameCommand {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Command_MoveCard(int _gameId = -1, const QString &_startZone = QString(), const QList<CardId *> &_cardIds = QList<CardId *>(), int _targetPlayerId = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false, bool _tapped = false);
|
||||||
|
QString getStartZone() const { return static_cast<SerializableItem_String *>(itemMap.value("start_zone"))->getData(); }
|
||||||
|
QList<CardId *> getCardIds() const { return typecastItemList<CardId *>(); }
|
||||||
|
int getTargetPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_player_id"))->getData(); }
|
||||||
|
QString getTargetZone() const { return static_cast<SerializableItem_String *>(itemMap.value("target_zone"))->getData(); }
|
||||||
|
int getX() const { return static_cast<SerializableItem_Int *>(itemMap.value("x"))->getData(); }
|
||||||
|
int getY() const { return static_cast<SerializableItem_Int *>(itemMap.value("y"))->getData(); }
|
||||||
|
bool getFaceDown() const { return static_cast<SerializableItem_Bool *>(itemMap.value("face_down"))->getData(); }
|
||||||
|
bool getTapped() const { return static_cast<SerializableItem_Bool *>(itemMap.value("tapped"))->getData(); }
|
||||||
|
static SerializableItem *newItem() { return new Command_MoveCard; }
|
||||||
|
int getItemId() const { return ItemId_Command_MoveCard; }
|
||||||
|
};
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// --- RESPONSES ---
|
// --- RESPONSES ---
|
||||||
// -----------------
|
// -----------------
|
||||||
|
|
|
@ -20,6 +20,12 @@ enum ResponseCode { RespNothing, RespOk, RespInvalidCommand, RespInvalidData, Re
|
||||||
// list index, whereas cards in any other zone are referenced by their ids.
|
// list index, whereas cards in any other zone are referenced by their ids.
|
||||||
enum ZoneType { PrivateZone, PublicZone, HiddenZone };
|
enum ZoneType { PrivateZone, PublicZone, HiddenZone };
|
||||||
|
|
||||||
|
class CardId : public SerializableItem_Int {
|
||||||
|
public:
|
||||||
|
CardId(int _cardId = -1) : SerializableItem_Int("card_id", _cardId) { }
|
||||||
|
static SerializableItem *newItem() { return new CardId; }
|
||||||
|
};
|
||||||
|
|
||||||
class ServerInfo_User : public SerializableItem_Map {
|
class ServerInfo_User : public SerializableItem_Map {
|
||||||
public:
|
public:
|
||||||
enum UserLevelFlags {
|
enum UserLevelFlags {
|
||||||
|
|
|
@ -21,54 +21,53 @@ ItemId_Command_Shuffle = 1019,
|
||||||
ItemId_Command_Mulligan = 1020,
|
ItemId_Command_Mulligan = 1020,
|
||||||
ItemId_Command_RollDie = 1021,
|
ItemId_Command_RollDie = 1021,
|
||||||
ItemId_Command_DrawCards = 1022,
|
ItemId_Command_DrawCards = 1022,
|
||||||
ItemId_Command_MoveCard = 1023,
|
ItemId_Command_FlipCard = 1023,
|
||||||
ItemId_Command_FlipCard = 1024,
|
ItemId_Command_AttachCard = 1024,
|
||||||
ItemId_Command_AttachCard = 1025,
|
ItemId_Command_CreateToken = 1025,
|
||||||
ItemId_Command_CreateToken = 1026,
|
ItemId_Command_CreateArrow = 1026,
|
||||||
ItemId_Command_CreateArrow = 1027,
|
ItemId_Command_DeleteArrow = 1027,
|
||||||
ItemId_Command_DeleteArrow = 1028,
|
ItemId_Command_SetCardAttr = 1028,
|
||||||
ItemId_Command_SetCardAttr = 1029,
|
ItemId_Command_SetCardCounter = 1029,
|
||||||
ItemId_Command_SetCardCounter = 1030,
|
ItemId_Command_IncCardCounter = 1030,
|
||||||
ItemId_Command_IncCardCounter = 1031,
|
ItemId_Command_ReadyStart = 1031,
|
||||||
ItemId_Command_ReadyStart = 1032,
|
ItemId_Command_Concede = 1032,
|
||||||
ItemId_Command_Concede = 1033,
|
ItemId_Command_IncCounter = 1033,
|
||||||
ItemId_Command_IncCounter = 1034,
|
ItemId_Command_CreateCounter = 1034,
|
||||||
ItemId_Command_CreateCounter = 1035,
|
ItemId_Command_SetCounter = 1035,
|
||||||
ItemId_Command_SetCounter = 1036,
|
ItemId_Command_DelCounter = 1036,
|
||||||
ItemId_Command_DelCounter = 1037,
|
ItemId_Command_NextTurn = 1037,
|
||||||
ItemId_Command_NextTurn = 1038,
|
ItemId_Command_SetActivePhase = 1038,
|
||||||
ItemId_Command_SetActivePhase = 1039,
|
ItemId_Command_DumpZone = 1039,
|
||||||
ItemId_Command_DumpZone = 1040,
|
ItemId_Command_StopDumpZone = 1040,
|
||||||
ItemId_Command_StopDumpZone = 1041,
|
ItemId_Command_RevealCards = 1041,
|
||||||
ItemId_Command_RevealCards = 1042,
|
ItemId_Event_Say = 1042,
|
||||||
ItemId_Event_Say = 1043,
|
ItemId_Event_Leave = 1043,
|
||||||
ItemId_Event_Leave = 1044,
|
ItemId_Event_GameClosed = 1044,
|
||||||
ItemId_Event_GameClosed = 1045,
|
ItemId_Event_Shuffle = 1045,
|
||||||
ItemId_Event_Shuffle = 1046,
|
ItemId_Event_RollDie = 1046,
|
||||||
ItemId_Event_RollDie = 1047,
|
ItemId_Event_MoveCard = 1047,
|
||||||
ItemId_Event_MoveCard = 1048,
|
ItemId_Event_FlipCard = 1048,
|
||||||
ItemId_Event_FlipCard = 1049,
|
ItemId_Event_DestroyCard = 1049,
|
||||||
ItemId_Event_DestroyCard = 1050,
|
ItemId_Event_AttachCard = 1050,
|
||||||
ItemId_Event_AttachCard = 1051,
|
ItemId_Event_CreateToken = 1051,
|
||||||
ItemId_Event_CreateToken = 1052,
|
ItemId_Event_DeleteArrow = 1052,
|
||||||
ItemId_Event_DeleteArrow = 1053,
|
ItemId_Event_SetCardAttr = 1053,
|
||||||
ItemId_Event_SetCardAttr = 1054,
|
ItemId_Event_SetCardCounter = 1054,
|
||||||
ItemId_Event_SetCardCounter = 1055,
|
ItemId_Event_SetCounter = 1055,
|
||||||
ItemId_Event_SetCounter = 1056,
|
ItemId_Event_DelCounter = 1056,
|
||||||
ItemId_Event_DelCounter = 1057,
|
ItemId_Event_SetActivePlayer = 1057,
|
||||||
ItemId_Event_SetActivePlayer = 1058,
|
ItemId_Event_SetActivePhase = 1058,
|
||||||
ItemId_Event_SetActivePhase = 1059,
|
ItemId_Event_DumpZone = 1059,
|
||||||
ItemId_Event_DumpZone = 1060,
|
ItemId_Event_StopDumpZone = 1060,
|
||||||
ItemId_Event_StopDumpZone = 1061,
|
ItemId_Event_ServerMessage = 1061,
|
||||||
ItemId_Event_ServerMessage = 1062,
|
ItemId_Event_Message = 1062,
|
||||||
ItemId_Event_Message = 1063,
|
ItemId_Event_GameJoined = 1063,
|
||||||
ItemId_Event_GameJoined = 1064,
|
ItemId_Event_UserLeft = 1064,
|
||||||
ItemId_Event_UserLeft = 1065,
|
ItemId_Event_LeaveRoom = 1065,
|
||||||
ItemId_Event_LeaveRoom = 1066,
|
ItemId_Event_RoomSay = 1066,
|
||||||
ItemId_Event_RoomSay = 1067,
|
ItemId_Context_ReadyStart = 1067,
|
||||||
ItemId_Context_ReadyStart = 1068,
|
ItemId_Context_Concede = 1068,
|
||||||
ItemId_Context_Concede = 1069,
|
ItemId_Context_DeckSelect = 1069,
|
||||||
ItemId_Context_DeckSelect = 1070,
|
ItemId_Command_UpdateServerMessage = 1070,
|
||||||
ItemId_Command_UpdateServerMessage = 1071,
|
ItemId_Other = 1071
|
||||||
ItemId_Other = 1072
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,18 +114,6 @@ Command_DrawCards::Command_DrawCards(int _gameId, int _number)
|
||||||
{
|
{
|
||||||
insertItem(new SerializableItem_Int("number", _number));
|
insertItem(new SerializableItem_Int("number", _number));
|
||||||
}
|
}
|
||||||
Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, int _cardId, int _targetPlayerId, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped)
|
|
||||||
: GameCommand("move_card", _gameId)
|
|
||||||
{
|
|
||||||
insertItem(new SerializableItem_String("start_zone", _startZone));
|
|
||||||
insertItem(new SerializableItem_Int("card_id", _cardId));
|
|
||||||
insertItem(new SerializableItem_Int("target_player_id", _targetPlayerId));
|
|
||||||
insertItem(new SerializableItem_String("target_zone", _targetZone));
|
|
||||||
insertItem(new SerializableItem_Int("x", _x));
|
|
||||||
insertItem(new SerializableItem_Int("y", _y));
|
|
||||||
insertItem(new SerializableItem_Bool("face_down", _faceDown));
|
|
||||||
insertItem(new SerializableItem_Bool("tapped", _tapped));
|
|
||||||
}
|
|
||||||
Command_FlipCard::Command_FlipCard(int _gameId, const QString &_zone, int _cardId, bool _faceDown)
|
Command_FlipCard::Command_FlipCard(int _gameId, const QString &_zone, int _cardId, bool _faceDown)
|
||||||
: GameCommand("flip_card", _gameId)
|
: GameCommand("flip_card", _gameId)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +453,6 @@ void ProtocolItem::initializeHashAuto()
|
||||||
itemNameHash.insert("cmdmulligan", Command_Mulligan::newItem);
|
itemNameHash.insert("cmdmulligan", Command_Mulligan::newItem);
|
||||||
itemNameHash.insert("cmdroll_die", Command_RollDie::newItem);
|
itemNameHash.insert("cmdroll_die", Command_RollDie::newItem);
|
||||||
itemNameHash.insert("cmddraw_cards", Command_DrawCards::newItem);
|
itemNameHash.insert("cmddraw_cards", Command_DrawCards::newItem);
|
||||||
itemNameHash.insert("cmdmove_card", Command_MoveCard::newItem);
|
|
||||||
itemNameHash.insert("cmdflip_card", Command_FlipCard::newItem);
|
itemNameHash.insert("cmdflip_card", Command_FlipCard::newItem);
|
||||||
itemNameHash.insert("cmdattach_card", Command_AttachCard::newItem);
|
itemNameHash.insert("cmdattach_card", Command_AttachCard::newItem);
|
||||||
itemNameHash.insert("cmdcreate_token", Command_CreateToken::newItem);
|
itemNameHash.insert("cmdcreate_token", Command_CreateToken::newItem);
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
2:mulligan
|
2:mulligan
|
||||||
2:roll_die:i,sides
|
2:roll_die:i,sides
|
||||||
2:draw_cards:i,number
|
2:draw_cards:i,number
|
||||||
2:move_card:s,start_zone:i,card_id:i,target_player_id:s,target_zone:i,x:i,y:b,face_down:b,tapped
|
|
||||||
2:flip_card:s,zone:i,card_id:b,face_down
|
2:flip_card:s,zone:i,card_id:b,face_down
|
||||||
2:attach_card:s,start_zone:i,card_id:i,target_player_id:s,target_zone:i,target_card_id
|
2:attach_card:s,start_zone:i,card_id:i,target_player_id:s,target_zone:i,target_card_id
|
||||||
2:create_token:s,zone:s,card_name:s,color:s,pt:s,annotation:b,destroy:i,x:i,y
|
2:create_token:s,zone:s,card_name:s,color:s,pt:s,annotation:b,destroy:i,x:i,y
|
||||||
|
@ -68,4 +67,4 @@
|
||||||
6:ready_start
|
6:ready_start
|
||||||
6:concede
|
6:concede
|
||||||
6:deck_select:i,deck_id
|
6:deck_select:i,deck_id
|
||||||
7:update_server_message
|
7:update_server_message
|
||||||
|
|
|
@ -182,21 +182,6 @@ public:
|
||||||
static SerializableItem *newItem() { return new Command_DrawCards; }
|
static SerializableItem *newItem() { return new Command_DrawCards; }
|
||||||
int getItemId() const { return ItemId_Command_DrawCards; }
|
int getItemId() const { return ItemId_Command_DrawCards; }
|
||||||
};
|
};
|
||||||
class Command_MoveCard : public GameCommand {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
Command_MoveCard(int _gameId = -1, const QString &_startZone = QString(), int _cardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false, bool _tapped = false);
|
|
||||||
QString getStartZone() const { return static_cast<SerializableItem_String *>(itemMap.value("start_zone"))->getData(); };
|
|
||||||
int getCardId() const { return static_cast<SerializableItem_Int *>(itemMap.value("card_id"))->getData(); };
|
|
||||||
int getTargetPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_player_id"))->getData(); };
|
|
||||||
QString getTargetZone() const { return static_cast<SerializableItem_String *>(itemMap.value("target_zone"))->getData(); };
|
|
||||||
int getX() const { return static_cast<SerializableItem_Int *>(itemMap.value("x"))->getData(); };
|
|
||||||
int getY() const { return static_cast<SerializableItem_Int *>(itemMap.value("y"))->getData(); };
|
|
||||||
bool getFaceDown() const { return static_cast<SerializableItem_Bool *>(itemMap.value("face_down"))->getData(); };
|
|
||||||
bool getTapped() const { return static_cast<SerializableItem_Bool *>(itemMap.value("tapped"))->getData(); };
|
|
||||||
static SerializableItem *newItem() { return new Command_MoveCard; }
|
|
||||||
int getItemId() const { return ItemId_Command_MoveCard; }
|
|
||||||
};
|
|
||||||
class Command_FlipCard : public GameCommand {
|
class Command_FlipCard : public GameCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "server_card.h"
|
#include "server_card.h"
|
||||||
#include "server_player.h"
|
#include "server_player.h"
|
||||||
#include "rng_abstract.h"
|
#include "rng_abstract.h"
|
||||||
|
#include <QSet>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
Server_CardZone::Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ZoneType _type)
|
Server_CardZone::Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ZoneType _type)
|
||||||
: player(_player), name(_name), has_coords(_has_coords), type(_type), cardsBeingLookedAt(0)
|
: player(_player), name(_name), has_coords(_has_coords), type(_type), cardsBeingLookedAt(0)
|
||||||
|
@ -29,7 +31,7 @@ Server_CardZone::Server_CardZone(Server_Player *_player, const QString &_name, b
|
||||||
|
|
||||||
Server_CardZone::~Server_CardZone()
|
Server_CardZone::~Server_CardZone()
|
||||||
{
|
{
|
||||||
qDebug(QString("Server_CardZone destructor: %1").arg(name).toLatin1());
|
qDebug() << "Server_CardZone destructor:" << name;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +43,13 @@ void Server_CardZone::shuffle()
|
||||||
cards = temp;
|
cards = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Server_CardZone::removeCard(Server_Card *card)
|
||||||
|
{
|
||||||
|
int index = cards.indexOf(card);
|
||||||
|
cards.removeAt(index);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
Server_Card *Server_CardZone::getCard(int id, bool remove, int *position)
|
Server_Card *Server_CardZone::getCard(int id, bool remove, int *position)
|
||||||
{
|
{
|
||||||
if (type != HiddenZone) {
|
if (type != HiddenZone) {
|
||||||
|
@ -146,29 +155,37 @@ bool Server_CardZone::isColumnEmpty(int x, int y) const
|
||||||
void Server_CardZone::moveCard(CommandContainer *cont, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y)
|
void Server_CardZone::moveCard(CommandContainer *cont, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y)
|
||||||
{
|
{
|
||||||
coordMap.remove(card->getX());
|
coordMap.remove(card->getX());
|
||||||
player->moveCard(cont, this, card->getId(), this, x, y, card->getFaceDown(), false);
|
player->moveCard(cont, this, QList<int>() << card->getId(), this, x, y, card->getFaceDown(), false);
|
||||||
coordMap.insert(x, card);
|
coordMap.insert(x, card);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_CardZone::fixFreeSpaces(CommandContainer *cont, int x, int y)
|
void Server_CardZone::fixFreeSpaces(CommandContainer *cont)
|
||||||
{
|
{
|
||||||
QMap<int, Server_Card *> coordMap;
|
QMap<int, Server_Card *> coordMap;
|
||||||
for (int i = 0; i < cards.size(); ++i)
|
QSet<int> placesToLook;
|
||||||
if (cards[i]->getY() == y)
|
for (int i = 0; i < cards.size(); ++i) {
|
||||||
coordMap.insert(cards[i]->getX(), cards[i]);
|
coordMap.insert(cards[i]->getY() * 10000 + cards[i]->getX(), cards[i]);
|
||||||
|
placesToLook.insert(cards[i]->getY() * 10000 + (cards[i]->getX() / 3) * 3);
|
||||||
int baseX = (x / 3) * 3;
|
}
|
||||||
if (!coordMap.contains(baseX)) {
|
|
||||||
if (coordMap.contains(baseX + 1))
|
QSetIterator<int> placeIterator(placesToLook);
|
||||||
moveCard(cont, coordMap, coordMap.value(baseX + 1), baseX, y);
|
while (placeIterator.hasNext()) {
|
||||||
else if (coordMap.contains(baseX + 2)) {
|
int foo = placeIterator.next();
|
||||||
moveCard(cont, coordMap, coordMap.value(baseX + 2), baseX, y);
|
int y = foo / 10000;
|
||||||
return;
|
int baseX = foo - y * 10000;
|
||||||
} else
|
|
||||||
return;
|
if (!coordMap.contains(y * 10000 + baseX)) {
|
||||||
|
if (coordMap.contains(y * 10000 + baseX + 1))
|
||||||
|
moveCard(cont, coordMap, coordMap.value(y * 10000 + baseX + 1), baseX, y);
|
||||||
|
else if (coordMap.contains(baseX + 2)) {
|
||||||
|
moveCard(cont, coordMap, coordMap.value(y * 10000 + baseX + 2), baseX, y);
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!coordMap.contains(y * 10000 + baseX + 1) && coordMap.contains(y * 10000 + baseX + 2))
|
||||||
|
moveCard(cont, coordMap, coordMap.value(y * 10000 + baseX + 2), baseX + 1, y);
|
||||||
}
|
}
|
||||||
if (!coordMap.contains(baseX + 1) && coordMap.contains(baseX + 2))
|
|
||||||
moveCard(cont, coordMap, coordMap.value(baseX + 2), baseX + 1, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_CardZone::insertCard(Server_Card *card, int x, int y)
|
void Server_CardZone::insertCard(Server_Card *card, int x, int y)
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ZoneType _type);
|
Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ZoneType _type);
|
||||||
~Server_CardZone();
|
~Server_CardZone();
|
||||||
|
|
||||||
|
int removeCard(Server_Card *card);
|
||||||
Server_Card *getCard(int id, bool remove, int *position = NULL);
|
Server_Card *getCard(int id, bool remove, int *position = NULL);
|
||||||
|
|
||||||
int getCardsBeingLookedAt() const { return cardsBeingLookedAt; }
|
int getCardsBeingLookedAt() const { return cardsBeingLookedAt; }
|
||||||
|
@ -52,7 +53,7 @@ public:
|
||||||
int getFreeGridColumn(int x, int y, const QString &cardName) const;
|
int getFreeGridColumn(int x, int y, const QString &cardName) 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(CommandContainer *cont, int x, int y);
|
void fixFreeSpaces(CommandContainer *cont);
|
||||||
void moveCard(CommandContainer *cont, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y);
|
void moveCard(CommandContainer *cont, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y);
|
||||||
QList<Server_Card *> cards;
|
QList<Server_Card *> cards;
|
||||||
void insertCard(Server_Card *card, int x, int y);
|
void insertCard(Server_Card *card, int x, int y);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "protocol_items.h"
|
#include "protocol_items.h"
|
||||||
#include "decklist.h"
|
#include "decklist.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
Server_Player::Server_Player(Server_Game *_game, int _playerId, ServerInfo_User *_userInfo, bool _spectator, Server_ProtocolHandler *_handler)
|
Server_Player::Server_Player(Server_Game *_game, int _playerId, ServerInfo_User *_userInfo, bool _spectator, Server_ProtocolHandler *_handler)
|
||||||
: game(_game), handler(_handler), userInfo(new ServerInfo_User(_userInfo)), deck(0), playerId(_playerId), spectator(_spectator), nextCardId(0), readyStart(false), conceded(false), deckId(-2)
|
: game(_game), handler(_handler), userInfo(new ServerInfo_User(_userInfo)), deck(0), playerId(_playerId), spectator(_spectator), nextCardId(0), readyStart(false), conceded(false), deckId(-2)
|
||||||
|
@ -198,7 +199,7 @@ bool Server_Player::deleteCounter(int counterId)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_startZone, int _cardId, int targetPlayerId, const QString &_targetZone, int x, int y, bool faceDown, bool tapped)
|
ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_startZone, const QList<int> &_cardIds, int targetPlayerId, const QString &_targetZone, int x, int y, bool faceDown, bool tapped)
|
||||||
{
|
{
|
||||||
Server_CardZone *startzone = getZones().value(_startZone);
|
Server_CardZone *startzone = getZones().value(_startZone);
|
||||||
Server_Player *targetPlayer = game->getPlayers().value(targetPlayerId);
|
Server_Player *targetPlayer = game->getPlayers().value(targetPlayerId);
|
||||||
|
@ -208,128 +209,168 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_sta
|
||||||
if ((!startzone) || (!targetzone))
|
if ((!startzone) || (!targetzone))
|
||||||
return RespNameNotFound;
|
return RespNameNotFound;
|
||||||
|
|
||||||
return moveCard(cont, startzone, _cardId, targetzone, x, y, faceDown, tapped);
|
return moveCard(cont, startzone, _cardIds, targetzone, x, y, faceDown, tapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *startzone, int _cardId, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped)
|
class Server_Player::MoveCardCompareFunctor {
|
||||||
|
private:
|
||||||
|
int x;
|
||||||
|
public:
|
||||||
|
MoveCardCompareFunctor(int _x) : x(_x) { }
|
||||||
|
inline bool operator()(QPair<Server_Card *, int> a, QPair<Server_Card *, int> b)
|
||||||
|
{
|
||||||
|
if (a.second < x) {
|
||||||
|
if (b.second >= x)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return (a.second > b.second);
|
||||||
|
} else {
|
||||||
|
if (b.second < x)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return (a.second < b.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<int> &_cardIds, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped)
|
||||||
{
|
{
|
||||||
// Disallow controller change between different zones.
|
// Disallow controller change between different zones.
|
||||||
if ((startzone->getName() != targetzone->getName()) && (startzone->getPlayer() != targetzone->getPlayer()))
|
if ((startzone->getName() != targetzone->getName()) && (startzone->getPlayer() != targetzone->getPlayer()))
|
||||||
return RespContextError;
|
return RespContextError;
|
||||||
|
|
||||||
int position = -1;
|
if (!targetzone->hasCoords() && (x == -1))
|
||||||
Server_Card *card = startzone->getCard(_cardId, false, &position);
|
x = targetzone->cards.size();
|
||||||
if (!card)
|
|
||||||
return RespNameNotFound;
|
|
||||||
if (!card->getAttachedCards().isEmpty() && !targetzone->isColumnEmpty(x, y))
|
|
||||||
return RespContextError;
|
|
||||||
startzone->getCard(_cardId, true);
|
|
||||||
|
|
||||||
int oldX = card->getX(), oldY = card->getY();
|
QList<QPair<Server_Card *, int> > cardsToMove;
|
||||||
|
for (int i = 0; i < _cardIds.size(); ++i) {
|
||||||
// Attachment relationships can be retained when moving a card onto the opponent's table
|
int position;
|
||||||
if (startzone->getName() != targetzone->getName()) {
|
Server_Card *card = startzone->getCard(_cardIds[i], false, &position);
|
||||||
// Delete all attachment relationships
|
if (!card)
|
||||||
if (card->getParentCard())
|
return RespNameNotFound;
|
||||||
card->setParentCard(0);
|
if (!card->getAttachedCards().isEmpty() && !targetzone->isColumnEmpty(x, y))
|
||||||
|
return RespContextError;
|
||||||
// Make a copy of the list because the original one gets modified during the loop
|
cardsToMove.append(QPair<Server_Card *, int>(card, position));
|
||||||
QList<Server_Card *> attachedCards = card->getAttachedCards();
|
|
||||||
for (int i = 0; i < attachedCards.size(); ++i)
|
|
||||||
attachedCards[i]->getZone()->getPlayer()->unattachCard(cont, attachedCards[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startzone != targetzone) {
|
MoveCardCompareFunctor cmp(startzone == targetzone ? -1 : x);
|
||||||
// Delete all arrows from and to the card
|
qSort(cardsToMove.begin(), cardsToMove.end(), cmp);
|
||||||
const QList<Server_Player *> &players = game->getPlayers().values();
|
|
||||||
for (int i = 0; i < players.size(); ++i) {
|
bool secondHalf = false;
|
||||||
QList<int> arrowsToDelete;
|
int xIndex = -1;
|
||||||
QMapIterator<int, Server_Arrow *> arrowIterator(players[i]->getArrows());
|
for (int cardIndex = 0; cardIndex < cardsToMove.size(); ++cardIndex) {
|
||||||
while (arrowIterator.hasNext()) {
|
Server_Card *card = cardsToMove[cardIndex].first;
|
||||||
Server_Arrow *arrow = arrowIterator.next().value();
|
int originalPosition = cardsToMove[cardIndex].second;
|
||||||
if ((arrow->getStartCard() == card) || (arrow->getTargetItem() == card))
|
int position = startzone->removeCard(card);
|
||||||
arrowsToDelete.append(arrow->getId());
|
if ((startzone == targetzone) && !startzone->hasCoords()) {
|
||||||
|
if (!secondHalf && (originalPosition < x)) {
|
||||||
|
xIndex = -1;
|
||||||
|
secondHalf = true;
|
||||||
|
} else if (secondHalf)
|
||||||
|
--xIndex;
|
||||||
|
else
|
||||||
|
++xIndex;
|
||||||
|
} else
|
||||||
|
++xIndex;
|
||||||
|
int newX = x + xIndex;
|
||||||
|
|
||||||
|
// Attachment relationships can be retained when moving a card onto the opponent's table
|
||||||
|
if (startzone->getName() != targetzone->getName()) {
|
||||||
|
// Delete all attachment relationships
|
||||||
|
if (card->getParentCard())
|
||||||
|
card->setParentCard(0);
|
||||||
|
|
||||||
|
// Make a copy of the list because the original one gets modified during the loop
|
||||||
|
QList<Server_Card *> attachedCards = card->getAttachedCards();
|
||||||
|
for (int i = 0; i < attachedCards.size(); ++i)
|
||||||
|
attachedCards[i]->getZone()->getPlayer()->unattachCard(cont, attachedCards[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startzone != targetzone) {
|
||||||
|
// Delete all arrows from and to the card
|
||||||
|
const QList<Server_Player *> &players = game->getPlayers().values();
|
||||||
|
for (int i = 0; i < players.size(); ++i) {
|
||||||
|
QList<int> arrowsToDelete;
|
||||||
|
QMapIterator<int, Server_Arrow *> arrowIterator(players[i]->getArrows());
|
||||||
|
while (arrowIterator.hasNext()) {
|
||||||
|
Server_Arrow *arrow = arrowIterator.next().value();
|
||||||
|
if ((arrow->getStartCard() == card) || (arrow->getTargetItem() == card))
|
||||||
|
arrowsToDelete.append(arrow->getId());
|
||||||
|
}
|
||||||
|
for (int j = 0; j < arrowsToDelete.size(); ++j)
|
||||||
|
players[i]->deleteArrow(arrowsToDelete[j]);
|
||||||
}
|
}
|
||||||
for (int j = 0; j < arrowsToDelete.size(); ++j)
|
}
|
||||||
players[i]->deleteArrow(arrowsToDelete[j]);
|
|
||||||
|
if (card->getDestroyOnZoneChange() && (startzone != targetzone)) {
|
||||||
|
cont->enqueueGameEventPrivate(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
||||||
|
cont->enqueueGameEventPublic(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
||||||
|
card->deleteLater();
|
||||||
|
} else {
|
||||||
|
if (!targetzone->hasCoords()) {
|
||||||
|
y = 0;
|
||||||
|
card->resetState();
|
||||||
|
} else
|
||||||
|
newX = targetzone->getFreeGridColumn(newX, y, card->getName());
|
||||||
|
|
||||||
|
targetzone->insertCard(card, newX, y);
|
||||||
|
|
||||||
|
bool targetBeingLookedAt = (targetzone->getType() != HiddenZone) || (targetzone->getCardsBeingLookedAt() > newX) || (targetzone->getCardsBeingLookedAt() == -1);
|
||||||
|
bool sourceBeingLookedAt = (startzone->getType() != HiddenZone) || (startzone->getCardsBeingLookedAt() > position) || (startzone->getCardsBeingLookedAt() == -1);
|
||||||
|
|
||||||
|
bool targetHiddenToPlayer = faceDown || !targetBeingLookedAt;
|
||||||
|
bool targetHiddenToOthers = faceDown || (targetzone->getType() != PublicZone);
|
||||||
|
bool sourceHiddenToPlayer = card->getFaceDown() || !sourceBeingLookedAt;
|
||||||
|
bool sourceHiddenToOthers = card->getFaceDown() || (startzone->getType() != PublicZone);
|
||||||
|
|
||||||
|
QString privateCardName, publicCardName;
|
||||||
|
if (!(sourceHiddenToPlayer && targetHiddenToPlayer))
|
||||||
|
privateCardName = card->getName();
|
||||||
|
if (!(sourceHiddenToOthers && targetHiddenToOthers))
|
||||||
|
publicCardName = card->getName();
|
||||||
|
|
||||||
|
int oldCardId = card->getId();
|
||||||
|
if (faceDown)
|
||||||
|
card->setId(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
|
||||||
|
// are not being looked at.
|
||||||
|
int privateNewCardId = card->getId();
|
||||||
|
int privateOldCardId = oldCardId;
|
||||||
|
if (!targetBeingLookedAt && !sourceBeingLookedAt) {
|
||||||
|
privateOldCardId = -1;
|
||||||
|
privateNewCardId = -1;
|
||||||
|
privateCardName = QString();
|
||||||
|
}
|
||||||
|
int privatePosition = -1;
|
||||||
|
if (startzone->getType() == HiddenZone)
|
||||||
|
privatePosition = position;
|
||||||
|
cont->enqueueGameEventPrivate(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId());
|
||||||
|
cont->enqueueGameEventOmniscient(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId());
|
||||||
|
|
||||||
|
// Other players do not get to see the start and/or target position of the card if the respective
|
||||||
|
// part of the zone is being looked at. The information is not needed anyway because in hidden zones,
|
||||||
|
// all cards are equal.
|
||||||
|
if (
|
||||||
|
((startzone->getType() == HiddenZone) && ((startzone->getCardsBeingLookedAt() > position) || (startzone->getCardsBeingLookedAt() == -1)))
|
||||||
|
|| (startzone->getType() == PublicZone)
|
||||||
|
)
|
||||||
|
position = -1;
|
||||||
|
if ((targetzone->getType() == HiddenZone) && ((targetzone->getCardsBeingLookedAt() > newX) || (targetzone->getCardsBeingLookedAt() == -1)))
|
||||||
|
newX = -1;
|
||||||
|
|
||||||
|
if ((startzone->getType() == PublicZone) || (targetzone->getType() == PublicZone))
|
||||||
|
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), oldCardId, publicCardName, startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, card->getId(), faceDown), game->getGameId());
|
||||||
|
else
|
||||||
|
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), -1, QString(), startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, -1, false), game->getGameId());
|
||||||
|
|
||||||
|
if (tapped)
|
||||||
|
setCardAttrHelper(cont, targetzone->getName(), card->getId(), "tapped", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card->getDestroyOnZoneChange() && (startzone != targetzone)) {
|
|
||||||
cont->enqueueGameEventPrivate(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
|
||||||
cont->enqueueGameEventPublic(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
|
||||||
if (startzone->hasCoords())
|
|
||||||
startzone->fixFreeSpaces(cont, oldX, oldY);
|
|
||||||
card->deleteLater();
|
|
||||||
return RespOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!targetzone->hasCoords()) {
|
|
||||||
y = 0;
|
|
||||||
if (x == -1)
|
|
||||||
x = targetzone->cards.size();
|
|
||||||
|
|
||||||
card->resetState();
|
|
||||||
} else
|
|
||||||
x = targetzone->getFreeGridColumn(x, y, card->getName());
|
|
||||||
|
|
||||||
targetzone->insertCard(card, x, y);
|
|
||||||
|
|
||||||
bool targetBeingLookedAt = (targetzone->getType() != HiddenZone) || (targetzone->getCardsBeingLookedAt() > x) || (targetzone->getCardsBeingLookedAt() == -1);
|
|
||||||
bool sourceBeingLookedAt = (startzone->getType() != HiddenZone) || (startzone->getCardsBeingLookedAt() > position) || (startzone->getCardsBeingLookedAt() == -1);
|
|
||||||
|
|
||||||
bool targetHiddenToPlayer = faceDown || !targetBeingLookedAt;
|
|
||||||
bool targetHiddenToOthers = faceDown || (targetzone->getType() != PublicZone);
|
|
||||||
bool sourceHiddenToPlayer = card->getFaceDown() || !sourceBeingLookedAt;
|
|
||||||
bool sourceHiddenToOthers = card->getFaceDown() || (startzone->getType() != PublicZone);
|
|
||||||
|
|
||||||
QString privateCardName, publicCardName;
|
|
||||||
if (!(sourceHiddenToPlayer && targetHiddenToPlayer))
|
|
||||||
privateCardName = card->getName();
|
|
||||||
if (!(sourceHiddenToOthers && targetHiddenToOthers))
|
|
||||||
publicCardName = card->getName();
|
|
||||||
|
|
||||||
int oldCardId = card->getId();
|
|
||||||
if (faceDown)
|
|
||||||
card->setId(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
|
|
||||||
// are not being looked at.
|
|
||||||
int privateNewCardId = card->getId();
|
|
||||||
int privateOldCardId = oldCardId;
|
|
||||||
if (!targetBeingLookedAt && !sourceBeingLookedAt) {
|
|
||||||
privateOldCardId = -1;
|
|
||||||
privateNewCardId = -1;
|
|
||||||
privateCardName = QString();
|
|
||||||
}
|
|
||||||
int privatePosition = -1;
|
|
||||||
if (startzone->getType() == HiddenZone)
|
|
||||||
privatePosition = position;
|
|
||||||
cont->enqueueGameEventPrivate(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), x, y, privateNewCardId, faceDown), game->getGameId());
|
|
||||||
cont->enqueueGameEventOmniscient(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), x, y, privateNewCardId, faceDown), game->getGameId());
|
|
||||||
|
|
||||||
// Other players do not get to see the start and/or target position of the card if the respective
|
|
||||||
// part of the zone is being looked at. The information is not needed anyway because in hidden zones,
|
|
||||||
// all cards are equal.
|
|
||||||
if (
|
|
||||||
((startzone->getType() == HiddenZone) && ((startzone->getCardsBeingLookedAt() > position) || (startzone->getCardsBeingLookedAt() == -1)))
|
|
||||||
|| (startzone->getType() == PublicZone)
|
|
||||||
)
|
|
||||||
position = -1;
|
|
||||||
if ((targetzone->getType() == HiddenZone) && ((targetzone->getCardsBeingLookedAt() > x) || (targetzone->getCardsBeingLookedAt() == -1)))
|
|
||||||
x = -1;
|
|
||||||
|
|
||||||
if ((startzone->getType() == PublicZone) || (targetzone->getType() == PublicZone))
|
|
||||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), oldCardId, publicCardName, startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), x, y, card->getId(), faceDown), game->getGameId());
|
|
||||||
else
|
|
||||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), -1, QString(), startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), x, y, -1, false), game->getGameId());
|
|
||||||
|
|
||||||
if (tapped)
|
|
||||||
setCardAttrHelper(cont, targetzone->getName(), card->getId(), "tapped", "1");
|
|
||||||
|
|
||||||
if (startzone->hasCoords())
|
if (startzone->hasCoords())
|
||||||
startzone->fixFreeSpaces(cont, oldX, oldY);
|
startzone->fixFreeSpaces(cont);
|
||||||
|
|
||||||
return RespOk;
|
return RespOk;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +383,7 @@ void Server_Player::unattachCard(CommandContainer *cont, Server_Card *card)
|
||||||
cont->enqueueGameEventPrivate(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
cont->enqueueGameEventPrivate(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
||||||
cont->enqueueGameEventPublic(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
cont->enqueueGameEventPublic(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
||||||
|
|
||||||
moveCard(cont, zone, card->getId(), zone, -1, card->getY(), card->getFaceDown(), card->getTapped());
|
moveCard(cont, zone, QList<int>() << card->getId(), zone, -1, card->getY(), card->getFaceDown(), card->getTapped());
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseCode Server_Player::setCardAttrHelper(CommandContainer *cont, const QString &zoneName, int cardId, const QString &attrName, const QString &attrValue)
|
ResponseCode Server_Player::setCardAttrHelper(CommandContainer *cont, const QString &zoneName, int cardId, const QString &attrName, const QString &attrValue)
|
||||||
|
|
|
@ -22,6 +22,7 @@ class CommandContainer;
|
||||||
class Server_Player : public Server_ArrowTarget {
|
class Server_Player : public Server_ArrowTarget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
class MoveCardCompareFunctor;
|
||||||
Server_Game *game;
|
Server_Game *game;
|
||||||
Server_ProtocolHandler *handler;
|
Server_ProtocolHandler *handler;
|
||||||
ServerInfo_User *userInfo;
|
ServerInfo_User *userInfo;
|
||||||
|
@ -74,8 +75,8 @@ public:
|
||||||
void clearZones();
|
void clearZones();
|
||||||
void setupZones();
|
void setupZones();
|
||||||
|
|
||||||
ResponseCode moveCard(CommandContainer *cont, const QString &_startZone, int _cardId, int _targetPlayer, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped);
|
ResponseCode moveCard(CommandContainer *cont, const QString &_startZone, const QList<int> &_cardId, int _targetPlayer, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped);
|
||||||
ResponseCode moveCard(CommandContainer *cont, Server_CardZone *startzone, int _cardId, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped);
|
ResponseCode moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<int> &_cardId, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped);
|
||||||
void unattachCard(CommandContainer *cont, Server_Card *card);
|
void unattachCard(CommandContainer *cont, Server_Card *card);
|
||||||
ResponseCode setCardAttrHelper(CommandContainer *cont, const QString &zone, int cardId, const QString &attrName, const QString &attrValue);
|
ResponseCode setCardAttrHelper(CommandContainer *cont, const QString &zone, int cardId, const QString &attrName, const QString &attrValue);
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,7 @@ ResponseCode Server_ProtocolHandler::cmdListUsers(Command_ListUsers * /*cmd*/, C
|
||||||
QList<ServerInfo_User *> resultList;
|
QList<ServerInfo_User *> resultList;
|
||||||
QMapIterator<QString, Server_ProtocolHandler *> userIterator = server->getUsers();
|
QMapIterator<QString, Server_ProtocolHandler *> userIterator = server->getUsers();
|
||||||
while (userIterator.hasNext())
|
while (userIterator.hasNext())
|
||||||
resultList.append(new ServerInfo_User(userIterator.next().value()->getUserInfo()));
|
resultList.append(new ServerInfo_User(userIterator.next().value()->getUserInfo(), false));
|
||||||
|
|
||||||
acceptsUserListChanges = true;
|
acceptsUserListChanges = true;
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ ResponseCode Server_ProtocolHandler::cmdMulligan(Command_Mulligan * /*cmd*/, Com
|
||||||
|
|
||||||
Server_CardZone *deck = player->getZones().value("deck");
|
Server_CardZone *deck = player->getZones().value("deck");
|
||||||
while (!hand->cards.isEmpty())
|
while (!hand->cards.isEmpty())
|
||||||
player->moveCard(cont, hand, hand->cards.first()->getId(), deck, 0, 0, false, false);
|
player->moveCard(cont, hand, QList<int>() << hand->cards.first()->getId(), deck, 0, 0, false, false);
|
||||||
|
|
||||||
deck->shuffle();
|
deck->shuffle();
|
||||||
cont->enqueueGameEventPrivate(new Event_Shuffle(player->getPlayerId()), game->getGameId());
|
cont->enqueueGameEventPrivate(new Event_Shuffle(player->getPlayerId()), game->getGameId());
|
||||||
|
@ -558,8 +558,13 @@ ResponseCode Server_ProtocolHandler::cmdMoveCard(Command_MoveCard *cmd, CommandC
|
||||||
|
|
||||||
if (!game->getGameStarted())
|
if (!game->getGameStarted())
|
||||||
return RespGameNotStarted;
|
return RespGameNotStarted;
|
||||||
|
|
||||||
return player->moveCard(cont, cmd->getStartZone(), cmd->getCardId(), cmd->getTargetPlayerId(), cmd->getTargetZone(), cmd->getX(), cmd->getY(), cmd->getFaceDown(), cmd->getTapped());
|
QList<int> cardIds;
|
||||||
|
const QList<CardId *> &temp = cmd->getCardIds();
|
||||||
|
for (int i = 0; i < temp.size(); ++i)
|
||||||
|
cardIds.append(temp[i]->getData());
|
||||||
|
|
||||||
|
return player->moveCard(cont, cmd->getStartZone(), cardIds, cmd->getTargetPlayerId(), cmd->getTargetZone(), cmd->getX(), cmd->getY(), cmd->getFaceDown(), cmd->getTapped());
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseCode Server_ProtocolHandler::cmdFlipCard(Command_FlipCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player)
|
ResponseCode Server_ProtocolHandler::cmdFlipCard(Command_FlipCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player)
|
||||||
|
@ -659,7 +664,7 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(Command_AttachCard *cmd, Comm
|
||||||
player->unattachCard(cont, attachedList[i]);
|
player->unattachCard(cont, attachedList[i]);
|
||||||
|
|
||||||
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY()))
|
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY()))
|
||||||
targetPlayer->moveCard(cont, targetzone, targetCard->getId(), targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName()), targetCard->getY(), targetCard->getFaceDown(), false);
|
targetPlayer->moveCard(cont, targetzone, QList<int>() << targetCard->getId(), targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName()), targetCard->getY(), targetCard->getFaceDown(), false);
|
||||||
|
|
||||||
card->setParentCard(targetCard);
|
card->setParentCard(targetCard);
|
||||||
card->setCoords(-1, card->getY());
|
card->setCoords(-1, card->getY());
|
||||||
|
|
|
@ -192,7 +192,7 @@ ServerInfo_User *Servatrice::getUserData(const QString &name)
|
||||||
} else
|
} else
|
||||||
return new ServerInfo_User(name, ServerInfo_User::IsUser);
|
return new ServerInfo_User(name, ServerInfo_User::IsUser);
|
||||||
}
|
}
|
||||||
#include <QDebug>
|
|
||||||
void Servatrice::updateLoginMessage()
|
void Servatrice::updateLoginMessage()
|
||||||
{
|
{
|
||||||
checkSql();
|
checkSql();
|
||||||
|
@ -206,7 +206,6 @@ void Servatrice::updateLoginMessage()
|
||||||
QMapIterator<QString, Server_ProtocolHandler *> usersIterator(users);
|
QMapIterator<QString, Server_ProtocolHandler *> usersIterator(users);
|
||||||
while (usersIterator.hasNext()) {
|
while (usersIterator.hasNext()) {
|
||||||
usersIterator.next().value()->sendProtocolItem(event, false);
|
usersIterator.next().value()->sendProtocolItem(event, false);
|
||||||
qDebug() << "sent message to" << usersIterator.value()->getUserInfo()->getName();
|
|
||||||
}
|
}
|
||||||
delete event;
|
delete event;
|
||||||
}
|
}
|
||||||
|
@ -226,4 +225,4 @@ void Servatrice::statusUpdate()
|
||||||
execSqlQuery(query);
|
execSqlQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString Servatrice::versionString = "Servatrice 0.20110103";
|
const QString Servatrice::versionString = "Servatrice 0.20110114";
|
||||||
|
|
Loading…
Reference in a new issue