[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: |
Fri, 27 Aug 2004 13:23:43 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9798 >
> [mburda - Mar. Aoû. 24 19:55:44 2004]:
>
> depend de 9796
> This is used by 9627 patch to clean easy small isle or oceans
>
> Marcelo
>
Update
diff -ruN -Xfreeciv/diff_ignore freeciv/server/maphand.c
freeciv_/server/maphand.c
--- freeciv/server/maphand.c 2004-08-27 12:14:41.000000000 +0200
+++ freeciv_/server/maphand.c 2004-08-27 20:23:48.747602024 +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 nearby tiles (recursively) with the specified
continent number, using a flood-fill algorithm.
@@ -58,6 +62,7 @@
}
map_set_continent(x, y, nr);
+ MASS_SIZE(nr)++;
adjc_iterate(x, y, x1, y1) {
assign_continent_flood(x1, y1, is_land, nr);
@@ -73,7 +78,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;
diff -ruN -Xfreeciv/diff_ignore freeciv/server/maphand.h
freeciv_/server/maphand.h
--- freeciv/server/maphand.h 2004-08-27 12:14:41.000000000 +0200
+++ freeciv_/server/maphand.h 2004-08-27 20:21:53.920058464 +0200
@@ -52,6 +52,9 @@
/* The maximum number of continents and oceans. */
#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);
void global_warming(int effect);
|
|