Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13537) Two new unit flags
Home

[Freeciv-Dev] (PR#13537) Two new unit flags

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13537) Two new unit flags
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 30 Jul 2005 19:27:42 -0700
Reply-to: bugs@xxxxxxxxxxx

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

I made the name change and also updated the history ruleset.  This is
probably ready to commit now...
? data/diff
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.60
diff -p -u -r1.60 combat.c
--- common/combat.c     22 Jul 2005 16:18:05 -0000      1.60
+++ common/combat.c     31 Jul 2005 02:25:07 -0000
@@ -245,18 +245,26 @@ void get_modified_firepower(const struct
                            const struct unit *defender,
                            int *att_fp, int *def_fp)
 {
+  struct city *pcity = tile_get_city(defender->tile);
+
   *att_fp = unit_type(attacker)->firepower;
   *def_fp = unit_type(defender)->firepower;
 
   /* Check CityBuster flag */
-  if (unit_flag(attacker, F_CITYBUSTER)
-      && tile_get_city(defender->tile)) {
+  if (unit_flag(attacker, F_CITYBUSTER) && pcity) {
     *att_fp *= 2;
   }
 
+  if (unit_flag(attacker, F_BADWALLATTACKER)
+      && pcity 
+      && get_city_bonus(pcity, EFT_LAND_DEFEND) > 0) {
+    *att_fp = 1;
+  }
+
   /* pearl harbour - defender's firepower is reduced to one, 
    *                 attacker's is multiplied by two         */
-  if (is_sailing_unit(defender) && tile_get_city(defender->tile)) {
+  if (unit_flag(defender, F_BADCITYDEFENDER)
+      && tile_get_city(defender->tile)) {
     *att_fp *= 2;
     *def_fp = 1;
   }
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.63
diff -p -u -r1.63 unittype.c
--- common/unittype.c   23 Jul 2005 18:02:44 -0000      1.63
+++ common/unittype.c   31 Jul 2005 02:25:08 -0000
@@ -45,7 +45,7 @@ static const char *flag_names[] = {
   "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
-  "CityBuster", "NoBuild"
+  "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender"
 };
 static const char *role_names[] = {
   "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.54
diff -p -u -r1.54 unittype.h
--- common/unittype.h   23 Jul 2005 18:02:44 -0000      1.54
+++ common/unittype.h   31 Jul 2005 02:25:08 -0000
@@ -84,6 +84,8 @@ enum unit_flag_id { 
   F_BOMBARDER,        /* Has the ability to bombard */
   F_CITYBUSTER,       /* Gets double firepower against cities */
   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_LAST
 };
 #define F_MAX 64
Index: data/civ2/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/units.ruleset,v
retrieving revision 1.45
diff -p -u -r1.45 units.ruleset
--- data/civ2/units.ruleset     28 Jun 2005 17:21:02 -0000      1.45
+++ data/civ2/units.ruleset     31 Jul 2005 02:25:08 -0000
@@ -1082,7 +1082,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Trireme"
+flags         = "Trireme", "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_caravel]
@@ -1110,7 +1110,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_galleon]
@@ -1138,7 +1138,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_frigate]
@@ -1166,7 +1166,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_ironclad]
@@ -1194,7 +1194,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_destroyer]
@@ -1222,7 +1222,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 helptext      = _("\
 TIP:  A very fast unit, which is very useful for hunting down enemy\
@@ -1254,7 +1254,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = ""
 
 [unit_aegis_cruiser]
@@ -1282,7 +1282,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "AEGIS"
+flags         = "AEGIS", "BadCityDefender"
 roles         = ""
 
 [unit_battleship]
@@ -1310,7 +1310,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = ""
 
 [unit_submarine]
@@ -1338,7 +1338,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Partial_Invis", 
+flags         = "Partial_Invis", "BadCityDefender",
                "Missile_Carrier", "No_Land_Attack"
 roles         = "Hunter"
 helptext      = _("\
@@ -1404,7 +1404,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_cruise_missile]
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.70
diff -p -u -r1.70 units.ruleset
--- data/default/units.ruleset  20 Jul 2005 11:02:37 -0000      1.70
+++ data/default/units.ruleset  31 Jul 2005 02:25:09 -0000
@@ -144,6 +144,11 @@ veteran_move_bonus = 0, 0, 0, 0
 ;                 bombard_rate regulates its number of shots
 ; "CityBuster"  = this unit has double firepower against cities
 ; "NoBuild"     = this unit cannot be built
+; "BadWallAttacker"    = the firepower of this unit is set to 1 if
+;                 attacking a city
+;                defended by a city wall (or other city building defense)
+; "BadCityDefender"    = if attacked while in a city, firepower is set to 1 and
+;                attacker's firepower is doubled (the Pearl Harbour rule)
 ;
 ; Following flag strings require extra fields:
 ;  "Paratroopers"
@@ -1134,7 +1139,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Trireme"
+flags         = "Trireme", "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_caravel]
@@ -1162,7 +1167,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_galleon]
@@ -1190,7 +1195,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_frigate]
@@ -1218,7 +1223,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_ironclad]
@@ -1246,7 +1251,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_destroyer]
@@ -1274,7 +1279,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 helptext      = _("\
 TIP:  A very fast unit, which is very useful for hunting down enemy\
@@ -1306,7 +1311,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "DefendGood"
 
 [unit_aegis_cruiser]
@@ -1334,7 +1339,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "AEGIS"
+flags         = "AEGIS", "BadCityDefender"
 roles         = "DefendGood"
 
 [unit_battleship]
@@ -1362,7 +1367,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = ""
 
 [unit_submarine]
@@ -1390,7 +1395,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Partial_Invis", 
+flags         = "Partial_Invis", "BadCityDefender",
                "Missile_Carrier", "No_Land_Attack"
 roles         = "Hunter"
 helptext      = _("\
@@ -1423,7 +1428,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Carrier"
+flags         = "Carrier", "BadCityDefender"
 roles         = ""
 helptext      = _("\
 TIP:  Guard Carriers with a handful of fast-moving ships and a\
@@ -1456,7 +1461,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_cruise_missile]
Index: data/history/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/units.ruleset,v
retrieving revision 1.12
diff -p -u -r1.12 units.ruleset
--- data/history/units.ruleset  28 Jun 2005 17:21:03 -0000      1.12
+++ data/history/units.ruleset  31 Jul 2005 02:25:09 -0000
@@ -1066,7 +1066,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Trireme"
+flags         = "Trireme", "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_caravel]
@@ -1094,7 +1094,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_galleon]
@@ -1122,7 +1122,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
 
 [unit_frigate]
@@ -1150,7 +1150,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_ironclad]
@@ -1178,7 +1178,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 
 [unit_destroyer]
@@ -1206,7 +1206,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Hunter"
 helptext      = _("\
 TIP:  A very fast unit, which is very useful for hunting down enemy\
@@ -1238,7 +1238,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = ""
 
 [unit_aegis_cruiser]
@@ -1266,7 +1266,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "AEGIS"
+flags         = "AEGIS", "BadCityDefender"
 roles         = ""
 
 [unit_battleship]
@@ -1294,7 +1294,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = ""
 
 [unit_submarine]
@@ -1322,7 +1322,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Partial_Invis", 
+flags         = "Partial_Invis", "BadCityDefender",
                "Missile_Carrier", "No_Land_Attack"
 roles         = "Hunter"
 helptext      = _("\
@@ -1355,7 +1355,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Carrier"
+flags         = "Carrier", "BadCityDefender"
 roles         = ""
 helptext      = _("\
 TIP:  Guard Carriers with a handful of fast-moving ships and a\
@@ -1388,7 +1388,7 @@ uk_happy      = 1
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "BadCityDefender"
 roles         = "Ferryboat"
 
 [unit_cruise_missile]

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