Route tax counters by reserved ID instead of name to mirror other counters and avoid issues

This commit is contained in:
DawnFire42 2026-08-10 12:21:25 -04:00
parent b688405af3
commit e889e2dff5
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
5 changed files with 8 additions and 8 deletions

View file

@ -273,7 +273,7 @@ void PlayerEventHandler::eventSetCounter(const Event_SetCounter &event)
state->setValue(event.value()); state->setValue(event.value());
if (event.value() != oldValue) { if (event.value() != oldValue) {
emit logSetCounter(player, state->getName(), event.value(), oldValue); emit logSetCounter(player, state->getId(), state->getName(), event.value(), oldValue);
} }
} }

View file

@ -250,7 +250,7 @@ signals:
void logUnattachCard(PlayerLogic *player, QString cardName); void logUnattachCard(PlayerLogic *player, QString cardName);
void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue); void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue);
void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped); void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue); void logSetCounter(PlayerLogic *player, int counterId, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap); void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT); void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation); void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation);

View file

@ -670,13 +670,13 @@ void MessageLogWidget::logSetCardCounter(PlayerLogic *player, QString cardName,
.arg(value)); .arg(value));
} }
void MessageLogWidget::logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue) void MessageLogWidget::logSetCounter(PlayerLogic *player, int counterId, QString counterName, int value, int oldValue)
{ {
if (counterName == "life") { if (counterName == "life") {
soundEngine->playSound("life_change"); soundEngine->playSound("life_change");
} }
if (counterName == CounterNames::CommanderTax || counterName == CounterNames::PartnerTax) { if (CounterIds::isTaxCounter(counterId)) {
QString playerName = sanitizeHtml(player->getPlayerInfo()->getName()); QString playerName = sanitizeHtml(player->getPlayerInfo()->getName());
QString valueStr = QString("<font class=\"blue\">%1</font>").arg(value); QString valueStr = QString("<font class=\"blue\">%1</font>").arg(value);
int delta = value - oldValue; int delta = value - oldValue;

View file

@ -90,7 +90,7 @@ public slots:
void logSetActivePlayer(PlayerLogic *player); void logSetActivePlayer(PlayerLogic *player);
void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation); void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation);
void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue); void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue); void logSetCounter(PlayerLogic *player, int counterId, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap); void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT); void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetSideboardLock(PlayerLogic *player, bool locked); void logSetSideboardLock(PlayerLogic *player, bool locked);

View file

@ -237,7 +237,7 @@ void PlayerGraphicsItem::onCounterAdded(CounterState *state)
AbstractCounter *widget; AbstractCounter *widget;
if (state->getName() == "life") { if (state->getName() == "life") {
widget = playerTarget->addCounter(state); widget = playerTarget->addCounter(state);
} else if (CounterNames::isTaxCounter(state->getName())) { } else if (CounterIds::isTaxCounter(state->getId())) {
if (!commandZoneGraphicsItem) { if (!commandZoneGraphicsItem) {
qWarning() << "Cannot create tax counter" << state->getName() << "- command zone not available"; qWarning() << "Cannot create tax counter" << state->getName() << "- command zone not available";
return; return;
@ -275,7 +275,7 @@ void PlayerGraphicsItem::onCounterRemoved(int counterId)
return; return;
} }
setCounterMenuRegistered(widget, false); setCounterMenuRegistered(widget, false);
if (commandZoneGraphicsItem && CounterNames::isTaxCounter(widget->getName())) { if (commandZoneGraphicsItem && CounterIds::isTaxCounter(widget->getId())) {
commandZoneGraphicsItem->unregisterTaxCounter(widget); commandZoneGraphicsItem->unregisterTaxCounter(widget);
} }
widget->delCounter(); widget->delCounter();
@ -291,7 +291,7 @@ void PlayerGraphicsItem::rearrangeCounters()
qreal ySize = boundingRect().y() + 80; qreal ySize = boundingRect().y() + 80;
constexpr qreal padding = 5; constexpr qreal padding = 5;
for (auto *ctr : counterWidgets.values()) { for (auto *ctr : counterWidgets.values()) {
if (CounterNames::isTaxCounter(ctr->getName())) { if (CounterIds::isTaxCounter(ctr->getId())) {
continue; continue;
} }
if (!ctr->getShownInCounterArea()) { if (!ctr->getShownInCounterArea()) {