Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Re: (PR#11336) [Patch] movetype.[ch]
Home

[Freeciv-Dev] Re: (PR#11336) [Patch] movetype.[ch]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11336) [Patch] movetype.[ch]
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Dec 2004 15:11:07 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11336 >

Marko Lindqvist wrote:

>   Replaced your unit_can_defend_here() comment with comment of my own 
> and changed code to comply. Behavior (for existing rulesets) is not 
> changed, but implementation is more general (handles sea units 
> transported by land units etc)

> +/****************************************************************************
> +  Return TRUE iff the unit can be a defender at its current location.  This
> +  should be checked when looking for a defender - not all units on the
> +  tile are valid defenders.
> +****************************************************************************/
> +bool unit_can_defend_here(struct unit *punit)
> +{
> +  /* Even transported units may step out from transport to fight,
> +     if this is their native terrain. */
> +  if (can_unit_exist_at_tile(punit, punit->tile)) {
> +    return FALSE;
> +  }
> +  
> +  return TRUE;
> +}

This looks backward.  If the unit can exist at this tile (without a 
transporter) you want to return TRUE, not the other way around.  So this 
function should just be

{
   return can_unit_exist_at_tile(punit, punit->tile);
}

-jason





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