Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: patch: port attacks!
Home

[Freeciv-Dev] Re: patch: port attacks!

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch: port attacks!
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Tue, 12 Mar 2002 05:25:55 -0800 (PST)

--- "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> wrote:
> On Tue, 12 Mar 2002, Raahul Kumar wrote:
> > You are a coding machine. There is no real Per. You must be an auto code
> > generator ;-).
> 
> I'm flattered, but c'mon, it is only a couple of lines! :)
> 
> > >        /* This will make units roughly evenly good defenders look alike.
> */
> > >        int unit_def = (int) (100000 * (1 - unit_win_chance(attacker,
> > > defender)));
> > > +      /* Ensure that seaborne units that can only attack other seaborne
> > > +         units can actually attack enemy seaborne units in a stack if
> > > +         they are present, and not fail because the enemy chose to
> > > +         defend with a ground unit. Go, subs, go! {:-) - Per */
> > > +      if (unit_flag(attacker, F_NO_LAND_ATTACK)
> > > +          && is_sailing_unit(defender))
> > > +              unit_def += 100000;
> >
> > I'd like to know why you are adding this number to unit_def. In short, how
> > does it work
> 
> Whichever unit has the higher calculated unit_def is chosen as defender.
> 100000 is a number so big you cannot ignore it :) Especially since it is
> used as a ceiling in line 2 quoted above...
> 

I like the look of it. You realise the AI needs to know about this little
change. I'm also amazed that these are the only lines that need changing.
I'm sure there are various flags in the code that check if no_land_attack.

It seems incomplete. I'll test it and let you know if there are any obvious
bugs.

> Yours,
> Per
> 
> "My mother never saw the irony in calling me a son-of-a-bitch."
>  -- Jack Nicholson
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/


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