Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] Re: (PR#4701) autoattack oddities esp. with cruise missile
Home

[Freeciv-Dev] Re: (PR#4701) autoattack oddities esp. with cruise missile

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: andy@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4701) autoattack oddities esp. with cruise missiles
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Tue, 29 Jul 2003 06:17:56 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, 29 Jul 2003, Andy Smith wrote:

> On Tue, Jul 29, 2003 at 12:52:25AM -0700, Andy Smith wrote:
> > On Tue, Jul 29, 2003 at 12:10:43AM -0700, Jason Short wrote:
> > > I think in this case the check should be
> > > 
> > >    if ((ai_handicap(pplayer, H_MAP) || ai_handicap(pplayer, H_FOG))
> > >        && (!map_get_known_and_seen(x, y, pplayer)
> > >            || !player_can_see_unit_at_location(pplayer, enemy, x, y))) {
> > >      continue;
> > >    }
> > > 
> > > in other words, only if the H_MAP (all-tiles-known) and H_FOG 
> > > (all-tiles-seen) handicaps are unset is the vision check skipped.
> > > 
> > > OTOH I always have trouble with the logic of the handicaps.
> > 
> > Yes, unfortunately from checking some other uses of ai_handicap()
> > (e.g. http://www.freeciv.org/lxr/source/server/unittools.c#L2289) it
> > seems to me that the logic is actually the opposite here.
> 
> Ignore that, you're right of course.  I am beginning to confuse
> myself with the logic now. :)
> 
> How's this patch (attached)?
> 
> I wanted to match up H_MAP with map_get_known() and H_FOG with
> map_get_seen() but map_get_seen() is static to maphand.c so I had to
> use map_get_known_and_seen() for the second one.  That works but is
> maybe a little confusing.  Should be noted, or map_get_seen() should
> be made visible?

No.  To the end user seen implies known.  In the server, "seen" means a 
subtly different thing and a tile might be seen and not known --- when it 
is in a city radius.

Also, map_get_known and map_get_known_and_seen should be renamed to
map_is_known and map_is_known_and_seen, because they return bool.

> Otherwise if it is just as you said above then won't an AI with
> H_MAP but _without_ H_FOG wrongly fail map_get_known_and_seen() for
> tiles that it knows and is allowed to cheat to see?

Oh, well done!  It took me several minutes to realise that your code is 
right...

BTW, if you see any excessive checking of pplayer->ai.control next to 
ai_handicap, you are welcome to make patches to change it.

G.





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