Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2000:
[Freeciv-Dev] Re: patch: Pangea
Home

[Freeciv-Dev] Re: patch: Pangea

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Freeciv List" <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: patch: Pangea
From: "Peter Schaefer" <schaefer@xxxxxx>
Date: Sat, 20 May 2000 02:46:24 +0200


>I haven't tested it a lot and I get this message
>1: mapgen.c: mass doesn't sum up.
>but it seems to work anyway...
>

What you did looks okay;
one small point:
In this line:
> if(checkmass>map.xsize+map.ysize+totalweight)

totalweight might not be initialized(it should be zero, one, or removed from
line).

The line actually should check for checkmass>0
but due to rounding errors and placement problems
xsize,ysize,totalweight should state a tolerable tolerance.

>I tried to figure that message out but I really think the abundance
>of global variables i mapgen.c makes it really painful to figure that
>code out... :}
>

I see its the kind of code that I understand only while writing it :-|

If checkmass<0 , more land has been placed than was requested initially.

The value of i should indicate how much land has been requested more than
has been placed.
{ freelog(LOG_NORMAL,"mapgen.c: mass doesn't sum up."); return i; }

Guessing, might be caused by:

-generous rounding somewhere
- off by one error when setting up the buckets in makeisland, at
least when compared to the use in fillisland:
#1096  if (*bucket <= 0 ) return;
#1097   capac = totalmass;
#1098   i = *bucket / capac;
#1099   i++;
#1100   *bucket -= i * capac;
#1101
I always have a bad feeling with this, but I cant place my finger on it :-|
Maybe it is because capac is an int, not a long int like totalmass ..
but then it think total mass is long only so that all expressions
using totalmass become long int :-P

&
Making an island this way is a little slow when the
landmass is large and the island
hits the top(y=3) and bottom(y=97) of a big map.















[Prev in Thread] Current Thread [Next in Thread]