MArcomage

Free multiplayer on-line fantasy card game

Please log in

Fithz Hood on 09:44, 10. Nov, 2009
I noticed that if I play more than 10 cards in a turn the played card's pile doesn't respect the cronology. for exemple I've played imp cache as last card (15th), but in the pile it's in the tenth position, between two quick cards (and this is obviously impossible 'cause imp cache isn't quick/swift)
http://img30.imageshack.us/img30/679/firstrv.png
http://img24.imageshack.us/img24/3885/secondwu.png
Mojko on 10:49, 10. Nov, 2009
Interesting bug... I fixed it in https://netvor.sk/trac/arcomage/changeset/692. Changes should be applied soon.

I must give credit to Fithz Hood, since his debug information is very clear. Indeed, this bug occured only when you have 10 or more cards in discard pile. It was caused by incorrect ordering mechanism.

You see cards were sorted by their position marker. The marker looks like this: kN, where N is the position of the discarded card.

Let's assume N = 5. The order would look like this: k5, k4, k3, k2, k1. Which is correct. However, when having N > 9, then the order is incorrect. For N = 12, the order would look like this: k9, k8, k7, k6, k5, k4, k3, k2, k12, k11, k10, k1. This is a standard lexicographical order, because the markers are strings, not numbers.

So, I only changed markers to numbers and selected a standard number ordering :)

Btw. I noticed that played cards are displayed in the descending order, so the last card played is the first. But, the cards discarded by card effect, are displayed in ascending order. Shouldn't both mentioned card piles use the same order mechanism?