Second Game Bug

There's been a bug that seemed to slip in just after the last beta was released. I haven't had time to fully debug it since I haven't been home, but I did a little bit this afternoon while on a bus and it looks like the hang up is trying to structure the layout. Now I'm not sure exactly why it needs to do all this in between games, since no UI is visible (yet) and no cards are on the battlefield (yet).
It appears this happens prior to the previous cards are cleared from all zones (I'm not exactly sure why this doesn't happen sooner than it does).
From what I can tell, there's a Binary Search that is attempting to find the "best" value to fit the screen to. For whatever reason a suitable match is never found (I guess due to a 0 screen width and cards existing in a visible zone) When I paused during this infinite loop, the value was less than -150k. I tried to clear the cards in the zones earlier, but that doesn't seem to want to work for starting the first game.
But the culprit seems to be here:
I've added a break if the cardwidth ever becomes 0 or negative, which seems to have resolved the game 2 issues, if someone more familiar with the code has a better fix feel free to go for it.
- Stack Trace | Open
It appears this happens prior to the previous cards are cleared from all zones (I'm not exactly sure why this doesn't happen sooner than it does).
From what I can tell, there's a Binary Search that is attempting to find the "best" value to fit the screen to. For whatever reason a suitable match is never found (I guess due to a 0 screen width and cards existing in a visible zone) When I paused during this infinite loop, the value was less than -150k. I tried to clear the cards in the zones earlier, but that doesn't seem to want to work for starting the first game.
But the culprit seems to be here:
- Code: Select all
// if it did not fit this time, let it fit with a one-pixel less size
if ( !workedLastTime && step == 0 ) {
step = 1;
}
I've added a break if the cardwidth ever becomes 0 or negative, which seems to have resolved the game 2 issues, if someone more familiar with the code has a better fix feel free to go for it.