mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Refactor] Move table row mapping from TableZone into TableZoneLogic (#7413)
* [Refactor] Move table row mapping from TableZone into TableZoneLogic * [Game] Use TableZoneLogic::ROW_COUNT directly per review * [Format] Match clang-format line breaking in table_zone --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
d30d275296
commit
52c5bd2ea3
5 changed files with 47 additions and 43 deletions
|
|
@ -3,7 +3,6 @@
|
|||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game_graphics/board/card_item.h"
|
||||
#include "../../game_graphics/dialogs/dlg_create_token.h"
|
||||
#include "../../game_graphics/zones/table_zone.h"
|
||||
#include "../../interface/deck_loader/loaded_deck.h"
|
||||
#include "../abstract_game.h"
|
||||
#include "../board/counter_state.h"
|
||||
|
|
@ -121,7 +120,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
|
|||
cmd.set_y(0);
|
||||
} else {
|
||||
tableRow = faceDown ? 2 : info.getUiAttributes().tableRow;
|
||||
QPoint gridPoint = QPoint(-1, TableZone::tableRowToGridY(tableRow));
|
||||
QPoint gridPoint = QPoint(-1, TableZoneLogic::tableRowToGridY(tableRow));
|
||||
cardToMove->set_face_down(faceDown);
|
||||
if (!faceDown) {
|
||||
cardToMove->set_pt(info.getPowTough().toStdString());
|
||||
|
|
@ -161,7 +160,7 @@ void PlayerActions::playCardToTable(const CardItem *card, bool faceDown)
|
|||
const CardInfo &info = exactCard.getInfo();
|
||||
|
||||
int tableRow = faceDown ? 2 : info.getUiAttributes().tableRow;
|
||||
QPoint gridPoint = QPoint(-1, TableZone::tableRowToGridY(tableRow));
|
||||
QPoint gridPoint = QPoint(-1, TableZoneLogic::tableRowToGridY(tableRow));
|
||||
cardToMove->set_face_down(faceDown);
|
||||
if (!faceDown) {
|
||||
cardToMove->set_pt(info.getPowTough().toStdString());
|
||||
|
|
@ -925,7 +924,7 @@ void PlayerActions::actCreateToken(TokenInfo tokenToCreate)
|
|||
if (correctedCard) {
|
||||
lastTokenInfo.name = correctedCard.getName();
|
||||
int tableRow = lastTokenInfo.faceDown ? 2 : correctedCard.getInfo().getUiAttributes().tableRow;
|
||||
lastTokenTableRow = TableZone::tableRowToGridY(tableRow);
|
||||
lastTokenTableRow = TableZoneLogic::tableRowToGridY(tableRow);
|
||||
if (lastTokenInfo.pt.isEmpty()) {
|
||||
lastTokenInfo.pt = correctedCard.getInfo().getPowTough();
|
||||
}
|
||||
|
|
@ -979,7 +978,7 @@ void PlayerActions::setLastTokenInfo(CardInfoPtr cardInfo)
|
|||
.destroy = true,
|
||||
.providerId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
|
||||
lastTokenTableRow = TableZone::tableRowToGridY(cardInfo->getUiAttributes().tableRow);
|
||||
lastTokenTableRow = TableZoneLogic::tableRowToGridY(cardInfo->getUiAttributes().tableRow);
|
||||
|
||||
emit requestEnableAndSetCreateAnotherTokenAction(lastTokenInfo.name);
|
||||
}
|
||||
|
|
@ -1191,7 +1190,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
|
|||
return;
|
||||
}
|
||||
|
||||
QPoint gridPoint = QPoint(-1, TableZone::tableRowToGridY(cardInfo->getUiAttributes().tableRow));
|
||||
QPoint gridPoint = QPoint(-1, TableZoneLogic::tableRowToGridY(cardInfo->getUiAttributes().tableRow));
|
||||
|
||||
// create the token for the related card
|
||||
Command_CreateToken cmd;
|
||||
|
|
@ -1977,7 +1976,7 @@ void PlayerActions::cardMenuAction(QList<CardItem *> selectedCards, CardMenuActi
|
|||
ctm->set_tapped(info.getUiAttributes().cipt);
|
||||
}
|
||||
|
||||
cmd->set_y(TableZone::tableRowToGridY(tableRow));
|
||||
cmd->set_y(TableZoneLogic::tableRowToGridY(tableRow));
|
||||
commandList.append(cmd);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue