show deck hash even when its invalid (#4595)

* show deck hash even when its invalid

* remove invalid deck hashes entirely

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
skwerlman 2023-04-10 16:29:29 -04:00 committed by GitHub
parent b33246b29f
commit 87462398d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -799,7 +799,6 @@ bool DeckList::deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNod
void DeckList::updateDeckHash() void DeckList::updateDeckHash()
{ {
QStringList cardList; QStringList cardList;
bool isValidDeckList = true;
QSet<QString> hashZones, optionalZones; QSet<QString> hashZones, optionalZones;
hashZones << DECK_ZONE_MAIN << DECK_ZONE_SIDE; // Zones in deck to be included in hashing process hashZones << DECK_ZONE_MAIN << DECK_ZONE_SIDE; // Zones in deck to be included in hashing process
@ -814,9 +813,6 @@ void DeckList::updateDeckHash()
for (int k = 0; k < card->getNumber(); ++k) { for (int k = 0; k < card->getNumber(); ++k) {
cardList.append((node->getName() == DECK_ZONE_SIDE ? "SB:" : "") + card->getName().toLower()); cardList.append((node->getName() == DECK_ZONE_SIDE ? "SB:" : "") + card->getName().toLower());
} }
} else if (!optionalZones.contains(node->getName())) // Not a valid zone -> cheater?
{
isValidDeckList = false; // Deck is invalid
} }
} }
} }
@ -826,7 +822,7 @@ void DeckList::updateDeckHash()
(((quint64)(unsigned char)deckHashArray[1]) << 24) + (((quint64)(unsigned char)deckHashArray[1]) << 24) +
(((quint64)(unsigned char)deckHashArray[2] << 16)) + (((quint64)(unsigned char)deckHashArray[2] << 16)) +
(((quint64)(unsigned char)deckHashArray[3]) << 8) + (quint64)(unsigned char)deckHashArray[4]; (((quint64)(unsigned char)deckHashArray[3]) << 8) + (quint64)(unsigned char)deckHashArray[4];
deckHash = (isValidDeckList) ? QString::number(number, 32).rightJustified(8, '0') : "INVALID"; deckHash = QString::number(number, 32).rightJustified(8, '0');
emit deckHashChanged(); emit deckHashChanged();
} }