Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#4602) fix bug in giving player->player dumb_city knowl
Home

[Freeciv-Dev] (PR#4602) fix bug in giving player->player dumb_city knowl

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4602) fix bug in giving player->player dumb_city knowledge
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Jul 2003 23:20:01 -0700
Reply-to: rt@xxxxxxxxxxxxxx

The bug is that not all fields are copied from one struct to another. 
This is trivial and elegant to fix; I also changed the logic to make it 
simpler.

jason

Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.123
diff -u -r1.123 maphand.c
--- server/maphand.c    2003/04/30 21:14:35     1.123
+++ server/maphand.c    2003/07/18 06:18:07
@@ -959,7 +959,6 @@
                                                        struct player *pdest,
                                                        int x, int y)
 {
-  struct dumb_city *from_city, *dest_city;
   struct player_tile *from_tile, *dest_tile;
   if (!map_get_known_and_seen(x, y, pdest)) {
     /* I can just hear people scream as they try to comprehend this if :).
@@ -996,15 +995,11 @@
            reality_check_city(pdest, x, y);
       }
       /* Set and send new city info */
-      if (from_tile->city && !dest_tile->city) {
-       dest_tile->city = fc_malloc(sizeof(struct dumb_city));
-      }
-      if ((from_city = from_tile->city) && (dest_city = dest_tile->city)) {
-       dest_city->id = from_city->id;
-       sz_strlcpy(dest_city->name, from_city->name);
-       dest_city->size = from_city->size;
-       dest_city->has_walls = from_city->has_walls;
-       dest_city->owner = from_city->owner;
+      if (from_tile->city) {
+       if (!dest_tile->city) {
+         dest_tile->city = fc_malloc(sizeof(struct dumb_city));
+       }
+       *dest_tile->city = *from_tile->city;
        send_city_info_at_tile(pdest, &pdest->connections, NULL, x, y);
       }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4602) fix bug in giving player->player dumb_city knowledge, Jason Short <=