Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2002:
[freeciv-ai] Re: patch/rfc: goto and move/attack test wrapping
Home

[freeciv-ai] Re: patch/rfc: goto and move/attack test wrapping

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: patch/rfc: goto and move/attack test wrapping
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 27 Nov 2002 18:40:48 +0000 (GMT)

On Wed, 27 Nov 2002, Gregory Berkolaiko wrote:
> The above separation is very good.The implementation is somewhat lacking
> but I would like to think it's only temporary.Should put the above
> explanations into the codeand maybe into the AI_hacking_guide or whatever
> it is called.Maybe more descriptive names, if you can come up with
> something (I cannot).

Ok.

> > +ai_unit_new_activity(punit, ACTIVITY_GOTO);
> > +result = do_unit_goto(punit, GOTO_MOVE_ANY, FALSE);
> > +ai_unit_new_activity(punit, activity);
>
> You will segfault here if the unit died.Or am I wrong in assuming that
> unit structure is destroyed upon death?

Duh. My fault.

> > +punit->activity = ACTIVITY_IDLE;
> > +can_move = can_unit_move_to_tile(punit, x, y, igzoc);
> > +punit->activity = activity;
>
> Direct setting of activity should not be done!!

> Anyway, I think the right solution for the problem is to boldly remove
> check number 1 -- it makes little sense anyway.

> I read through can_unit_attack_tile and it's sub-functions and I see no
> place where activity is actually checked for.This makes the function
> useless.

I don't think messing with test_*() is wise, and it certainly is not
necessary, since we pass the activity to test against to it as a
parameter.

I'll make a new patch.

  - Per



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