[freeciv-ai] Re: ai move cleanup #4
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 8 Aug 2002, Per I. Mathisen wrote:
> On Thu, 8 Aug 2002, Gregory Berkolaiko wrote:
> > Issue 1:
> >
> > In ai_unit_bodyguard_move:
> > +if (bodyguard->moves_left < map_move_cost(bodyguard, x, y)) {
> > + /* should generally should not happen */
> > + freelog(LOG_VERBOSE, "%s: %s left its %s bodyguard behind at (%d,%d)!",
> > + pplayer->name, unit_type(punit)->name,
> > + unit_type(bodyguard)->name, x, y);
> > + return;
> > +}
> >
> > If bodyguard->moves_left > 0, the bodyguard can still attempt to move!
>
> Right.
>
> (Interestingly, if I read the code right, a unit with move == 0 can still
> attack. Is this correct or a misreading or a bug? Seems the client stops
> it from happening, but a modified client should be able to do it.)
Where did you find it? That'd be very strange.
> > Issue 3:
> >
> > In do_unit_goto, why do you remove
> >
> > - /* Don't attack more than once per goto */
> > - if (penemy && !pplayer->ai.control) { /* Should I cancel for ai's too?
> > */
> > - punit->activity = ACTIVITY_IDLE;
> > - send_unit_info(NULL, punit);
> > - return GR_FOUGHT;
> > - }
> > -
>
> This check is done in ai_unit_move. The function returns FALSE, and
> do_unit_goto returns GR_FAILED. Just as it was before, except then it was
> handle_unit_move_request that did it. The AI code doesn't check for
> GR_FOUGHT and the above code would (in theory) never be called.
Just a moment. The above code is for the humans! It should stay IMO.
> > The rest seems to be pretty good work.Also seems to fix the bug when an
> > attacker wouldn't occupy an empty city because it's bodyguard wouldn't
> > budge.I didn't test it though. Savegames would differ at later stage, I
> > assume?
What happened to the spaces after full stops in the passage above??
G.
|
|