[Refactor] Move card selection actions to GameScene and p/t parsing to CardState (#7426)

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-31 18:44:12 +01:00 • committed by GitHub
parent c9853734ad
commit 4879ddbd0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 121 additions and 116 deletions

View file

@ -66,6 +66,37 @@ void CardState::setFaceDown(bool _facedown)
emit stateChanged();
}
QVariantList CardState::parsePT(const QString &pt)
{
QVariantList ptList = QVariantList();
if (!pt.isEmpty()) {
int sep = pt.indexOf('/');
if (sep == 0) {
ptList.append(QVariant(pt.mid(1))); // cut off starting '/' and take full string
} else {
int start = 0;
for (;;) {
QString item = pt.mid(start, sep - start);
if (item.isEmpty()) {
ptList.append(QVariant(QString()));
} else if (item[0] == '+') {
ptList.append(QVariant(item.mid(1).toInt())); // add as int
} else if (item[0] == '-') {
ptList.append(QVariant(item.toInt())); // add as int
} else {
ptList.append(QVariant(item)); // add as qstring
}
if (sep == -1) {
break;
}
start = sep + 1;
sep = pt.indexOf('/', start);
}
}
}
return ptList;
}
void CardState::setZone(CardZoneLogic *_zone)
{
if (zone == _zone) {