mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Route tax counters by reserved ID instead of name to mirror other counters and avoid issues
This commit is contained in:
parent
b688405af3
commit
e889e2dff5
5 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue