Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] (PR#18602) [Patch] unit_type flag "Helicopter"
Home

[Freeciv-Dev] (PR#18602) [Patch] unit_type flag "Helicopter"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18602) [Patch] unit_type flag "Helicopter"
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Fri, 14 Jul 2006 14:10:26 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  New unit_type flag F_HELICOPTER. Units marked with this flag defend 
badly against F_FIGHTER units.
  Not an ideal solution, but at least more consistent with F_PIKEMEN & 
F_HORSE flags. I just want this 'bad defense against fighters' feature 
separated from move_type so my amphibious tanks won't suffer from it.


  - ML


diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c    2006-07-14 23:29:00.171875000 +0300
+++ freeciv/ai/advmilitary.c    2006-07-14 23:38:01.390625000 +0300
@@ -601,9 +601,9 @@
   /* Sea and helicopters often have their firepower set to 1 when
    * defending. We can't have such units as defenders. */
   if (!unit_type_flag(punittype, F_BADCITYDEFENDER)
-      && get_unit_move_type(punittype) != HELI_MOVING) {
+      && !unit_type_flag(punittype, F_HELICOPTER)) {
     /* Sea units get 1 firepower in Pearl Harbour,
-     * and helicopters very bad against air units */
+     * and helicopters very bad against fighters */
     desire *= punittype->firepower;
   }
   desire *= defense;
diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c   2006-07-14 23:29:49.328125000 +0300
+++ freeciv/client/helpdata.c   2006-07-14 23:47:51.625000000 +0300
@@ -943,6 +943,10 @@
     sprintf(buf + strlen(buf),
            _("* Counts as 'mounted' against certain defenders.\n"));
   }
+  if (unit_type_flag(utype, F_HELICOPTER)) {
+    sprintf(buf + strlen(buf),
+            _("* Defends very badly agains fighter type units.\n"));
+  }
   if (!unit_class_flag(get_unit_class(utype), UCF_MISSILE)
       && unit_type_flag(utype, F_ONEATTACK)) {
     sprintf(buf + strlen(buf),
diff -Nurd -X.diff_ignore freeciv/common/combat.c freeciv/common/combat.c
--- freeciv/common/combat.c     2006-07-14 23:29:57.656250000 +0300
+++ freeciv/common/combat.c     2006-07-14 23:37:00.578125000 +0300
@@ -276,7 +276,7 @@
    * When attacked by fighters, helicopters have their firepower
    * reduced to 1.
    */
-  if (is_heli_unit(defender) && unit_flag(attacker, F_FIGHTER)) {
+  if (unit_flag(defender, F_HELICOPTER) && unit_flag(attacker, F_FIGHTER)) {
     *def_fp = 1;
   }
 
@@ -459,7 +459,7 @@
       defensepower = MAX(0, defensepower * mod / 100);
     }
 
-    if (unit_type_flag(att_type, F_FIGHTER) && is_heli_unittype(def_type)) {
+    if (unit_type_flag(att_type, F_FIGHTER) && unit_type_flag(def_type, 
F_HELICOPTER)) {
       defensepower /= 2;
     }
   }
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2006-07-14 23:29:59.546875000 +0300
+++ freeciv/common/unittype.c   2006-07-14 23:35:35.671875000 +0300
@@ -50,7 +50,8 @@
   "Airbase", "Cities", "Missile_Carrier", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
-  "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender"
+  "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender",
+  "Helicopter"
 };
 static const char *role_names[] = {
   "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h   2006-07-14 23:29:59.593750000 +0300
+++ freeciv/common/unittype.h   2006-07-14 23:44:59.203125000 +0300
@@ -94,6 +94,7 @@
   F_NOBUILD,          /* Unit cannot be built (barb leader etc) */
   F_BADWALLATTACKER,  /* Firepower set to 1 when attacking city wall */
   F_BADCITYDEFENDER,  /* Firepower set to 1 and attackers x2 when in city */
+  F_HELICOPTER,       /* Defends badly against F_FIGHTER units */
   F_LAST
 };
 #define F_MAX 64
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2006-07-14 23:30:11.187500000 +0300
+++ freeciv/data/civ2/units.ruleset     2006-07-14 23:40:41.859375000 +0300
@@ -1039,7 +1039,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "Helicopter"
 roles         = ""
 helptext      = _("\
 The Helicopter is a very powerful unit, as it can both fly and\
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-14 23:30:12.781250000 +0300
+++ freeciv/data/default/units.ruleset  2006-07-14 23:40:18.406250000 +0300
@@ -202,6 +202,7 @@
 ; "BadCityDefender"    = if attacked while in a city, firepower is set to 1
 ;                and firepower of attacker is doubled (the Pearl Harbour
 ;                 rule)
+; "Helicopter"  = defends very badly against "Fighter" units
 ;
 ; Following flag strings require extra fields:
 ;  "Paratroopers"
@@ -1094,7 +1095,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "Helicopter"
 roles         = ""
 helptext      = _("\
 The Helicopter is a very powerful unit, as it can both fly and\

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#18602) [Patch] unit_type flag "Helicopter", Marko Lindqvist <=