Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Re: (PR#11350) handle_city_short_info Does not use create_
Home

[Freeciv-Dev] Re: (PR#11350) handle_city_short_info Does not use create_

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#11350) handle_city_short_info Does not use create_city_virtual.
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Tue, 7 Dec 2004 15:44:53 -0800
Reply-to: rt@xxxxxxxxxxx

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

Jason Short wrote:
...
> Absolutely.  Will you make a patch?
...

Here it is. This is applicable to the CVS development version of 2004-12-07.

diff -ru -Xvendor.freeciv.current/diff_ignore 
vendor.freeciv.current/client/packhand.c freeciv.PR11350/client/packhand.c
--- vendor.freeciv.current/client/packhand.c    2004-12-07 21:30:52.000000000 
+0000
+++ freeciv.PR11350/client/packhand.c   2004-12-07 23:46:51.000000000 +0000
@@ -678,7 +678,9 @@
 
   if(!pcity) {
     city_is_new = TRUE;
-    pcity=fc_malloc(sizeof(struct city));
+    pcity = create_city_virtual(get_player(packet->owner),
+                               map_pos_to_tile(packet->x, packet->y),
+                               packet->name);
     pcity->id=packet->id;
     idex_register_city(pcity);
   }
@@ -689,13 +691,12 @@
     if (draw_city_names && strcmp(pcity->name, packet->name) != 0) {
       update_descriptions = TRUE;
     }
+
+    pcity->owner=packet->owner;
+    sz_strlcpy(pcity->name, packet->name);
     
     assert(pcity->id == packet->id);
   }
-
-  pcity->owner=packet->owner;
-  pcity->tile = map_pos_to_tile(packet->x, packet->y);
-  sz_strlcpy(pcity->name, packet->name);
   
   pcity->size=packet->size;
   pcity->tile_trade = packet->tile_trade;
@@ -718,21 +719,11 @@
     pcity->ppl_content[4] = pcity->size;
   }
 
-  if (city_is_new) {
-    /* Initialise list of improvements with city/building wide equiv_range. */
-    improvement_status_init(pcity->improvements,
-                           ARRAY_SIZE(pcity->improvements));
-  }
-
   update_improvement_from_packet(pcity, game.palace_building,
                                 packet->capital, &need_effect_update);
   update_improvement_from_packet(pcity, game.land_defend_building,
                                 packet->walls, &need_effect_update);
 
-  if (city_is_new) {
-    init_worklist(&pcity->worklist);
-  }
-
   /* This sets dumb values for everything else. This is not really required,
      but just want to be at the safe side. */
   {

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