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

On 1/21/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  Use base name from ruleset instead of hardcoded strings.

 Updated against current svn.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c	2007-01-26 16:37:21.000000000 +0200
+++ freeciv/common/base.c	2007-01-27 19:11:46.000000000 +0200
@@ -36,6 +36,14 @@
 }
 
 /**************************************************************************
+  Return the translated name of the base type.
+**************************************************************************/
+const char *base_name(const struct base_type *pbase)
+{
+  return pbase->name;
+}
+
+/**************************************************************************
   Convert base flag names to enum; case insensitive;
   returns BF_LAST if can't match.
 **************************************************************************/
diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h
--- freeciv/common/base.h	2007-01-26 16:37:21.000000000 +0200
+++ freeciv/common/base.h	2007-01-27 19:13:59.000000000 +0200
@@ -21,7 +21,7 @@
 
 enum base_flag_id {
   BF_NOT_AGGRESSIVE,     /* Unit inside are not considered aggressive
-                            * if base is close to city */
+                          * if base is close to city */
   BF_DEFENSE_BONUS,      /* Base provides defense bonus for units inside */
   BF_NO_STACK_DEATH,     /* Units inside will not die all at once */
   BF_WATCHTOWER,         /* Base can act as watchtower */
@@ -44,6 +44,8 @@
 };
 
 bool base_flag(const struct base_type *pbase, enum base_flag_id flag);
+const char *base_name(const struct base_type *pbase);
+
 enum base_flag_id base_flag_from_str(const char *s);
 struct base_type *base_type_get_by_id(Base_type_id id);
 
diff -Nurd -X.diff_ignore freeciv/common/terrain.c freeciv/common/terrain.c
--- freeciv/common/terrain.c	2007-01-26 12:17:47.000000000 +0200
+++ freeciv/common/terrain.c	2007-01-27 19:13:54.000000000 +0200
@@ -490,11 +490,13 @@
   }
 
   if (contains_special(spe, S_FORTRESS)) {
-    cat_snprintf(s, sizeof(s), "%s/", _("Fortress"));
+    cat_snprintf(s, sizeof(s), "%s/",
+                 base_name(base_type_get_by_id(BASE_FORTRESS)));
   }
 
   if (contains_special(spe, S_AIRBASE)) {
-    cat_snprintf(s, sizeof(s), "%s/", _("Airbase"));
+    cat_snprintf(s, sizeof(s), "%s/",
+                 base_name(base_type_get_by_id(BASE_AIRBASE)));
   }
 
   p = s + strlen(s) - 1;
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-01-26 16:37:20.000000000 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-01-27 19:11:46.000000000 +0200
@@ -596,7 +596,7 @@
 ; Below has to be definition for exactly two base types:
 ; fortress and airbase.
 ;
-; name                    = Name of the base type. Not yet used
+; name                    = Name of the base type.
 ; flags
 ;   - "NoAggressive"      = Units inside are not considered aggressive
 ;   - "DefenseBonus"      = Units inside gain defense bonus
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-01-26 16:37:20.000000000 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-01-27 19:11:46.000000000 +0200
@@ -688,7 +688,7 @@
 ; Below has to be definition for exactly two base types:
 ; fortress and airbase.
 ;
-; name                    = Name of the base type. Not yet used
+; name                    = Name of the base type.
 ; flags
 ;   - "NoAggressive"      = Units inside are not considered aggressive
 ;   - "DefenseBonus"      = Units inside gain defense bonus
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-01-26 16:37:20.000000000 +0200
+++ freeciv/data/default/terrain.ruleset	2007-01-27 19:11:46.000000000 +0200
@@ -757,7 +757,7 @@
 ; Below has to be definition for exactly two base types:
 ; fortress and airbase.
 ;
-; name                    = Name of the base type. Not yet used
+; name                    = Name of the base type.
 ; flags
 ;   - "NoAggressive"      = Units inside are not considered aggressive
 ;   - "DefenseBonus"      = Units inside gain defense bonus
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to