mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 13:30:00 -08:00
Parse generic numeric quantities in braces without adding unsupported Essence types
This commit is contained in:
parent
4632b1e017
commit
ff660daa71
1 changed files with 12 additions and 0 deletions
|
|
@ -50,6 +50,18 @@ inline QStringList parseCost(const QString &cost)
|
||||||
const QString token = match.captured(1);
|
const QString token = match.captured(1);
|
||||||
if (token.size() == 1 && isSymbol(token.at(0))) {
|
if (token.size() == 1 && isSymbol(token.at(0))) {
|
||||||
result.append(token);
|
result.append(token);
|
||||||
|
} else {
|
||||||
|
// Numeric quantities may also be written in braces: {2}{N}.
|
||||||
|
bool isNumber = !token.isEmpty();
|
||||||
|
for (const QChar ch : token) {
|
||||||
|
if (!ch.isDigit()) {
|
||||||
|
isNumber = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNumber) {
|
||||||
|
result.append(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!match.captured(2).isEmpty()) {
|
} else if (!match.captured(2).isEmpty()) {
|
||||||
result.append(match.captured(2));
|
result.append(match.captured(2));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue