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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#7408) Client knows about hidden units
From: "mateusz stefek" <matusik_s@xxxxx>
Date: Mon, 23 Feb 2004 23:26:04 -0800
Reply-to: rt@xxxxxxxxxxx

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

On 2004.02.19 21:14, Jason Short wrote:
> <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

See barbarians can not be created on land. try_summon_barbarians() checks if 
(xu, yu) is ocean, so this is correct. Only mistake is in this code:
  if (map_has_special(x, y, S_HUT)) { /* remove the hut in place of uprising */
    map_clear_special(x,y,S_HUT);
    send_tile_info(NULL, x, y);
  }
because barbarians are created at (xu, yu) and hut is removed at (x,y)

and the code:
  unit_list_iterate(map_get_tile(x, y)->units, punit2) {
    send_unit_info(NULL, punit2);
  } unit_list_iterate_end;

is just redundant, because create_unit_full sends the same info
--
mateusz





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