mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
ignore "deck" at start of a list add tests add tests to clangify.sh
This commit is contained in:
parent
b940e17fe7
commit
1c48656623
3 changed files with 48 additions and 2 deletions
|
|
@ -492,7 +492,9 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
|
|||
const QRegularExpression reEmpty("^\\s*$");
|
||||
const QRegularExpression reComment("[\\w\\[\\(\\{].*$", QRegularExpression::UseUnicodePropertiesOption);
|
||||
const QRegularExpression reSBMark("^\\s*sb:\\s*(.+)", QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpression reSBComment("sideboard", QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpression reSBComment("^sideboard\\b.*$", QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpression reDeckComment("^((main)?deck(list)?|mainboard)\\b",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
|
||||
// simplified matches
|
||||
const QRegularExpression reMultiplier("^[xX\\(\\[]*(\\d+)[xX\\*\\)\\]]* ?(.+)");
|
||||
|
|
@ -563,6 +565,16 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
|
|||
}
|
||||
comments.chop(1); // remove last newline
|
||||
|
||||
// discard empty lines
|
||||
while (index < max_line && inputs.at(index).contains(reEmpty)) {
|
||||
++index;
|
||||
}
|
||||
|
||||
// discard line if it starts with deck or mainboard, all cards until the sideboard starts are in the mainboard
|
||||
if (inputs.at(index).contains(reDeckComment)) {
|
||||
++index;
|
||||
}
|
||||
|
||||
// parse decklist
|
||||
for (; index < max_line; ++index) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue