[Fix-Warnings] Replace types with auto for game/player files

This commit is contained in:
Brübach, Lukas 2025-11-28 22:33:15 +01:00
parent e0e33bc5f0
commit 6d8c4772f6
4 changed files with 10 additions and 11 deletions

View file

@ -62,8 +62,7 @@ void UtilityMenu::populatePredefinedTokensMenu()
return; return;
} }
InnerDecklistNode *tokenZone = auto *tokenZone = dynamic_cast<InnerDecklistNode *>(_deck->getDeckList()->getRoot()->findChild(DECK_ZONE_TOKENS));
dynamic_cast<InnerDecklistNode *>(_deck->getDeckList()->getRoot()->findChild(DECK_ZONE_TOKENS));
if (tokenZone) { if (tokenZone) {
if (!tokenZone->empty()) if (!tokenZone->empty())

View file

@ -73,7 +73,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
cmd.set_y(0); cmd.set_y(0);
} else { } else {
tableRow = faceDown ? 2 : info.getUiAttributes().tableRow; tableRow = faceDown ? 2 : info.getUiAttributes().tableRow;
QPoint gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - tableRow)); auto gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - tableRow));
cardToMove->set_face_down(faceDown); cardToMove->set_face_down(faceDown);
if (!faceDown) { if (!faceDown) {
cardToMove->set_pt(info.getPowTough().toStdString()); cardToMove->set_pt(info.getPowTough().toStdString());
@ -117,7 +117,7 @@ void PlayerActions::playCardToTable(const CardItem *card, bool faceDown)
tableRow = 1; tableRow = 1;
} }
QPoint gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - tableRow)); auto gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - tableRow));
cardToMove->set_face_down(faceDown); cardToMove->set_face_down(faceDown);
if (!faceDown) { if (!faceDown) {
cardToMove->set_pt(info.getPowTough().toStdString()); cardToMove->set_pt(info.getPowTough().toStdString());
@ -162,7 +162,7 @@ static QList<CardList::SortOption> expandSortOption(CardList::SortOption option)
void PlayerActions::actSortHand() void PlayerActions::actSortHand()
{ {
auto *action = qobject_cast<QAction *>(sender()); auto *action = qobject_cast<QAction *>(sender());
CardList::SortOption option = static_cast<CardList::SortOption>(action->data().toInt()); auto option = static_cast<CardList::SortOption>(action->data().toInt());
QList<CardList::SortOption> sortOptions = expandSortOption(option); QList<CardList::SortOption> sortOptions = expandSortOption(option);
@ -1080,7 +1080,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
// get the target token's location // get the target token's location
// TODO: Define this QPoint into its own function along with the one below // TODO: Define this QPoint into its own function along with the one below
QPoint gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - cardInfo->getUiAttributes().tableRow)); auto gridPoint = QPoint(-1, TableZone::clampValidTableRow(2 - cardInfo->getUiAttributes().tableRow));
// create the token for the related card // create the token for the related card
Command_CreateToken cmd; Command_CreateToken cmd;
@ -1323,7 +1323,7 @@ void PlayerActions::actResetPT()
QVariantList PlayerActions::parsePT(const QString &pt) QVariantList PlayerActions::parsePT(const QString &pt)
{ {
QVariantList ptList = QVariantList(); auto ptList = QVariantList();
if (!pt.isEmpty()) { if (!pt.isEmpty()) {
int sep = pt.indexOf('/'); int sep = pt.indexOf('/');
if (sep == 0) { if (sep == 0) {
@ -1380,7 +1380,7 @@ void PlayerActions::actSetPT()
for (const auto &item : sel) { for (const auto &item : sel) {
auto *card = static_cast<CardItem *>(item); auto *card = static_cast<CardItem *>(item);
auto *cmd = new Command_SetCardAttr; auto *cmd = new Command_SetCardAttr;
QString newpt = QString(); auto newpt = QString();
if (!empty) { if (!empty) {
const auto oldpt = parsePT(card->getPT()); const auto oldpt = parsePT(card->getPT());
int ptIter = 0; int ptIter = 0;
@ -1484,7 +1484,7 @@ void PlayerActions::actSetAnnotation()
} }
player->setDialogSemaphore(true); player->setDialogSemaphore(true);
AnnotationDialog *dialog = new AnnotationDialog(player->getGame()->getTab()); auto *dialog = new AnnotationDialog(player->getGame()->getTab());
dialog->setOptions(QInputDialog::UsePlainTextEditForTextInput); dialog->setOptions(QInputDialog::UsePlainTextEditForTextInput);
dialog->setWindowTitle(tr("Set annotation")); dialog->setWindowTitle(tr("Set annotation"));
dialog->setLabelText(tr("Please enter the new annotation:")); dialog->setLabelText(tr("Please enter the new annotation:"));

View file

@ -124,7 +124,7 @@ void PlayerEventHandler::eventCreateToken(const Event_CreateToken &event)
} }
CardRef cardRef = {QString::fromStdString(event.card_name()), QString::fromStdString(event.card_provider_id())}; CardRef cardRef = {QString::fromStdString(event.card_name()), QString::fromStdString(event.card_provider_id())};
CardItem *card = new CardItem(player, nullptr, cardRef, event.card_id()); auto *card = new CardItem(player, nullptr, cardRef, event.card_id());
// use db PT if not provided in event and not face-down // use db PT if not provided in event and not face-down
if (!QString::fromStdString(event.pt()).isEmpty()) { if (!QString::fromStdString(event.pt()).isEmpty()) {
card->setPT(QString::fromStdString(event.pt())); card->setPT(QString::fromStdString(event.pt()));

View file

@ -120,7 +120,7 @@ void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*o
painter->drawPixmap(translatedRect, cachedPixmap, cachedPixmap.rect()); painter->drawPixmap(translatedRect, cachedPixmap, cachedPixmap.rect());
painter->restore(); painter->restore();
QRectF nameRect = QRectF(0, boundingRect().height() - 20, 110, 20); auto nameRect = QRectF(0, boundingRect().height() - 20, 110, 20);
painter->fillRect(nameRect, QColor(0, 0, 0, 160)); painter->fillRect(nameRect, QColor(0, 0, 0, 160));
QRectF translatedNameRect = painter->combinedTransform().mapRect(nameRect); QRectF translatedNameRect = painter->combinedTransform().mapRect(nameRect);