Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] Re: (PR#9864) Terrain under cities changes during save+loa
Home

[Freeciv-Dev] Re: (PR#9864) Terrain under cities changes during save+loa

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9864) Terrain under cities changes during save+load
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Sep 2004 10:27:56 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9864 >

Marko Lindqvist wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9864 >
> 
> 
>   Attached patch should fix this.
> 
>   Basicly I just reversed logic. No longer is tile knowledge updated 
> when tile is sent, but tile is sent to clients when player knowledge 
> about it changes.

Very nice.

I'm a bit concernaed about this part though...

>  /***************************************************************
> -...
> + Give player correct knowledge about tile, return true iff
> + knowledge changed.
>  ***************************************************************/
> -void update_tile_knowledge(struct player *pplayer, int x, int y)
> +bool update_player_tile_knowledge(struct player *pplayer, int x, int y)
>  {
>    struct tile *ptile = map_get_tile(x, y);
>    struct player_tile *plrtile = map_get_player_tile(x, y, pplayer);
>  
> -  plrtile->terrain = ptile->terrain;
> -  plrtile->special = ptile->special;
> +  if (plrtile->terrain != ptile->terrain ||
> +      plrtile->special != ptile->special) {
> +    plrtile->terrain = ptile->terrain;
> +    plrtile->special = ptile->special;
> +    return TRUE;
> +  }
> +  return FALSE;

How come update_tile_knowledge does the send() but 
update_player_tile_knowledge does not?  Seems like it would be better to 
do the send direcly from within update_player_tile_knowledge().  Of all 
the places where you changed send_tile_info(NULL, x, y) to 
update_tile_knowledge(x, y)...there are none where you change any other 
callers.  Shouldn't send_tile_info_always users be fixed?  Or will it 
take more work to fix the "always" hack in there?

jason




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