Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7332) Move check into update_city_tile_status_map.
Home

[Freeciv-Dev] (PR#7332) Move check into update_city_tile_status_map.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7332) Move check into update_city_tile_status_map.
From: "Remi Bonnet" <remi.bonnet@xxxxxxxxxxx>
Date: Tue, 27 Jan 2004 11:31:49 -0800
Reply-to: rt@xxxxxxxxxxx

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

Move checks of is_valid_city_coords into update_city_tile_status_map.

Reasons:
* Before, this function was called twice in one case: one to check if
update_city_tile_status_map is called, one in a sub-routine of update_. 
* Why aborting when nothing is corrupted?
* When radius will be dynamic (patch coming soon), it'll remove a lot of
unnecessary ugly checks.

Remi Bonnet
diff -u -r1.247 citytools.c
--- server/citytools.c  2004/01/17 04:29:14     1.247
+++ server/citytools.c  2004/01/27 19:09:44
@@ -2036,9 +2036,11 @@
   int city_x, city_y;
   bool is_valid;
 
-  is_valid = map_to_city_map(&city_x, &city_y, pcity, map_x, map_y);
-  assert(is_valid);
-  return update_city_tile_status(pcity, city_x, city_y);
+  if (map_to_city_map(&city_x, &city_y, pcity, map_x, map_y)) {
+    return update_city_tile_status(pcity, city_x, city_y);
+  } else {
+    return false;
+  }
 }
 
 /**************************************************************************
diff -u -r1.131 maphand.c
--- server/maphand.c    2003/11/28 17:37:22     1.131
+++ server/maphand.c    2004/01/27 19:09:50
@@ -1579,11 +1579,7 @@
 static void tile_update_owner(int x, int y)
 {
   cities_iterate(pcity) {
-    int cityx, cityy;
-
-    if (map_to_city_map(&cityx, &cityy, pcity, x, y)) {
-      update_city_tile_status_map(pcity, x, y);
-    }
+    update_city_tile_status_map(pcity, x, y);
   } cities_iterate_end;
 }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7332) Move check into update_city_tile_status_map., Remi Bonnet <=