Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: another simple topology cleanup (PR#1015)
Home

[Freeciv-Dev] Re: PATCH: another simple topology cleanup (PR#1015)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: PATCH: another simple topology cleanup (PR#1015)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 Oct 2001 14:08:56 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Oct 15, 2001 at 04:05:13AM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:
> This patch makes some more more-or-less innocuous changes, replacing the
> old-style code with the new normalize_map_pos, is_real_tile,
> square_iterate, and the like.  This time the changes are done in the
> client.
> 
> I haven't checked, but I'm pretty sure this overlaps entirely with
> Gaute's patch to make is_real_tile replacements.
> 
> Also, the square_iterate in control.c is necessary for the check_map_pos
> patch to work correctly.

> -  for(y=punit->y-2; y<punit->y+3; ++y) { 
> -    if(y<0 || y>=map.ysize)
> -      continue;
> -    for(x=punit->x-2; x<punit->x+3; ++x) { 
> -      unit_list_iterate(map_get_tile(x, y)->units, pu)
> +  square_iterate(punit->x, punit->y, 2, x, y) {
> +      unit_list_iterate(map_get_tile(x, y)->units, pu) {
>       if(unit_flag(pu, F_PARTIAL_INVIS)) {
> -       refresh_tile_mapcanvas(map_adjust_x(pu->x), y, 1);

> +       /* Do we really want to update more than once? */

IMHO no. But what is the alternative? A (un)buffer_refresh_mapcanvas?

> +       refresh_tile_mapcanvas(x, y, 1);
>       }
> -      unit_list_iterate_end
> -    }
> -  }
> +      } unit_list_iterate_end;
> +  } square_iterate_end;

>  /**************************************************************************
> -...
> +This function is now identical in all GUI's except BeOS.
>  **************************************************************************/
>  void refresh_tile_mapcanvas(int x, int y, int write_to_screen)
>  {
> -  x = map_adjust_x(x);
> -  y = map_adjust_y(y);
> +  if (!normalize_map_pos(&x, &y))
> +    return;

An assert would be better.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Are you saying that you actually used the Classpath Java AWT classes in 
  addition to the GTK peers and got them to display something?
  Wow.  That's way better than I did and I wrote the code!"
    -- Aaron M. Renn in the classpath mailing list


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