Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] (PR#7408) Client knows about hidden units
Home

[Freeciv-Dev] (PR#7408) Client knows about hidden units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: matusik_s@xxxxx
Subject: [Freeciv-Dev] (PR#7408) Client knows about hidden units
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 12:14:27 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >

> [matusik_s@xxxxx - Tue Feb 17 08:34:29 2004]:
> 
> On 2004.02.14 19:03, Jason Short wrote:
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
> [...]
> > > I found some stupid bug in try_summon_barbarians()
> > > Patch attached. Unfortunatelly problem is much more complicated.
>    In
> > > this case xu = x and yu = y so the patch doesn't change anything.
> >
> > I don't think this is correct.  (xu,yu) is not the same as (x,y).
> > Unleash_barbarians is called when a player enters a hut.  The hut is
>    at
> > (x,y) and the barbarians are unleashed at adjacent positions
>    (xu,yu).
> >
> But we are talking about try_summon_barbarians(). It randomly chooses
>    (x, y). Then finds empty tile nearby (xu, yu) and creates
>    barbarians there. I don't know why it does it that way. But I'm
>    sure that it is possible that there is a hut at (xu, yu)

Yes, you're right.

- Position (x,y) is chosen randomly and checked.
- A "nearby" empty position (xu, yu) is generated. (u == uprising?)
  (nearby => within 1 tile)
- Barbarians are created at (xu, yu).
- But some checks are still done on (x,y).

Another buglet: find_empty_tile_nearby doesn't pick a nearby tile at
random.  It has a large bias.

I assume the nearby position is done to increase the chances of having a
successful uprising, since if any check fails the uprising fails.  But
this is probably a bad thing since we don't really want to generate a
barbarian anywhere in sight of _any_ player.  Or do we?  It looks like
land players are only generated in known territory.  Very odd.

Anyway, I think your patch (try_summon_barbarians.diff) is right.  Can
someone else look at this and confirm it?  I don't understand why we
don't get rampant segfaults when sea barbarians were generated on land.

jason



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