Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12482) tile_type is used before it's declared
Home

[Freeciv-Dev] (PR#12482) tile_type is used before it's declared

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12482) tile_type is used before it's declared
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Mar 2005 22:04:16 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12482 >

Here's an interesting error.  The tile_type struct is declared in map.h. 
  But it is used (with dereferencing) in terrain.h which is included 
from map.h (and never the other way around).  I'm not sure how this ever 
works but I don't think it's fully legal.

This patch moves the tile_type struct declaration into terrain.h, which 
is better anyway (in fact more terrain data should be moved into terrain.h).

-jason

Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.234
diff -u -r1.234 map.h
--- common/map.h        7 Feb 2005 22:26:21 -0000       1.234
+++ common/map.h        11 Mar 2005 06:02:30 -0000
@@ -69,61 +69,6 @@
 *****************************************************************/
 #define terrain_misc packet_ruleset_terrain_control
 
-/****************************************************************
-tile_type for each terrain type
-expand with government bonuses??
-*****************************************************************/
-struct tile_type {
-  const char *terrain_name; /* Translated string - doesn't need freeing. */
-  char terrain_name_orig[MAX_LEN_NAME];        /* untranslated copy */
-  char graphic_str[MAX_LEN_NAME];
-  char graphic_alt[MAX_LEN_NAME];
-
-  /* Server-only. */
-  char identifier; /* Single-character identifier used in savegames. */
-#define UNKNOWN_TERRAIN_IDENTIFIER 'u'
-
-  int movement_cost;
-  int defense_bonus;
-
-  int output[O_MAX];
-
-#define MAX_NUM_SPECIALS 2
-  struct {
-    const char *name; /* Translated string - doesn't need freeing. */
-    char name_orig[MAX_LEN_NAME];
-    int output[O_MAX];
-    char graphic_str[MAX_LEN_NAME];
-    char graphic_alt[MAX_LEN_NAME];
-  } special[MAX_NUM_SPECIALS];
-
-  int road_trade_incr;
-  int road_time;
-
-  Terrain_type_id irrigation_result;
-  int irrigation_food_incr;
-  int irrigation_time;
-
-  Terrain_type_id mining_result;
-  int mining_shield_incr;
-  int mining_time;
-
-  Terrain_type_id transform_result;
-  int transform_time;
-  int rail_time;
-  int airbase_time;
-  int fortress_time;
-  int clean_pollution_time;
-  int clean_fallout_time;
-
-  Terrain_type_id warmer_wetter_result, warmer_drier_result;
-  Terrain_type_id cooler_wetter_result, cooler_drier_result;
-
-  bv_terrain_flags flags;
-
-  char *helptext;
-};
-
 /* The direction8 gives the 8 possible directions.  These may be used in
  * a number of ways, for instance as an index into the DIR_DX/DIR_DY
  * arrays.  Not all directions may be valid; see is_valid_dir and
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.29
diff -u -r1.29 terrain.h
--- common/terrain.h    29 Sep 2004 02:24:23 -0000      1.29
+++ common/terrain.h    11 Mar 2005 06:02:30 -0000
@@ -96,6 +96,61 @@
 
 BV_DEFINE(bv_terrain_flags, TER_MAX);
 
+/****************************************************************
+tile_type for each terrain type
+expand with government bonuses??
+*****************************************************************/
+struct tile_type {
+  const char *terrain_name; /* Translated string - doesn't need freeing. */
+  char terrain_name_orig[MAX_LEN_NAME];        /* untranslated copy */
+  char graphic_str[MAX_LEN_NAME];
+  char graphic_alt[MAX_LEN_NAME];
+
+  /* Server-only. */
+  char identifier; /* Single-character identifier used in savegames. */
+#define UNKNOWN_TERRAIN_IDENTIFIER 'u'
+
+  int movement_cost;
+  int defense_bonus;
+
+  int output[O_MAX];
+
+#define MAX_NUM_SPECIALS 2
+  struct {
+    const char *name; /* Translated string - doesn't need freeing. */
+    char name_orig[MAX_LEN_NAME];
+    int output[O_MAX];
+    char graphic_str[MAX_LEN_NAME];
+    char graphic_alt[MAX_LEN_NAME];
+  } special[MAX_NUM_SPECIALS];
+
+  int road_trade_incr;
+  int road_time;
+
+  Terrain_type_id irrigation_result;
+  int irrigation_food_incr;
+  int irrigation_time;
+
+  Terrain_type_id mining_result;
+  int mining_shield_incr;
+  int mining_time;
+
+  Terrain_type_id transform_result;
+  int transform_time;
+  int rail_time;
+  int airbase_time;
+  int fortress_time;
+  int clean_pollution_time;
+  int clean_fallout_time;
+
+  Terrain_type_id warmer_wetter_result, warmer_drier_result;
+  Terrain_type_id cooler_wetter_result, cooler_drier_result;
+
+  bv_terrain_flags flags;
+
+  char *helptext;
+};
+
 extern struct tile_type tile_types[MAX_NUM_TERRAINS];
 
 /* General accessor functions. */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12482) tile_type is used before it's declared, Jason Short <=