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

2006/7/9 Marko Lindqvist <cazf...@gmail.com>:
>
>  Goal is to have only three basic move_types: "Land", "Sea" and "Both".
>  Last should be used for air, heli and amphibious units.

 Finally, this was possible to implement. Patch attached. Requires gna
tickets #13673, #13681, #13683, #13684.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c 2009-06-13 02:09:12.000000000 +0300
+++ freeciv/ai/aicity.c 2009-06-13 01:41:14.000000000 +0300
@@ -371,7 +371,6 @@
      case SEA_MOVING:
        return ai->stats.units.sea;
      case BOTH_MOVING:
-     case AIR_MOVING:
        return ai->stats.units.amphibious;
      case MOVETYPE_LAST:
        break;
diff -Nurd -X.diff_ignore freeciv/ai/aihunt.c freeciv/ai/aihunt.c
--- freeciv/ai/aihunt.c 2008-10-27 04:13:32.000000000 +0200
+++ freeciv/ai/aihunt.c 2009-06-13 01:41:32.000000000 +0300
@@ -314,7 +314,7 @@
           if (ut->move_rate + victim->moves_left > pos.total_MC
               && ATTACK_POWER(victim) > DEFENCE_POWER(punit)
               && (utype_move_type(ut) == SEA_MOVING
-                  || utype_move_type(ut) == AIR_MOVING)) {
+                  || utype_move_type(ut) == BOTH_MOVING)) {
             /* Threat to our carrier. Kill it. */
             sucker = victim;
             UNIT_LOG(LOGLEVEL_HUNT, missile, "found aux target %d(%d, %d)",
diff -Nurd -X.diff_ignore freeciv/ai/aitools.c freeciv/ai/aitools.c
--- freeciv/ai/aitools.c        2009-06-12 02:30:41.000000000 +0300
+++ freeciv/ai/aitools.c        2009-06-13 02:00:48.000000000 +0300
@@ -664,9 +664,10 @@
   if (punit->ai.ai_role != AIUNIT_HUNTER
       && get_transporter_capacity(punit) > 0) {
     unit_class_iterate(uclass) {
+      /* FIXME: BOTH_MOVING units need ferry only if they use fuel */
       if (can_unit_type_transport(unit_type(punit), uclass)
           && (uclass->move_type == LAND_MOVING
-              || (uclass->move_type == AIR_MOVING
+              || (uclass->move_type == BOTH_MOVING
                   && !uclass_has_flag(uclass, UCF_MISSILE)))) {
         is_ferry = TRUE;
         break;
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c 2009-06-13 02:09:16.000000000 +0300
+++ freeciv/ai/aiunit.c 2009-06-13 01:43:04.000000000 +0300
@@ -2215,9 +2215,10 @@
 
   if (get_transporter_capacity(punit) > 0) {
     unit_class_iterate(pclass) {
+      /* FIXME: BOTH_MOVING units need ferry only if they use fuel */
       if (can_unit_type_transport(unit_type(punit), pclass)
           && (pclass->move_type == LAND_MOVING
-              || (pclass->move_type == AIR_MOVING
+              || (pclass->move_type == BOTH_MOVING
                   && !uclass_has_flag(pclass, UCF_MISSILE)))) {
         is_ferry = TRUE;
         break;
diff -Nurd -X.diff_ignore freeciv/client/climisc.c freeciv/client/climisc.c
--- freeciv/client/climisc.c    2009-06-13 02:09:12.000000000 +0300
+++ freeciv/client/climisc.c    2009-06-13 01:40:57.000000000 +0300
@@ -1134,8 +1134,7 @@
     return UNIT_BG_SEA;
   }
 
-  assert(pclass->move_type == BOTH_MOVING
-         || pclass->move_type == AIR_MOVING);
+  assert(pclass->move_type == BOTH_MOVING);
 
   if (uclass_has_flag(pclass, UCF_TERRAIN_SPEED)) {
     /* Unit moves on both sea and land by speed determined by terrain */
diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c   2009-06-13 02:09:12.000000000 +0300
+++ freeciv/client/helpdata.c   2009-06-13 01:41:04.000000000 +0300
@@ -1052,7 +1052,6 @@
     CATLSTR(buf, bufsz, _("* Will never achieve veteran status.\n"));
   } else {
     switch(utype_move_type(utype)) {
-      case AIR_MOVING:
       case BOTH_MOVING:
         CATLSTR(buf, bufsz,
                 _("* Will be built as a veteran in cities with appropriate"
diff -Nurd -X.diff_ignore freeciv/common/aicore/pf_tools.c 
freeciv/common/aicore/pf_tools.c
--- freeciv/common/aicore/pf_tools.c    2009-06-13 02:09:12.000000000 +0300
+++ freeciv/common/aicore/pf_tools.c    2009-06-13 01:46:04.000000000 +0300
@@ -72,7 +72,7 @@
 }
 
 /*************************************************************
-  Cost function for AIR_MOVING and amphibious units
+  Cost function for flying and amphibious units
 *************************************************************/
 static int airmove(const struct tile *ptile, enum direction8 dir,
                    const struct tile *ptile1,
@@ -686,7 +686,6 @@
       parameter->get_MC = seamove_no_bombard;
     }
     break;
-  case AIR_MOVING:
   case BOTH_MOVING:
     parameter->get_MC = airmove;
     break;
@@ -725,7 +724,6 @@
   case SEA_MOVING:
     parameter->get_MC = sea_overlap_move;
     break;
-  case AIR_MOVING:
   case BOTH_MOVING:
     parameter->get_MC = airmove; /* very crude */
     break;
@@ -756,7 +754,6 @@
   case SEA_MOVING:
     parameter->get_MC = sea_attack_move;
     break;
-  case AIR_MOVING:
   case BOTH_MOVING:
     parameter->get_MC = airmove; /* very crude */
     break;
diff -Nurd -X.diff_ignore freeciv/common/fc_types.h freeciv/common/fc_types.h
--- freeciv/common/fc_types.h   2009-06-13 02:09:12.000000000 +0300
+++ freeciv/common/fc_types.h   2009-06-13 01:45:33.000000000 +0300
@@ -146,11 +146,10 @@
  * would have a recursive dependency.
  * Order must mach order in move_type_names array. */
 enum unit_move_type {
-  AIR_MOVING = 0,
-  LAND_MOVING = 1,
-  SEA_MOVING = 2,
-  BOTH_MOVING = 3,
-  MOVETYPE_LAST = 4
+  LAND_MOVING = 0,
+  SEA_MOVING,
+  BOTH_MOVING,
+  MOVETYPE_LAST
 };
 
 /* The direction8 gives the 8 possible directions.  These may be used in
diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2009-06-13 02:09:12.000000000 +0300
+++ freeciv/common/movement.c   2009-06-13 01:46:26.000000000 +0300
@@ -33,7 +33,7 @@
 #include "terrain.h"
 
 static const char *move_type_names[] = {
-  "Air", "Land", "Sea", "Both"
+  "Land", "Sea", "Both"
 };
 
 /****************************************************************************
@@ -102,7 +102,7 @@
   /* It's clear that LAND_MOVING should not be able to attack from
    * non-native (unless F_MARINES) and it's clear that SEA_MOVING
    * should be able to attack from non-native. It's not clear what to do
-   * with BOTH_MOVING and AIR_MOVING. At the moment we return FALSE for
+   * with BOTH_MOVING. At the moment we return FALSE for
    * them. One can always give "Marines" flag for them. This should be
    * generalized for unit_classes anyway. */
   return (utype_class(utype)->move_type == SEA_MOVING
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2009-06-08 23:21:51.000000000 +0300
+++ freeciv/data/civ1/units.ruleset     2009-06-13 01:48:01.000000000 +0300
@@ -47,8 +47,7 @@
 ; ** Fields **
 ;
 ; name          = Name as used in other rulesets
-; move_type     = Where unit moves; Land, Sea, Both or Air. Air is special 
value for
-;                 airplanes
+; move_type     = Where unit moves; Land, Sea or Both.
 ; min_speed     = Minimum speed after damage and effects
 ; hp_loss_pct   = Hitpoints lost each turn if unit not in city or airbase
 ; hut_behavior  = What happens to huts when unit enters tile: "Normal", 
"Nothing" or
@@ -91,7 +90,7 @@
 
 [unitclass_air]
 name          = _("Air")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Nothing"
@@ -99,7 +98,7 @@
 
 [unitclass_missile]
 name          = _("Missile")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Nothing"
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2009-06-08 23:21:51.000000000 +0300
+++ freeciv/data/civ2/units.ruleset     2009-06-13 01:47:40.000000000 +0300
@@ -47,8 +47,7 @@
 ; ** Fields **
 ;
 ; name          = Name as used in other 
-; move_type     = Where unit moves; Land, Sea, Both or Air. Air is special 
value for
-;                 airplanes
+; move_type     = Where unit moves; Land, Sea or Both.
 ; min_speed     = Minimum speed after damage and effects
 ; hp_loss_pct   = Hitpoints lost each turn if unit not in city or airbase
 ; hut_behavior  = What happens to huts when unit enters tile: "Normal", 
"Nothing" or
@@ -76,7 +75,7 @@
 
 [unitclass_missile]
 name          = _("Missile")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Frighten"
@@ -106,7 +105,7 @@
 
 [unitclass_air]
 name          = _("Air")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Frighten"
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2009-06-12 21:17:38.000000000 +0300
+++ freeciv/data/default/units.ruleset  2009-06-13 01:47:11.000000000 +0300
@@ -52,8 +52,7 @@
 ; ** Fields **
 ;
 ; name          = Name as used in other rulesets
-; move_type     = Where unit moves; Land, Sea, Both or Air. Air is special 
value for
-;                 airplanes
+; move_type     = Where unit moves; Land, Sea or Both.
 ; min_speed     = Minimum speed after damage and effects
 ; hp_loss_pct   = Hitpoints lost each turn if unit not in city or airbase
 ; hut_behavior  = What happens to huts when unit enters tile: "Normal", 
"Nothing" or
@@ -81,7 +80,7 @@
 
 [unitclass_missile]
 name          = _("Missile")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Frighten"
@@ -118,7 +117,7 @@
 
 [unitclass_air]
 name          = _("Air")
-move_type     = "Air"
+move_type     = "Both"
 min_speed     = 1
 hp_loss_pct   = 0
 hut_behavior  = "Frighten"
diff -Nurd -X.diff_ignore freeciv/server/gotohand.c freeciv/server/gotohand.c
--- freeciv/server/gotohand.c   2009-06-13 02:09:12.000000000 +0300
+++ freeciv/server/gotohand.c   2009-06-13 01:44:37.000000000 +0300
@@ -231,7 +231,6 @@
   switch (move_type) {
   case LAND_MOVING:
   case BOTH_MOVING:
-  case AIR_MOVING:
     assert(sizeof(*warmap.cost) == sizeof(char));
     memset(warmap.cost, MAXCOST, MAP_INDEX_SIZE * sizeof(char));
     warmap.cost[tile_index(orig_tile)] = 0;
@@ -723,7 +722,7 @@
   warmap.warunit = NULL;
   warmap.warcity = NULL;
 
-  init_warmap(src_tile, AIR_MOVING);
+  init_warmap(src_tile, BOTH_MOVING);
 
   /* The 0 is inaccurate under A*, but it doesn't matter. */
   add_to_mapqueue(0, src_tile);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to