From: Roland C. <rc...@us...> - 2014-02-25 11:30:21
|
On di, 2014-02-25 at 09:26 +0100, Rodrigo Espiga Gómez wrote: > I need to know if a node gives me access to a port. As far as I can > tell by the way it is used inside score_hex (in greedy.c), if > hex.resource==ANY_RESOURCE that means that the hex has a generic > port, and if a node is adjacent to that Hex then it has access to that > port. So that means that the hex is a maritime one, isn’t it? And if > resource is a different one, does that mean that the hex has a > specific port? Take a look at the code in the editor. editor/gtk/editor.c lines 746-766 contains the logic to determine in which direction the port is pointing. So in the Hex structure, the terrain must be at sea, only then the resource indicates the type of the port. The value of facing shows which nodes it is pointing at. See also the diagram in common/map.c for an explanation of the coordinate system. > What confuses me a bit is that, although ports in the game are > conceptually associated with edges (or pairs of nodes), in the code > that information is contained within the Hex structure. And sometimes > two hexes are adjacent to the same maritime one, and some of their > nodes have access to the port and others don’t! In the board game, I've always associated the ports with the sea hex it is located on, and with the two nodes that actually can trade using this port. So I am not confused by having this information in the Hex structure :-) > So where do I have to look at to find out if a node gives me access to ports (generic and specific)? Answered above. With kind regards, Roland Clobus |