[Freeciv-Dev] Re: (PR#7242) Unit in city flag not updated when unit leav
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7242 >
ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7242 >
>
> On Thu, Jan 15, 2004 at 05:32:42PM -0800, Jason Short wrote:
>
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=7242 >
>>
>>ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
>>
>>><URL: http://rt.freeciv.org/Ticket/Display.html?id=7242 >
>>>
>>>Hi,
>>>
>>>when moving a unit out of a city the flag which shows if a unit is in
>>>the city isn't updated. (Flag shows that there is a unit) after
>>>refocusing the flag disappears.
>>>
>>>gtk-2.0 client current cvs. Think it's related to the science dialog
>>>error.
>>
>>If you cover the window (with another window) and then uncover it, is it
>>redrawn correctly or not?
>
>
> No. When i have an empty city (no additonal flag) and then moving an
> exprorer into the city it gets the flag. After moving the explorer out
> of the city it doesn't lose the flag.
>
> Resisizing -> flag is away.
> Changing map position -> flag is away.
> Next turn -> flag is awag.
> With open city dialog -> flag on map doesn't disapear, flag on city
> window disapears.
So the client knows that the city isn't occupied but it doesn't redraw
the city tile.
Does this patch fix the problem? I think it should.
Using logic in handle_unit_packet_common to update the city occupied
status is pretty poor. This should be removed and the server should
just inform the client of this change.
jason
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.343
diff -u -r1.343 packhand.c
--- client/packhand.c 2004/01/11 17:45:03 1.343
+++ client/packhand.c 2004/01/16 02:24:05
@@ -1043,9 +1043,14 @@
* logic is a little shaky since it's not clear whether we can
* see the internals of the city or not; however, the server should
* send us a city update to clear things up. */
- pcity->client.occupied =
- (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+ bool new_occupied =
+ (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+ if (pcity->client.occupied != new_occupied) {
+ pcity->client.occupied = new_occupied;
+ repaint_city = TRUE;
+ }
+
if(pcity->id==punit->homecity)
repaint_city = TRUE;
else
@@ -1054,7 +1059,10 @@
if((pcity=map_get_city(punit->x, punit->y))) {
/* Unit moved into a city - obviously it's occupied. */
- pcity->client.occupied = TRUE;
+ if (!pcity->client.occupied) {
+ pcity->client.occupied = TRUE;
+ repaint_city = TRUE;
+ }
if(pcity->id == punit->homecity)
repaint_city = TRUE;
|
|