Cockatrice: Wrong format when loading .mwDeck

Created on 20 Jan 2018  路  12Comments  路  Source: Cockatrice/Cockatrice

OS:
Win 7 SP2

Cockatrice version:
Version 2.4.0 (2017-11-19)


This is what the .mwDeck original file looks like:
3
It is an old deck I saved in Magic Workstation.

When I load a deck of type .mwDeck, each card entry is loaded with an extra blank space in front of it and each card has only lower-case letters:
1

This means that Cockatrice doesn't recognize the card correctly. No image or rules text is displayed.

When I save the deck as a .cod file, each card gets a blank space in front of its name and it is saved in lower-case only:
2

App - Cockatrice Defect - Basic Defect - Regression

Most helpful comment

For future reference, there's no need to make new pull requests for fixing issues; just add another commit to the branch you opened the pull request from, and it'll be included in the PR.

All 12 comments

I think this is a regression. We're supposed to be able to load mws decks. @ZeldaZach do you recall if the deck parsing code changed lately?

Regardless this should be really easy to fix. @dino572 can you please attach the mwDeck file?

Thanks for taking a look at this. I can't upload mwDeck files here but here's a dropbox link: https://www.dropbox.com/s/77kurck39fon8t4/Bears.mwDeck?dl=1

If I "Save deck to clipboard" and then "Load deck from clipboard", it loads as it should.

decklist.cpp line 564:

    // Filter out MWS edition symbols and basic land extras
    QRegExp rx("\\[.*\\]");
    line.remove(rx);
    rx.setPattern("\\(.*\\)");
    line.remove(rx);

Is that the problem? Not removing one space after the brackets ?
E.g.
1 [M11] Runeclaw Bear
The code removes "[M11]" but leaves two blanks, one that was before and one that was after the brackets.

Good call. That looks like like it could be the issue. Want to send a pull request changing that regex to \\[.*\\]\s? ? We can get a test build up for you

I think I sent a pull request now.
The changes are:

QRegExp rx("\\[.*\\]\s?");
rx.setPattern("\\\s(.*\\)");

I added an \s in the second regex too because otherwise I think a line like this:
1 [XLN] Island (2)
Would end up with a space at the end.

You created a pull request, but against your fork of the repo and not the main cockatrice repo.
Don't worry, just follow this link https://github.com/Cockatrice/Cockatrice/compare/master...dino572:dino572-patch-1 to create the PR on the correct repo

I created the PR from that link - #3056

I made a new pull request with the extra backslashes.

For future reference, there's no need to make new pull requests for fixing issues; just add another commit to the branch you opened the pull request from, and it'll be included in the PR.

I think it's fixed. The final changes were:

QRegExp rx("\\[.*\\]\\s?");
line.remove(rx);
rx.setPattern("\\s?\\(.*\\)");
line.remove(rx); 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

skwerlman picture skwerlman  路  6Comments

dev-id picture dev-id  路  6Comments

tooomm picture tooomm  路  6Comments

Gibidinp picture Gibidinp  路  7Comments

tooomm picture tooomm  路  6Comments