Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: client/tilespec.[ch] cleanup
Home

[Freeciv-Dev] Re: client/tilespec.[ch] cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: client/tilespec.[ch] cleanup
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Feb 2002 08:42:04 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Feb 06, 2002 at 10:33:37PM +0000, Vasco Alexandre Da Silva Costa wrote:
> Hello,
> 
> I've cleaned this up a bit and removed the dir8_to_dir4() function.
> My cleanup target was fill_tile_sprite_array_iso() so if you probably
> should check that one out.
> 
> Comments?

> +    const int dirs[4][3] = {
> +        /* up */
> +        { DIR_CCW(DIR8_NORTHWEST), DIR8_NORTHWEST, DIR_CW(DIR8_NORTHWEST) },
> +        /* down */
> +        { DIR_CCW(DIR8_SOUTHEAST), DIR8_SOUTHEAST, DIR_CW(DIR8_SOUTHEAST) },
> +        /* left */
> +        { DIR_CCW(DIR8_SOUTHWEST), DIR8_SOUTHWEST, DIR_CW(DIR8_SOUTHWEST) },
> +        /* right */
> +        { DIR_CCW(DIR8_NORTHEAST), DIR8_NORTHEAST, DIR_CW(DIR8_NORTHEAST) }
> +      };

Should be done in a loop. This will give shorter code which would be
more clear on the intention.

> -      SAFE_MAPSTEP(x1, y1, abs_x0, abs_y0, dir);

If you remove the last SAFE_MAPSTEP you can remove it altogether. You
may move the SAFE_MAPSTEP definition into tilespec.c.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "The primary purpose of the DATA statement is to give names to
   constants; instead of referring to pi as 3.141592653589793 at every
   appearance, the variable PI can be given that value with a DATA
   statement and used instead of the longer form of the constant. This
   also simplifies modifying the program, should the value of pi
   change."
    -- FORTRAN manual for Xerox Computers


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