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

 Get base building activity gfx tag from ruleset.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-03-07 16:30:27.000000000 +0200
+++ freeciv/client/packhand.c	2007-03-07 19:32:19.000000000 +0200
@@ -2475,6 +2475,7 @@
   pbase->name = Q_(pbase->name_orig);
   sz_strlcpy(pbase->graphic_str, p->graphic_str);
   sz_strlcpy(pbase->graphic_alt, p->graphic_alt);
+  sz_strlcpy(pbase->activity_gfx, p->activity_gfx);
 
   for (i = 0; i < p->reqs_count; i++) {
     requirement_vector_append(&pbase->reqs, &p->reqs[i]);
diff -Nurd -X.diff_ignore freeciv/client/tilespec.c freeciv/client/tilespec.c
--- freeciv/client/tilespec.c	2007-03-07 16:30:27.000000000 +0200
+++ freeciv/client/tilespec.c	2007-03-07 19:39:03.000000000 +0200
@@ -189,8 +189,6 @@
       *fallout,
       *fortified,
       *fortifying,
-      *fortress,
-      *airbase,
       *go_to,			/* goto is a C keyword :-) */
       *irrigate,
       *mine,
@@ -253,7 +251,8 @@
     struct sprite
       *background,
       *middleground,
-      *foreground;
+      *foreground,
+      *activity;
   } bases[BASE_LAST];
   struct {
     struct sprite
@@ -2165,8 +2164,6 @@
   SET_SPRITE(unit.fallout,	"unit.fallout");
   SET_SPRITE(unit.fortified,	"unit.fortified");     
   SET_SPRITE(unit.fortifying,	"unit.fortifying");     
-  SET_SPRITE(unit.fortress,     "unit.fortress");
-  SET_SPRITE(unit.airbase,      "unit.airbase");
   SET_SPRITE(unit.go_to,	"unit.goto");     
   SET_SPRITE(unit.irrigate,     "unit.irrigate");
   SET_SPRITE(unit.mine,	        "unit.mine");
@@ -2647,6 +2644,13 @@
       exit(EXIT_FAILURE);
     }
   }
+
+  t->sprites.bases[id].activity = load_sprite(t, pbase->activity_gfx);
+  if (t->sprites.bases[id].activity == NULL) {
+    freelog(LOG_ERROR, _("Missing %s building activity tag %s"),
+            base_name(pbase), pbase->activity_gfx);
+    exit(EXIT_FAILURE);
+  }
 }
 
 
@@ -3044,10 +3048,10 @@
       s = t->sprites.unit.fortifying;
       break;
     case ACTIVITY_FORTRESS:
-      s = t->sprites.unit.fortress;
+      s = t->sprites.bases[BASE_FORTRESS].activity;
       break;
     case ACTIVITY_AIRBASE:
-      s = t->sprites.unit.airbase;
+      s = t->sprites.bases[BASE_AIRBASE].activity;
       break;
     case ACTIVITY_SENTRY:
       s = t->sprites.unit.sentry;
diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h
--- freeciv/common/base.h	2007-03-07 16:30:27.000000000 +0200
+++ freeciv/common/base.h	2007-03-07 19:30:01.000000000 +0200
@@ -40,6 +40,7 @@
   char name_orig[MAX_LEN_NAME];
   char graphic_str[MAX_LEN_NAME];
   char graphic_alt[MAX_LEN_NAME];
+  char activity_gfx[MAX_LEN_NAME];
   struct requirement_vector reqs;
   bv_unit_classes native_to;
 
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def	2007-03-07 16:30:27.000000000 +0200
+++ freeciv/common/packets.def	2007-03-07 19:29:43.000000000 +0200
@@ -1272,6 +1272,7 @@
   STRING name[MAX_LEN_NAME];
   STRING graphic_str[MAX_LEN_NAME];
   STRING graphic_alt[MAX_LEN_NAME];
+  STRING activity_gfx[MAX_LEN_NAME];
   UINT8 reqs_count;
   REQUIREMENT reqs[MAX_NUM_REQS:reqs_count];
   BV_UNIT_CLASSES native_to;
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-03-07 16:30:26.000000000 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-03-07 19:42:27.000000000 +0200
@@ -597,6 +597,10 @@
 ; fortress and airbase.
 ;
 ; name                    = Name of the base type.
+; graphic                 = tag specifing preferred graphic
+; graphic_alt	          = tag for alternate garphic if preferred graphic is not 
+;                           present. Can use eg "-" for no alternate graphic.
+; activity_gfx            = tag specifing graphic for unit building base
 ; reqs 	                  = requirements to build the base (see effects.ruleset
 ;                           and README.effects for help on requirements)
 ; flags
@@ -608,25 +612,27 @@
 ;   - "ParadropFrom"      = Paradrop can be initiated from base
 
 [fortress]
-name        = _("Fortress")
-graphic     = "base.fortress"
-graphic_alt = "-"
-reqs        =
+name         = _("Fortress")
+graphic      = "base.fortress"
+graphic_alt  = "-"
+activity_gfx = "unit.fortress
+reqs         =
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
     }
-native_to   = "Land"
-flags       = "NoAggressive", "DefenseBonus", "ClaimTerritory",
-              "NoStackDeath", "DiplomatDefense"
+native_to    = "Land"
+flags        = "NoAggressive", "DefenseBonus", "ClaimTerritory",
+               "NoStackDeath", "DiplomatDefense"
 
 [airbase]
