Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: rand_pos function andusage(PR#1017)
Home

[Freeciv-Dev] Re: PATCH: rand_pos function andusage(PR#1017)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: PATCH: rand_pos function andusage(PR#1017)
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Mon, 29 Oct 2001 20:49:42 -0500

If Raimar is just suggesting, or willing to relent here, I am fine
with these two do/while cases.

I picked up these two attempts to get a foot in the door. But the
practical reality here is that these are not a major efficiency hit
and not really worth a hardline principle-or-die fight.

Besides, except where there are clear practical reasons not to do
something a little local coding freedom is fine, and this can play
on that argument.

rand_pos() has some use, it is just not the world's answer to every
random selection problem, and next time will likely be a quite
different story :-).

Cheers,
RossW
=====

At 12:46 PM 01/10/29 -0500, Jason Dorje Short wrote:
>Raimar Falke wrote:
>> 
>> On Sun, Oct 28, 2001 at 06:50:46PM -0800, jdorje@xxxxxxxxxxxxxxxxxxxxx
wrote:
>> > "Ross W. Wetmore" wrote:
>> > >
>> > > At 01:19 AM 01/10/24 -0400, Jason Dorje Short wrote:
>> > > >"Ross W. Wetmore" wrote:
>
>> > In the meantime, can we agree on this patch?  It replaces all of the
>> > innocuous random position selection with rand_pos, getting rid of most
>> > of the "bad" code (including everything not in mapgen).  It does not use
>> > regular_map_pos_is_normal (which I'd be happy to add back in if
>> > desired).
>> >
>> > I hope we can bring an end to these simple rand_pos changes, leaving the
>> > harder ones for later.
>> 
>> I will accept it if you take out the two cases where you use the extra
>> do-while loop.
>
>-  x = myrand(map.xsize);
>-  y = 1 + myrand(map.ysize-2);  /* No uprising on North or South Pole
>*/
>+  /* No uprising on North or South Pole */
>+  do {
>+    rand_pos(&x, &y);
>+  } while (y == 0 || y == map.ysize-1);
>
>Can't we leave this one?  The chances of the loop repeating are very
>small.
>
>I don't care so much about the mapgen loop, but the above loop for
>barbarian generation would then be the only non-mapgen code to use the
>old construct.  I'd like to avoid that if at all possible.
>
>If you insist, I'll remove it - it'll then become more important to get
>the alternate rand_pos form into CVS earlier, which Ross probably won't
>like :-).
>
>jason
>
>



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