Small correction on the last commit to avoid an integer overflow
error on large areas (need type dlong to encode areas in internal units).
This commit is contained in:
parent
1fe128a405
commit
46eefe8c33
|
|
@ -1109,6 +1109,7 @@ cifGatherFunc(tile, atotal, mode)
|
|||
{
|
||||
Tile *tp;
|
||||
TileType type;
|
||||
dlong locarea;
|
||||
Rect area, newarea;
|
||||
ClientData cdata = (mode == CLOSE_SEARCH) ? (ClientData)CIF_UNPROCESSED :
|
||||
(ClientData)CIF_PENDING;
|
||||
|
|
@ -1130,7 +1131,12 @@ cifGatherFunc(tile, atotal, mode)
|
|||
if (mode == CLOSE_SEARCH)
|
||||
{
|
||||
if ((*atotal != INFINITY) && (*atotal < growDistance))
|
||||
*atotal += (area.r_xtop - area.r_xbot) * (area.r_ytop - area.r_ybot);
|
||||
locarea = (dlong)(area.r_xtop - area.r_xbot)
|
||||
* (dlong)(area.r_ytop - area.r_ybot);
|
||||
if (locarea > (dlong)INFINITY)
|
||||
*atotal = INFINITY;
|
||||
else
|
||||
*atotal += (int)locarea;
|
||||
}
|
||||
else if (mode == CLOSE_FILL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue