I am trying to understand and document the map drawing logic in MapViewer. There are quite a few magic variables, which I think fit into three categories:
1. Dependent on map scale: e.g. tileHeight et al I think I understand these, and have collected their maintenance into updateScaledVariables() 2. Dependent on map size (and scale): e.g. topSpace I do not understand these, but can see the dependency and have collected their maintenance into updateSizeVariables() 3. Dependent on map position: e.g. bottomRows I have not tried to understand these yet Looking at category 2 then: (leftSpace, topSpace) appears to tbe the pixel coordinate of the upper left corner of a tile if it were to be drawn in the center of the map-window. For some reason there is also a rightSpace equal to leftSpace, but no bottomSpace. topRows is possibly the "number of rows that will be drawn above the center tile" of the comment, and there is again a bottomRows equal to topRows. TopRows is roughly topSpace divided by half the tile height. One would imagine there would be corresponding left and right variables, but that happens in getLeft/RightColumns() where leftSpace is divided by the full tile width, unlike for topRows. In all cases there are magic +/-1 factors added, and a mysterious magic 32 in a test: (leftSpace % tileWidth) > 32 Pretty much every sentence in the above paragraph should be read with a ", but why?" on the end:-). I am posting this message in the hope that someone who has worked on this code in the past has some wisdom to pass on. Preferrably with a little more detail than "it has to do that so the map-projection works". Cheers, Mike Pope
pgp4kACR0blpx.pgp
Description: OpenPGP digital signature
_______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers