Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in
Home

[Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 13 Jul 2006 15:33:05 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  Updated version

  - "Carrier" and "MissileCarrier" flags removed completely (requires 
#18566, #18549, #18574)
  - Carrier can transport helicopters



  - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c   2006-07-14 00:21:34.250000000 +0300
+++ freeciv/client/packhand.c   2006-07-14 00:45:35.656250000 +0300
@@ -2190,6 +2190,7 @@
   u->paratroopers_mr_req = p->paratroopers_mr_req;
   u->paratroopers_mr_sub = p->paratroopers_mr_sub;
   u->bombard_rate       = p->bombard_rate;
+  u->cargo              = p->cargo;
 
   for (i = 0; i < MAX_VET_LEVELS; i++) {
     sz_strlcpy(u->veteran[i].name, p->veteran_name[i]);
diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2006-07-14 00:45:02.250000000 +0300
+++ freeciv/common/movement.c   2006-07-14 00:45:35.734375000 +0300
@@ -447,36 +447,7 @@
     return FALSE;
   }
 
-  if (transported->move_type == LAND_MOVING) {
-    if ((unit_type_flag(transporter, F_CARRIER)
-         || unit_type_flag(transporter, F_MISSILE_CARRIER))) {
-      return FALSE;
-    }
-    return TRUE;
-  }
-
-  if (!unit_class_flag(transported, UCF_MISSILE)
-     && unit_type_flag(transporter, F_MISSILE_CARRIER)) {
-    return FALSE;
-  }
-
-  if (unit_class_flag(transported, UCF_MISSILE)) {
-    if (!unit_type_flag(transporter, F_MISSILE_CARRIER)
-        && !unit_type_flag(transporter, F_CARRIER)) {
-      return FALSE;
-    }
-  } else if ((transported->move_type == AIR_MOVING
-              || transported->move_type == HELI_MOVING)
-             && !unit_type_flag(transporter, F_CARRIER)) {
-    return FALSE;
-  }
-
-  if (transported->move_type == SEA_MOVING) {
-    /* No unit can transport sea units at the moment */
-    return FALSE;
-  }
-
-  return TRUE;
+  return BV_ISSET(transporter->cargo, transported->id);
 }
 
 /**************************************************************************
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def  2006-07-14 00:21:40.828125000 +0300
+++ freeciv/common/packets.def  2006-07-14 00:45:35.875000000 +0300
@@ -1078,6 +1078,8 @@
 
   UINT8 bombard_rate;
 
+  BV_UNIT_CLASSES cargo;
+
   STRING helptext[MAX_LEN_PACKET];
 
   BV_FLAGS flags;
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2006-07-14 00:21:41.734375000 +0300
+++ freeciv/common/unittype.c   2006-07-14 00:46:36.390625000 +0300
@@ -44,10 +44,10 @@
 };
 static const char *flag_names[] = {
   "TradeRoute" ,"HelpWonder", "IgZOC", "NonMil", "IgTer", 
-  "Carrier", "OneAttack", "Pikemen", "Horse", "IgWall", "FieldUnit", 
+  "OneAttack", "Pikemen", "Horse", "IgWall", "FieldUnit", 
   "AEGIS", "Fighter", "Marines", "Partial_Invis", "Settlers", "Diplomat",
   "Trireme", "Nuclear", "Spy", "Transform", "Paratroopers",
-  "Airbase", "Cities", "Missile_Carrier", "No_Land_Attack",
+  "Airbase", "Cities", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
   "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender"
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h   2006-07-14 00:21:41.781250000 +0300
+++ freeciv/common/unittype.h   2006-07-14 00:46:56.640625000 +0300
@@ -57,8 +57,7 @@
   F_HELP_WONDER,
   F_IGZOC,     
   F_NONMIL,      
-  F_IGTER,       
-  F_CARRIER,     
+  F_IGTER,
   F_ONEATTACK,   
   F_PIKEMEN,     
   F_HORSE,       
@@ -77,7 +76,6 @@
   F_PARATROOPERS,
   F_AIRBASE,          /* Can build Airbases */
   F_CITIES,           /* Can build cities */
-  F_MISSILE_CARRIER,  /* Like F_CARRIER, but missiles only (Submarine) */
   F_NO_LAND_ATTACK,   /* Cannot attack vs land squares (Submarine) */
   F_ADD_TO_CITY,      /* unit can add to city population */
   F_FANATIC,          /* Only Fundamentalist government can build
@@ -194,6 +192,8 @@
   int bombard_rate;
 
   struct unit_class *class;
+
+  bv_unit_classes cargo;
   
   char *helptext;
 };
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2006-07-14 00:21:50.359375000 +0300
+++ freeciv/data/civ1/units.ruleset     2006-07-14 00:49:25.343750000 +0300
@@ -115,6 +115,7 @@
 ; fuel          = number of turns air units can fly before they crash. For
 ;                 barbarians this is used as lifetime instead
 ; uk_*          = upkeep costs, these are used as base values in the game
+; cargo         = Unit classes this unit can transport
 ; flags         = special flag strings
 ; roles         = special role strings
 ; sound_move   = optional sound effect when the unit moves
@@ -642,6 +643,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "Trireme"
 roles         = "Ferryboat"
 
@@ -670,6 +672,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = ""
 roles         = "Ferryboat", "BarbarianBoat"
 
@@ -698,6 +701,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = ""
 roles         = "Ferryboat"
 
@@ -842,7 +846,8 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Carrier"
+cargo         = "Air", "Missile"
+flags         = ""
 roles         = ""
 helptext      = _("\
 TIP:  Guard Carriers with a handful of fast-moving ships and a\
@@ -875,6 +880,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = ""
 roles         = "Ferryboat"
 
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2006-07-14 00:21:51.468750000 +0300
+++ freeciv/data/civ2/units.ruleset     2006-07-14 00:49:13.500000000 +0300
@@ -121,6 +121,7 @@
 ; fuel          = number of turns air units can fly before they crash. For
 ;                 barbarians this is used as lifetime instead
 ; uk_*          = upkeep costs, these are used as base values in the game
+; cargo         = Unit classes this unit can transport
 ; flags         = special flag strings
 ; roles         = special role strings
 ; sound_move   = optional sound effect when the unit moves
@@ -1137,6 +1138,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "Trireme", "BadCityDefender"
 roles         = "Ferryboat"
 
@@ -1165,6 +1167,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
@@ -1193,6 +1196,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
@@ -1221,6 +1225,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Hunter"
 
@@ -1393,8 +1398,9 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Missile"
 flags         = "Partial_Invis", "BadCityDefender",
-               "Missile_Carrier", "No_Land_Attack"
+               "No_Land_Attack"
 roles         = "Hunter"
 helptext      = _("\
 Submarines have a very high strategic value, but have a weak\
@@ -1426,7 +1432,8 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Carrier"
+cargo         = "Air", "Missile", "Helicopter"
+flags         = ""
 roles         = ""
 helptext      = _("\
 TIP:  Guard Carriers with a handful of fast-moving ships and a\
@@ -1459,6 +1466,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat"
 
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-14 00:21:53.062500000 +0300
+++ freeciv/data/default/units.ruleset  2006-07-14 00:47:38.187500000 +0300
@@ -130,6 +130,7 @@
 ;                 barbarians this is used as lifetime instead. If this is zero,
 ;                 the unit has unlimited fuel, despite flying.
 ; uk_*          = upkeep costs, these are used as base values in the game
+; cargo         = Unit classes this unit can transport
 ; flags         = special flag strings
 ; roles         = special role strings
 ; sound_move   = optional sound effect when the unit moves
@@ -148,8 +149,6 @@
 ; "IgZOC"      = (land only) ignore Zones of Control (ZOC)
 ; "NonMil"     = a non-military unit, does not cause unhappiness
 ; "IgTer"      = ignore terrain/road/rail, treat every tile as 1/3 move cost
-; "Carrier"    = can transport air and missile units, but not land units
-; "Missile_Carrier" = can transport only missiles, but no aircraft or land 
units
 ; "OneAttack"  = can only make a single attack, regardless of movement points
 ; "Pikemen"    = double defence power against "Horse" flag units
 ; "Horse"      = (no effect)
@@ -1192,6 +1191,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "Trireme", "BadCityDefender"
 roles         = "Ferryboat"
 
@@ -1220,6 +1220,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
@@ -1248,6 +1249,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
@@ -1276,6 +1278,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Hunter"
 
@@ -1448,8 +1451,9 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Missile"
 flags         = "Partial_Invis", "BadCityDefender",
-               "Missile_Carrier", "No_Land_Attack"
+               "No_Land_Attack"
 roles         = "Hunter"
 helptext      = _("\
 Submarines have a very high strategic value, but have a weak\
@@ -1481,7 +1485,8 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Carrier", "BadCityDefender"
+cargo         = "Air", "Missile", "Helicopter"
+flags         = "BadCityDefender"
 roles         = ""
 helptext      = _("\
 TIP:  Guard Carriers with a handful of fast-moving ships and a\
@@ -1514,6 +1519,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
+cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat"
 
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c    2006-07-14 00:23:48.218750000 +0300
+++ freeciv/server/ruleset.c    2006-07-14 00:45:36.562500000 +0300
@@ -1169,6 +1169,21 @@
                                                get_output_identifier(o));
     } output_type_iterate_end;
 
+    slist = secfile_lookup_str_vec(file, &nval, "%s.cargo", sec[i]);
+    BV_CLR_ALL(u->cargo);
+    for (j = 0; j < nval; j++) {
+      struct unit_class *class = unit_class_from_str(slist[j]);
+
+      if (!class) {
+        /* TRANS: message for an obscure ruleset error. */
+        freelog(LOG_FATAL, _("Unit %s has unknown unit class %s as cargo."),
+                u->name, slist[j]);
+        exit(EXIT_FAILURE);
+      }
+
+      BV_SET(u->cargo, class->id);
+    }
+
     u->helptext = lookup_helptext(file, sec[i]);
 
     u->paratroopers_range = secfile_lookup_int_default(file,
@@ -2732,6 +2747,7 @@
     packet.paratroopers_mr_req = u->paratroopers_mr_req;
     packet.paratroopers_mr_sub = u->paratroopers_mr_sub;
     packet.bombard_rate = u->bombard_rate;
+    packet.cargo = u->cargo;
     for (i = 0; i < MAX_VET_LEVELS; i++) {
       sz_strlcpy(packet.veteran_name[i], u->veteran[i].name);
       packet.power_fact[i] = u->veteran[i].power_fact;
diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in
--- freeciv/version.in  2006-07-14 00:24:00.546875000 +0300
+++ freeciv/version.in  2006-07-14 00:45:58.250000000 +0300
@@ -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.2006.Jul.10")
+FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2006.Jul.14")

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