Hi all:
About the magic numbers, they seem needed to recover the resolution after exiting the game: first I just reordered the resolution without changing the magic number, and it seemed to work; but when I exited and launched it again, the resolution it used was wrong. I was selecting 1680x1050, with magic number 18, and when I relaunched UFOAI, the resolution selected was 1400x1050, which was the one in the position 18 in the reordered list. I, then, changed the magic values, and all worked fine.
So it seems that UFOAI stores that value in the configuration in order to retrieve the resolution the next time the game is launched.
Another detail about ordering: it's not possible to just use a generic string sorting function, because the resolution must be sorted first by vertical resolution, not by horizontal resolution. This is needed to ensure that, in small screens, the user will always be able to see the desired vertical resolutions.