Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opponents cards appear in wrong order, Cards created do not show up until the second one is created #1406

Closed
robertsmieja opened this issue Sep 6, 2015 · 20 comments

Comments

@robertsmieja
Copy link

Using the latest pre-release version.

Screenshot: http://i.imgur.com/v7zefcD.jpg

  1. Living Roots appears in the middle of the opponent's cards played.

  2. Laughing Sister was created, then the Emerald Drake at the bottom. The Laughing Sister only showed up after the Emerald Drake was created.

@azeier
Copy link
Member

azeier commented Sep 6, 2015

Happens randomly or is it consistent?

@azeier
Copy link
Member

azeier commented Sep 6, 2015

Wait... they are sorted alphabetically.. what?

@robertsmieja
Copy link
Author

Card ordering appears to be random? Happened for my first game only. Now it looks fine: http://i.imgur.com/5PziLeJ.jpg

@robertsmieja
Copy link
Author

Generated card issue also doesn't appear to be consistent, unless it's Ysera only: http://i.imgur.com/S6Flkvg.jpg

Feel free to close this issue as something that might happen only the first time? I'll reopen if I can reproduce.

@robertsmieja
Copy link
Author

Alphabetical ordering is occurring again: http://i.imgur.com/pP2i8tM.jpg

@azeier
Copy link
Member

azeier commented Sep 6, 2015

Does it fix itself or is that consistent throughout the game?

@robertsmieja
Copy link
Author

It's consistent for that game, but then the next two or so games seem to be fine. I can't seem to find a pattern as to when it occurs.

@robertsmieja
Copy link
Author

To add, I am on Windows 10 64-bit.

I'm trying to trace through the code to see if I can figure out what's wrong, but I'm getting lost. Is the variable that contains an opponent's deck is in GameV2.cs? Is it the GameStats?

This is a bit far fetched, but Is it possible that the order is wrong because I don't have a deck list for my opponent? I think that could happen if the Deck type from the replay and the in-progress game is shared.

@azeier
Copy link
Member

azeier commented Sep 6, 2015

The sorting happens here, which calls this.

@azeier
Copy link
Member

azeier commented Sep 6, 2015

And the opponent card list is this one

@robertsmieja
Copy link
Author

Is the order for this List guranteed? https://github.com/Epix37/Hearthstone-Deck-Tracker/blob/master/Hearthstone%20Deck%20Tracker/Utility/Helper.cs#L219

If this is out of order it could be sorted by Type or Name first. From my mostly Java background this happens often. Type is Minion and Spell?

I'll see if I can play some more games and see if that happens, although looking at this line it seems that type can be "Hero Power" so I'm not sure it would even show up? https://github.com/Epix37/Hearthstone-Deck-Tracker/blob/master/Hearthstone%20Deck%20Tracker/Hearthstone/Card.cs#L130

@azeier
Copy link
Member

azeier commented Sep 6, 2015

I have not changed Helper.SortCardCollection in about a year. And it used to work.
Type is Minion, Spell, etc. yes.

The only thing I did change is that I pass it OpponentListView.Items, instead of OpponentListView.ItemsSource. I do the same thing for the player deck though and that seems to be fine(?).

@robertsmieja
Copy link
Author

Here's a screenshot where it's not in alphabetical order:
http://i.imgur.com/DvVx9A9.jpg

It fixed itself next opponent's turn, but then it came back: http://i.imgur.com/dMIrbT1.jpg

@azeier
Copy link
Member

azeier commented Sep 6, 2015

The first one looks like "order of play" and type. Weird stuff...

@robertsmieja
Copy link
Author

The order of play isn't actually accurate though. And it was fine on my turn.

@azeier
Copy link
Member

azeier commented Sep 7, 2015

I think I may have already accidentally stated the solution. Changing it back from OpponentListView.Items to OpponentListView.ItemsSource seems to solve the problem. Not sure why I even changed it in the first place. Need to do some more testing to see if this is actually it.

azeier pushed a commit that referenced this issue Sep 7, 2015
@azeier
Copy link
Member

azeier commented Sep 7, 2015

Played a few games, seems to be fine. Give this version a shot: https://github.com/Epix37/HDT-Test/releases/tag/v0.10.18PRE1 Actually, I don't think that did it.

azeier pushed a commit that referenced this issue Sep 7, 2015
@robertsmieja
Copy link
Author

Thanks for fixing this so quickly. So the problem ended up being a place where sorting wasn't being done?

@azeier
Copy link
Member

azeier commented Sep 9, 2015

The problem was: when I created the card lists that are supposed to be displayed, I created new card instances instead of loading them from the database. In theory that's totally fine becuase, when e.g. the name is then accessed, the cards loads the data automatically. However, that does not happen for the cost. So when sorting the cards by cost before sorting them by name (which is the order it needs to happen in), the cost would not be loaded yet and therefore just be 0.

@azeier
Copy link
Member

azeier commented Sep 9, 2015

fixed with pre-release v0.10.18

@azeier azeier closed this as completed Sep 9, 2015
chucklu pushed a commit to ChuckFork/Hearthstone-Deck-Tracker that referenced this issue Sep 10, 2015
chucklu pushed a commit to ChuckFork/Hearthstone-Deck-Tracker that referenced this issue Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants