[Freeciv-Dev] (PR#9890) negative values for specialty terrains
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9890) negative values for specialty terrains |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Tue, 31 Aug 2004 20:01:47 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9890 >
The specialty terrains T_NONE, T_ANY, and T_UNKNOWN currently come at
the end of the terrains enumeration. I want to make these values
negative. That way the more terrain types may be added at the end
without running into them.
This is a small but influential patch. I've tested it some but it could
contain bugs. The most likely cause would be < or > comparisons
involving terrains. I don't think there are any of these left, but it's
hard to say for sure.
jason
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.180
diff -u -r1.180 capstr.c
--- common/capstr.c 27 Aug 2004 17:36:53 -0000 1.180
+++ common/capstr.c 1 Sep 2004 02:36:13 -0000
@@ -78,7 +78,8 @@
"+change_production +tilespec1 +no_earth +trans " \
"+want_hack invasions bombard +killstack2 spec +spec2 " \
"+city_map startunits +turn_last_built +happyborders " \
- "+connid +love2 +ocean_num +govclean +orders3 +rev_fin"
+ "+connid +love2 +ocean_num +govclean +orders3 +rev_fin " \
+ "+terr16"
/* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
*
@@ -147,6 +148,8 @@
*
* "rev_fin" means the revolution_finishes value replaces the revolution
* value.
+ *
+ * "terr16" is 16-bit terrain values
*/
void init_our_capability(void)
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.43
diff -u -r1.43 packets.def
--- common/packets.def 27 Aug 2004 17:36:53 -0000 1.43
+++ common/packets.def 1 Sep 2004 02:36:13 -0000
@@ -163,7 +163,7 @@
type CLAUSE = uint8(enum clause_type)
type ACTIVITY = uint8(enum unit_activity)
type EVENT = sint16(enum event_type)
-type TERRAIN = uint8(Terrain_type_id)
+type TERRAIN = sint16(Terrain_type_id)
type SPECIAL = uint16(enum tile_special_type)
type SPECIALIST = uint8(enum specialist_type)
type DIPLOMAT_ACTION = uint8(enum diplomat_actions)
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.21
diff -u -r1.21 terrain.h
--- common/terrain.h 31 Aug 2004 04:40:50 -0000 1.21
+++ common/terrain.h 1 Sep 2004 02:36:13 -0000
@@ -64,11 +64,11 @@
/* 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_UNUSED, T_SWAMP, T_TUNDRA,
- T_UNKNOWN, /* A special flag meaning unknown terrain. */
- T_NONE, /* A special flag meaning no terrain. */
- T_ANY /* A special flag that matches "any" terrain type. */
+ T_MOUNTAINS, T_OCEAN, T_PLAINS, T_UNUSED, T_SWAMP, T_TUNDRA
};
/* The first terrain value and number of base terrains. This is used in
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9890) negative values for specialty terrains,
Jason Short <=
|
|