Summary: Comments about map size limits in map.h do not
match code
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Sun Jun 26 14:48:31 2011
                Category: general
                Severity: 2 - Minor
                Priority: 5 - Normal
                  Status: Need Info
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 



/* This defines the maximum linear size in _map_ coordinates.
 * This must be smaller than 255 because of the way coordinates are sent
 * across the network. */
#define MAP_MAX_LINEAR_SIZE      512
#define MAP_MIN_LINEAR_SIZE      16

The max size is clearly bigger than 255.

I'm pretty sure the comment is no longer true. On S2_2 (pre patch #1731),
coordinates were generally sent as COORD X,Y where COORD=uint8. Now they're
sent as TILE=sint32 (indices rather than coordinates).

/* Size of the map in thousands of tiles.  Setting the maximal size over
 * than 30 is dangerous, because some parts of the code (e.g. path finding)
 * assume the tile index is of type (signed short int). */
#define MAP_DEFAULT_SIZE         4
#define MAP_MIN_SIZE             0
#define MAP_MAX_SIZE             128

I'm less sure about this one. Clearly, if it were still true, that would be a
bug in S2_3. In patch #1731 I see a change to path_finding.c that might be
sufficient to make the comment invalid.

I'll remove these comments soon unless someone pipes up.

Are there any new comments we want here about map size constraints? The most
obvious one is that tile indices can't exceeed 2^31, due to the definition of
TILE in packets.def. Anyone know of other constraints?


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to