Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: check_map_pos update
Home

[Freeciv-Dev] Re: check_map_pos update

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: check_map_pos update
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Tue, 23 Oct 2001 23:14:44 -0400

The code comment says it stops the unit from being drawn on top of 
city tiles when it is moving.

Try ending your turn on top of a city and see what it does.

Or look in the unit drawing code to see if it has a city check that
it didn't used to, or if there is a different draw path when you 
are moving or in focus that pops you to the top of the heap. 

Is there a corresponding check for this magic coordinate later 
in the code flow, or a unit position reset?

Maybe the code below gives clues.

Is there a bug report or CVS annotation?

Not being a gooey person, I can only make educated guesses at why 
one does such icky things :-).

Cheers,
RossW
=====

/**************************************************************************
note: punit can be NULL
We make sure that the previous focus unit is refreshed, if necessary,
_after_ setting the new focus unit (otherwise if the previous unit is
in a city, the refresh code draws the previous unit instead of the city).
**************************************************************************/
void set_unit_focus(struct unit *punit)
{
  struct unit *punit_old_focus=punit_focus;

  punit_focus=punit;

  if(punit) {
    auto_center_on_focus_unit();

    punit->focus_status=FOCUS_AVAIL;
    refresh_tile_mapcanvas(punit->x, punit->y, 1);
  }

  /* avoid the old focus unit disappearing: */
  if (punit_old_focus!=NULL
      && (punit==NULL || !same_pos(punit_old_focus->x, punit_old_focus->y,
                   punit->x, punit->y))) {
    refresh_tile_mapcanvas(punit_old_focus->x, punit_old_focus->y, 1);
  }

  update_unit_info_label(punit);
  update_menus();
}
   
At 12:57 AM 01/10/22 -0400, Jason Dorje Short wrote:
>There appears to be just one piece of code left that is not consistent
>with the check_map_pos change:
>
>[jshort@jason freeciv]$ cvs diff client/
>Index: client//control.c
>===================================================================
>RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
>retrieving revision 1.62
>diff -u -r1.62 control.c
>--- client//control.c  2001/10/18 15:12:46     1.62
>+++ client//control.c  2001/10/22 04:55:27
>@@ -1030,7 +1030,7 @@
>   was_teleported=!is_tiles_adjacent(punit->x, punit->y, pinfo->x,
>pinfo->y);
>   x=punit->x;
>   y=punit->y;
>-  punit->x=-1;  /* focus hack - if we're moving the unit in focus, it
>wont
>+  /* punit->x=-1; */  /* focus hack - if we're moving the unit in
>focus, it wont
>                * be redrawn on top of the city */
> 
>   unit_list_unlink(&map_get_tile(x, y)->units, punit);
>
>
>Is this focus hack needed?  What does it do?  I can't quite see the
>difference when it's disabled.
>
>jason




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