[Freeciv-Dev] (PR#9798) PATCH assign_continent_number_count size of cont
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9798) PATCH assign_continent_number_count size of continents |
From: |
"Marcelo Burda" <mburda@xxxxxxxxx> |
Date: |
Tue, 24 Aug 2004 12:55:45 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9798 >
depend de 9796
This is used by 9627 patch to clean easy small isle or oceans
Marcelo
diff -ruN -Xfreeciv/diff_ignore freeciv_2/server/maphand.c
freeciv_/server/maphand.c
--- freeciv_2/server/maphand.c 2004-08-24 19:48:51.372326800 +0200
+++ freeciv_/server/maphand.c 2004-08-24 19:51:20.810608728 +0200
@@ -41,6 +41,10 @@
#include "maphand.h"
/**************************************************************************
+ * used to store the size of continent
+ **************************************************************************/
+int mass_size[2 * MAP_NCONT];
+/**************************************************************************
Number this tile and recursive adjacent tiles with specified
continent number, by flood-fill algorithm.
is_land tells us whether we are assigning continent numbers or ocean
@@ -57,6 +61,7 @@
}
map_set_continent(x, y, nr);
+ MASS_SIZE(nr)++;
adjc_iterate(x, y, x1, y1) {
assign_continent_flood(x1, y1, is_land, nr);
@@ -71,7 +76,12 @@
**************************************************************************/
void assign_continent_numbers(void)
{
+ int i;
+
/* Initialize */
+ for(i = 0; i < 2 * MAP_NCONT; i++) {
+ MASS_SIZE(i) = 0;
+ }
map.num_continents = 0;
map.num_oceans = 0;
@@ -93,7 +103,7 @@
map.num_oceans++;
assert ( map.num_oceans < MAP_NCONT);
assign_continent_flood(x, y, FALSE, -map.num_oceans);
- }
+ }
} whole_map_iterate_end;
freelog(LOG_VERBOSE, "Map has %d continents and %d oceans",
diff -ruN -Xfreeciv/diff_ignore freeciv_2/server/maphand.h
freeciv_/server/maphand.h
--- freeciv_2/server/maphand.h 2004-08-24 19:48:51.372326800 +0200
+++ freeciv_/server/maphand.h 2004-08-24 19:53:11.175830664 +0200
@@ -52,6 +52,9 @@
/* this is used for generator 2-4 and in assign_continent number */
#define MAP_NCONT 300
+/* signus safe way for nr continent <0 or >0 */
+extern int mass_size[2 * MAP_NCONT];
+#define MASS_SIZE(nr) (mass_size[FC_WRAP((nr), 2 * MAP_NCONT)])
void assign_continent_numbers(void);
- [Freeciv-Dev] (PR#9798) PATCH assign_continent_number_count size of continents,
Marcelo Burda <=
|
|