-name        = _("Airbase")
-graphic     = "base.airbase"
-graphic_alt = "-"
-reqs        =
+name         = _("Airbase")
+graphic      = "base.airbase"
+graphic_alt  = "-"
+activity_gfx = "unit.airbase"
+reqs         =
     { "type", "name", "range"
       "Tech", "Never", "Player"
     }
-native_to   = "Air", "Missile"
-flags       = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
+native_to    = "Air", "Missile"
+flags        = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-03-07 16:30:26.000000000 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-03-07 19:41:38.000000000 +0200
@@ -689,6 +689,10 @@
 ; fortress and airbase.
 ;
 ; name                    = Name of the base type.
+; graphic                 = tag specifing preferred graphic
+; graphic_alt	          = tag for alternate garphic if preferred graphic is not 
+;                           present. Can use eg "-" for no alternate graphic.
+; activity_gfx            = tag specifing graphic for unit building base
 ; reqs 	                  = requirements to build the base (see effects.ruleset
 ;                           and README.effects for help on requirements)
 ; flags
@@ -700,26 +704,28 @@
 ;   - "ParadropFrom"      = Paradrop can be initiated from base
 
 [fortress]
-name        = _("Fortress")
-graphic     = "base.fortress"
-graphic_alt = "-"
-reqs        =
+name         = _("Fortress")
+graphic      = "base.fortress"
+graphic_alt  = "-"
+activity_gfx = "unit.fortress"
+reqs         =
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
     }
-native_to   = "Land"
-flags       = "NoAggressive", "DefenseBonus", "ClaimTerritory",
-              "NoStackDeath", "DiplomatDefense"
+native_to    = "Land"
+flags        = "NoAggressive", "DefenseBonus", "ClaimTerritory",
+               "NoStackDeath", "DiplomatDefense"
 
 [airbase]
-name        = _("Airbase")
-graphic     = "base.airbase"
-graphic_alt = "-"
-reqs        =
+name         = _("Airbase")
+graphic      = "base.airbase"
+graphic_alt  = "-"
+activity_gfx = "unit.airbase"
+reqs         =
     { "type", "name", "range"
       "Tech", "Radio", "Player"
       "TerrainClass", "Land", "Local"
     }
-native_to   = "Air", "Helicopter", "Missile"
-flags       = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
+native_to    = "Air", "Helicopter", "Missile"
+flags        = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-03-07 16:30:26.000000000 +0200
+++ freeciv/data/default/terrain.ruleset	2007-03-07 19:41:27.000000000 +0200
@@ -759,6 +759,7 @@
 ; graphic                 = tag specifing preferred graphic
 ; graphic_alt	          = tag for alternate garphic if preferred graphic is not 
 ;                           present. Can use eg "-" for no alternate graphic.
+; activity_gfx            = tag specifing graphic for unit building base
 ; reqs 	                  = requirements to build the base (see effects.ruleset
 ;                           and README.effects for help on requirements)
 ; flags
@@ -770,26 +771,28 @@
 ;   - "ParadropFrom"      = Paradrop can be initiated from base
 
 [fortress]
-name        = _("Fortress")
-graphic     = "base.fortress"
-graphic_alt = "-"
-reqs        =
+name         = _("Fortress")
+graphic      = "base.fortress"
+graphic_alt  = "-"
+activity_gfx = "unit.fortress"
+reqs         =
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
     }
-native_to   = "Land"
-flags       = "NoAggressive", "DefenseBonus", "ClaimTerritory",
-              "NoStackDeath", "DiplomatDefense"
+native_to    = "Land"
+flags        = "NoAggressive", "DefenseBonus", "ClaimTerritory",
+               "NoStackDeath", "DiplomatDefense"
 
 [airbase]
-name        = _("Airbase")
-graphic     = "base.airbase"
-graphic_alt = "-"
-reqs        =
+name         = _("Airbase")
+graphic      = "base.airbase"
+graphic_alt  = "-"
+activity_gfx = "unit.airbase"
+reqs         =
     { "type", "name", "range"
       "Tech", "Radio", "Player"
       "TerrainClass", "Land", "Local"
     }
-native_to   = "Air", "Helicopter", "Missile"
-flags       = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
+native_to    = "Air", "Helicopter", "Missile"
+flags        = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c	2007-03-07 16:30:26.000000000 +0200
+++ freeciv/server/ruleset.c	2007-03-07 19:31:51.000000000 +0200
@@ -1807,6 +1807,9 @@
     sz_strlcpy(pbase->graphic_alt,
                secfile_lookup_str_default(file, "-",
                                           "%s.graphic_alt", section));
+    sz_strlcpy(pbase->activity_gfx,
+               secfile_lookup_str_default(file, "-",
+                                          "%s.activity_gfx", section));
 
     reqs = lookup_req_list(file, section, "reqs");
     requirement_vector_copy(&pbase->reqs, reqs);
@@ -3086,6 +3089,7 @@
     sz_strlcpy(packet.name, b->name);
     sz_strlcpy(packet.graphic_str, b->graphic_str);
     sz_strlcpy(packet.graphic_alt, b->graphic_alt);
+    sz_strlcpy(packet.activity_gfx, b->activity_gfx);
 
     j = 0;
     requirement_vector_iterate(&b->reqs, preq) {
diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in
--- freeciv/version.in	2007-03-07 16:30:27.000000000 +0200
+++ freeciv/version.in	2007-03-07 19:30:14.000000000 +0200
@@ -24,4 +24,4 @@
 #   - Avoid adding a new manditory capbility to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2007.Mar.06-2")
+FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2007.Mar.07")
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to