Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9962) move terrain enum into mapgen
Home

[Freeciv-Dev] (PR#9962) move terrain enum into mapgen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9962) move terrain enum into mapgen
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 5 Sep 2004 21:00:14 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch moves the terrain enumeration into mapgen.

The only advantage of this is that it prevents users from accidentally 
using it...since there is no reason why anyone should want these enum 
values.

Of course mapgen needs some work so that it too can avoid using these 
values.

jason

Index: common/fc_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/fc_types.h,v
retrieving revision 1.6
diff -u -r1.6 fc_types.h
--- common/fc_types.h   6 Sep 2004 02:05:31 -0000       1.6
+++ common/fc_types.h   6 Sep 2004 03:56:33 -0000
@@ -19,7 +19,7 @@
  * definition in another file */
 
 typedef signed short Continent_id;
-typedef enum tile_terrain_type Terrain_type_id;
+typedef int Terrain_type_id;
 typedef enum specialist_type Specialist_type_id;
 
 /* TODO: Remove this enum and make this an integer when gen-eff is done. */
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.26
diff -u -r1.26 terrain.h
--- common/terrain.h    6 Sep 2004 02:58:12 -0000       1.26
+++ common/terrain.h    6 Sep 2004 03:56:33 -0000
@@ -62,14 +62,9 @@
    | S_FORTRESS             \
    | S_AIRBASE)
 
-/* Changing this breaks savegame and network compatability. */
-enum tile_terrain_type {
-  T_NONE = -3, /* A special flag meaning no terrain. */
-  T_ANY = -2, /* A special flag that matches "any" terrain type. */
-  T_UNKNOWN = -1, /* A special flag meaning unknown terrain. */
-  T_ARCTIC, T_DESERT, T_FOREST, T_GRASSLAND, T_HILLS, T_JUNGLE, 
-  T_MOUNTAINS, T_OCEAN, T_PLAINS, T_SWAMP, T_TUNDRA
-};
+#define T_NONE (-3) /* A special flag meaning no terrain type. */
+#define T_ANY (-2) /* A special flag that matches "any" terrain type. */
+#define T_UNKNOWN (-1) /* An unknown terrain. */
 
 /* The first terrain value and number of base terrains.  This is used in
  * loops.  T_COUNT may eventually be turned into a variable. */
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.155
diff -u -r1.155 mapgen.c
--- server/mapgen.c     4 Sep 2004 11:47:56 -0000       1.155
+++ server/mapgen.c     6 Sep 2004 03:56:34 -0000
@@ -33,6 +33,12 @@
 
 #include "mapgen.h"
 
+/* Old-style terrain enumeration: deprecated. */
+enum {
+  T_ARCTIC, T_DESERT, T_FOREST, T_GRASSLAND, T_HILLS, T_JUNGLE,
+  T_MOUNTAINS, T_OCEAN, T_PLAINS, T_UNUSED, T_SWAMP, T_TUNDRA,
+};
+
 /* Provide a block to convert from native to map coordinates.  For instance
  *   do_in_map_pos(mx, my, xn, yn) {
  *     map_set_terrain(mx, my, T_OCEAN);

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