Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: Server Error (PR#666)
Home

[Freeciv-Dev] Re: Server Error (PR#666)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: =?cn-big5?b?vbKr7bXY?= <iquin@xxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Server Error (PR#666)
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: 29 Jan 2001 01:33:28 +0000

On Sun, 28 Jan 2001, iquin@xxxxxxxxxx wrote:

>> I am quite sure I found the real error. [snip]
> Well, I was just guessing, you're correct.
> 
>> Why not just
>> yo = myrand(map.ysize);
>> xo = myrand(map.xsize);
> +---------------+-------+ 0              Your island size is as
> |               |       |                large as region D. If
> |       A       |   B   |                you pick a random spot
> +---------------+-------+ map.ysize+n-s  in region C or D, you
> |       C       |   D   |                can't place your island
> +---------------+-------+ map.ysize      as it will touch the
> 0      map.xsize+w-e  map.xsize          south pole. While region
>                                          B causes x wraparound.
>>> What I can recall is placeisland() was not meant to place islands
>>> across x=0.
>> Why not?

So that it will always be possible to move from the north pole to the
south pole by water.  I think.

> The effect is barely noticable and this is a CPU intensive part.
> Also, I suspect rewriting for(x=w;x<e;x++)do_something(x+xo-w);
> to x=e-w;do do_something(x+xo-1);while(--x); helps in optimization.

The compiler is perfectly capable of performing that sort of trivial
optimisation itself.  Or at least it should.  8-)

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
If I had a Q-TIP, I could prevent th'collapse of NEGOTIATIONS!!



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