Why IS this code WORKING?
BlitzMax Forums/BlitzMax Beginners Area/Why IS this code WORKING?
| ||
This question may seem odd but my code now works via tinkering around. It actually sorts my highscore objects by their score values WITHOUT me telling them to. Why is this? It's great that it works but things like this often have very iffy results... |
| ||
I see a Sortlist in there? |
| ||
Your Method Compare is screwy though. Just suppose to return 1 for Yes and -1 for No. Method Compare(otherObject:Object) If otherObject.score>score Return 1 Return -1 End Method |
| ||
@Ryan Burnside:Just in case your question is how sortlist knows how to sort your list: The method compare is suposed to be implemented for 'sortable' types. In your compare method you're telling how to sort your scores, as the comparison is being made by the score field. Change the score field comparison by a "player" field comparison, and you'll get the socres sorted by player's name. Isn't it great? |
| ||
Thanks you for all your help. |