Adjust to rebase.

Took 4 minutes
This commit is contained in:
Lukas Brübach 2026-05-22 10:31:48 +02:00
parent f075de3c23
commit 2332bc169e
3 changed files with 7 additions and 6 deletions

View file

@ -35,8 +35,10 @@ UtilityMenu::UtilityMenu(PlayerGraphicsItem *_player, QMenu *playerMenu) : QMenu
aCreateAnotherToken->setEnabled(false); aCreateAnotherToken->setEnabled(false);
aIncrementAllCardCounters = new QAction(this); aIncrementAllCardCounters = new QAction(this);
connect(aIncrementAllCardCounters, &QAction::triggered, playerActions, connect(aIncrementAllCardCounters, &QAction::triggered, playerActions, [this]() {
&PlayerActions::actIncrementAllCardCounters); player->getPlayerLogic()->getPlayerActions()->actIncrementAllCardCounters(
player->getGameScene()->selectedCards());
});
createPredefinedTokenMenu = new QMenu(QString()); createPredefinedTokenMenu = new QMenu(QString());
createPredefinedTokenMenu->setEnabled(false); createPredefinedTokenMenu->setEnabled(false);

View file

@ -1547,7 +1547,7 @@ void PlayerActions::actSetCardCounter(QList<CardItem *> selectedCards, int count
for (auto card : selectedCards) { for (auto card : selectedCards) {
int oldValue = card->getCounters().value(counterId, 0); int oldValue = card->getCounters().value(counterId, 0);
Expression exp(oldValue); Expression exp(oldValue);
double parsed = exp.parse(dialog.textValue()); double parsed = exp.parse(counterValue);
// Clamp in double precision first to avoid UB, then cast // Clamp in double precision first to avoid UB, then cast
int number = static_cast<int>(qBound(0.0, parsed, static_cast<double>(MAX_COUNTERS_ON_CARD))); int number = static_cast<int>(qBound(0.0, parsed, static_cast<double>(MAX_COUNTERS_ON_CARD)));
@ -1562,9 +1562,8 @@ void PlayerActions::actSetCardCounter(QList<CardItem *> selectedCards, int count
sendGameCommand(prepareGameCommand(commandList)); sendGameCommand(prepareGameCommand(commandList));
} }
void PlayerActions::actIncrementAllCardCounters() void PlayerActions::actIncrementAllCardCounters(QList<CardItem *> cardsToUpdate)
{ {
auto cardsToUpdate = player->getGameScene()->selectedCards();
if (cardsToUpdate.isEmpty()) { if (cardsToUpdate.isEmpty()) {
// If no cards selected, update all cards on table // If no cards selected, update all cards on table
cardsToUpdate = static_cast<QList<CardItem *>>(player->getTableZone()->getCards()); cardsToUpdate = static_cast<QList<CardItem *>>(player->getTableZone()->getCards());

View file

@ -183,7 +183,7 @@ public slots:
void actAddCardCounter(QList<CardItem *> selectedCards, int counterId); void actAddCardCounter(QList<CardItem *> selectedCards, int counterId);
void actRequestSetCardCounterDialog(QList<CardItem *> selectedCards, int counterId); void actRequestSetCardCounterDialog(QList<CardItem *> selectedCards, int counterId);
void actSetCardCounter(QList<CardItem *> selectedCards, int counterId, const QString &counterValue); void actSetCardCounter(QList<CardItem *> selectedCards, int counterId, const QString &counterValue);
void actIncrementAllCardCounters(); void actIncrementAllCardCounters(QList<CardItem *> cardsToUpdate);
void actAttach(); void actAttach();
void actUnattach(QList<CardItem *> selectedCards); void actUnattach(QList<CardItem *> selectedCards);
void actDrawArrow(); void actDrawArrow();