Re: [Freecol-developers] Strange getSurroundingTiles behaviour

2019-01-08 Thread Michael T. Pope
On Tue, 8 Jan 2019 21:10:18 +0100
Sébastien Fauvel  wrote:
> I try to understand application to give some help if I can.
> I found a strange behviour in MapTest (method testGetSurroundingTiles).

Look at Direction.java for clarification, although ISTR there are
better commented places which I can not bring to mind.

The way the grid is laid out is not something I can comment on with any
confidence as it was in place from years before I joined the project.  I
certainly recall finding it surprising initially, however it clearly
works, and knowing nothing much about map projections I am happy to credit
the elder developers with knowing what they were doing.

Generally I think it is best not to have to think about the map
embedding detail, and use abstractions like getSurroundingTiles() that
hide that from you.

Cheers,
Mike Pope


pgpQu8icnsovG.pgp
Description: OpenPGP digital signature
___
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers


[Freecol-developers] Strange getSurroundingTiles behaviour

2019-01-08 Thread Sébastien Fauvel
Hello,

I try to understand application to give some help if I can.
I found a strange behviour in MapTest (method testGetSurroundingTiles).

// Check in the middle
List surroundingTiles = new ArrayList<>();
for (Tile t: map.getTile(4,8).getSurroundingTiles(1))
surroundingTiles.add(t);

assertEquals(8, surroundingTiles.size());
assertTrue(surroundingTiles.contains(map.getTile(4, 6)));
assertTrue(surroundingTiles.contains(map.getTile(4, 10)));
assertTrue(surroundingTiles.contains(map.getTile(3, 8)));
assertTrue(surroundingTiles.contains(map.getTile(5, 8)));
assertTrue(surroundingTiles.contains(map.getTile(3, 7)));
assertTrue(surroundingTiles.contains(map.getTile(4, 7)));
assertTrue(surroundingTiles.contains(map.getTile(3, 9)));
assertTrue(surroundingTiles.contains(map.getTile(4, 9)));

I don't understand why there is (4, 6) and (4, 10).
I would expected instead (5, 7) and (5, 9)
Did I miss something ?

Cheers
Seb

___
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers