Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9087) Old homecity name after renaming at unit-info pl
Home

[Freeciv-Dev] (PR#9087) Old homecity name after renaming at unit-info pl

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: evyscr@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#9087) Old homecity name after renaming at unit-info place
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Jul 2004 12:35:37 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [evyscr - Thu Jun 24 08:18:49 2004]:
> 
> CVS HEAD 2004.06.23, GTK2
> 
> When i renamed city, unit info (under minimap) continue to show old
> name.
> After changing focus to another unit and getting it back, unit info
> shows new
> cityname.

Here's a patch.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.383
diff -u -r1.383 packhand.c
--- client/packhand.c   7 Jul 2004 16:02:50 -0000       1.383
+++ client/packhand.c   8 Jul 2004 19:29:18 -0000
@@ -379,7 +379,8 @@
   int i;
   bool city_is_new, city_has_changed_owner = FALSE, need_effect_update = FALSE;
   struct city *pcity;
-  bool popup, update_descriptions = FALSE;
+  bool popup, update_descriptions = FALSE, name_changed = FALSE;
+  struct unit *pfocus_unit = get_unit_in_focus();
 
   pcity=find_city_by_id(packet->id);
 
@@ -400,8 +401,10 @@
   else {
     city_is_new = FALSE;
 
+    name_changed = (strcmp(pcity->name, packet->name) != 0);
+
     /* Check if city desciptions should be updated */
-    if (draw_city_names && strcmp(pcity->name, packet->name) != 0) {
+    if (draw_city_names && name_changed) {
       update_descriptions = TRUE;
     } else if (draw_city_productions &&
               (pcity->is_building_unit != packet->is_building_unit ||
@@ -536,6 +539,11 @@
     update_city_description(pcity);
   }
 
+  /* Update focus unit info label if necessary. */
+  if (name_changed && pfocus_unit && pfocus_unit->homecity == pcity->id) {
+    update_unit_info_label(pfocus_unit);
+  }
+
   /* Update the panel text (including civ population). */
   update_info_label();
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9087) Old homecity name after renaming at unit-info place, Jason Short <=