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: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Jul 2003 00:10:43 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Andy Smith wrote:
> On Mon, Jul 28, 2003 at 11:15:47PM -0700, Jason Short wrote:
> 
>>There are several "handicaps" that you should check.  If the handicap 
>>flags are set (as they are for the current AI) then the player is 
>>allowed to cheat in this way.
> 
> 
> Apologies, I'm a bit new to this code.  Are you saying that:
> 
> if (pplayer->ai.control && !ai_handicap(H_MAP)) {
>   /* AI is allowed to cheat and attack units at this location. */
> }
> 
> (plus handling for H_FOG too)

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.

Note that human players could potentially be given handicaps too, so 
pplayer->ai.control need not be checked.

> Seems none of the AI levels by default include H_MAP or H_FOG so any AI
> would be free to cheat like this.  OTOH I guess it has been like
> this for a while and no one has noticed before.

The problem isn't that nobody has noticed, the problem is that these 
handicaps aren't checked everywhere - so disabling them wouldn't help 
much at this point.  It doesn't help that the AI really needs to cheat 
otherwise it will get killed.

I'm sure any patches to introduce handicap checks would be appreciated.

jason




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