Re: [Freeciv-Dev] (PR#33762) [Patch] UCF_UNREACHABLE
http://bugs.freeciv.org/Ticket/Display.html?id=33762 > On 1/16/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote: > > Only F_FIGHER can attack air units. It has been hardcoded to > AIR_MOVING. This patch turns it into unit class flag. - Better helptext for F_FIGHTER - Helptext for UCF_UNREACHABLE - ML diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c --- freeciv/client/helpdata.c 2007-01-17 09:20:24.0 +0200 +++ freeciv/client/helpdata.c 2007-01-18 16:38:33.0 +0200 @@ -771,6 +771,10 @@ sprintf(buf + strlen(buf), _(" * Gets used up in making an attack.\n")); } + if (unit_class_flag(get_unit_class(utype), UCF_UNREACHABLE)) { +sprintf(buf + strlen(buf), + _(" * Is unreachable. Most units cannot attack this one.\n")); + } if (utype->impr_requirement != B_LAST) { sprintf(buf + strlen(buf), @@ -915,7 +919,7 @@ sprintf(buf + strlen(buf), _("* May not be bribed.\n")); } if (unit_type_flag(utype, F_FIGHTER)) { -sprintf(buf + strlen(buf), _("* Can attack enemy air units.\n")); +sprintf(buf + strlen(buf), _("* Can attack otherwise unreachable enemy units.\n")); } if (unit_type_flag(utype, F_PARTIAL_INVIS)) { sprintf(buf + strlen(buf), _("* Is invisible except when next to an" diff -Nurd -X.diff_ignore freeciv/common/combat.c freeciv/common/combat.c --- freeciv/common/combat.c 2006-07-21 23:18:09.0 +0300 +++ freeciv/common/combat.c 2007-01-18 16:37:07.0 +0200 @@ -93,7 +93,8 @@ } /* 2. Only fighters can attack planes, except in city or airbase attacks */ - if (!unit_flag(punit, F_FIGHTER) && is_air_unit(pdefender) + if (!unit_flag(punit, F_FIGHTER) + && unit_class_flag(get_unit_class(unit_type(pdefender)), UCF_UNREACHABLE) && !(pcity || tile_has_special(dest_tile, S_AIRBASE))) { return FALSE; } diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c --- freeciv/common/unittype.c 2006-08-18 10:52:03.0 +0300 +++ freeciv/common/unittype.c 2007-01-18 16:37:07.0 +0200 @@ -41,7 +41,7 @@ static const char *unit_class_flag_names[] = { "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile", - "RoadNative", "BuildAnywhere" + "RoadNative", "BuildAnywhere", "Unreachable" }; static const char *flag_names[] = { "TradeRoute" ,"HelpWonder", "IgZOC", "NonMil", "IgTer", diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h --- freeciv/common/unittype.h 2006-08-18 10:52:03.0 +0300 +++ freeciv/common/unittype.h 2007-01-18 16:37:07.0 +0200 @@ -32,6 +32,7 @@ UCF_MISSILE, UCF_ROAD_NATIVE, UCF_BUILD_ANYWHERE, + UCF_UNREACHABLE, UCF_LAST }; diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset freeciv/data/civ1/units.ruleset --- freeciv/data/civ1/units.ruleset 2006-08-18 10:51:28.0 +0300 +++ freeciv/data/civ1/units.ruleset 2007-01-18 16:37:07.0 +0200 @@ -52,7 +52,7 @@ ; ; name = Name as used in other rulesets ; move_type = Where unit moves; Land, Sea, Both or Air. Air is special value for -; units which can only be attacked by units with "Fighter" flag +; airplanes ; min_speed = Minimum speed after damage and effects ; hp_loss_pct = Hitpoints lost each turn if unit not in city or airbase ; flags = List of unit class flags @@ -65,6 +65,8 @@ ; "Missile" = Unit is destroyed when it attacks ; "RoadNative"= Road tiles are always considered native terrain ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain +; "Unreachable" = Unit can be attacked only by units with "Fighter" flag or on +; city or airbase [unitclass_land] name = _("Land") @@ -85,14 +87,14 @@ move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "" +flags = "Unreachable" [unitclass_missile] name = _("Missile") move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "Missile" +flags = "Missile", "Unreachable" ; Below: The individual units, one per section. ; diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset freeciv/data/civ2/units.ruleset --- freeciv/data/civ2/units.ruleset 2006-08-18 10:51:28.0 +0300 +++ freeciv/data/civ2/units.ruleset 2007-01-18 16:37:07.0 +0200 @@ -52,7 +52,7 @@ ; ; name = Name as used in other ; move_type = Where unit moves; Land, Sea, Both or Air. Air is special value for -; units which can only be attacked by units with "Fighter" flag +; airplanes ; min_speed = Minimum speed after damage and effects ; hp_loss_pct = Hitpoints lost each turn if unit not in city or airbase ; flags = List of unit class flags @@ -65,13 +65,15 @@ ; "Missile" = Unit is destroyed when it attacks ; "RoadNative"= Road tiles are always considered native terrain ; "BuildAnywhere" = Unit can be bu
[Freeciv-Dev] (PR#33762) [Patch] UCF_UNREACHABLE
http://bugs.freeciv.org/Ticket/Display.html?id=33762 > Only F_FIGHER can attack air units. It has been hardcoded to AIR_MOVING. This patch turns it into unit class flag. - ML diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c --- freeciv/client/helpdata.c 2006-08-18 10:52:09.0 +0300 +++ freeciv/client/helpdata.c 2007-01-16 08:56:17.0 +0200 @@ -910,7 +910,7 @@ sprintf(buf + strlen(buf), _("* May not be bribed.\n")); } if (unit_type_flag(utype, F_FIGHTER)) { -sprintf(buf + strlen(buf), _("* Can attack enemy air units.\n")); +sprintf(buf + strlen(buf), _("* Can attack unreachable enemy units.\n")); } if (unit_type_flag(utype, F_PARTIAL_INVIS)) { sprintf(buf + strlen(buf), _("* Is invisible except when next to an" diff -Nurd -X.diff_ignore freeciv/common/combat.c freeciv/common/combat.c --- freeciv/common/combat.c 2006-07-21 23:18:09.0 +0300 +++ freeciv/common/combat.c 2007-01-16 09:07:05.0 +0200 @@ -93,7 +93,8 @@ } /* 2. Only fighters can attack planes, except in city or airbase attacks */ - if (!unit_flag(punit, F_FIGHTER) && is_air_unit(pdefender) + if (!unit_flag(punit, F_FIGHTER) + && unit_class_flag(get_unit_class(unit_type(pdefender)), UCF_UNREACHABLE) && !(pcity || tile_has_special(dest_tile, S_AIRBASE))) { return FALSE; } diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c --- freeciv/common/unittype.c 2006-08-18 10:52:03.0 +0300 +++ freeciv/common/unittype.c 2007-01-16 08:47:25.0 +0200 @@ -41,7 +41,7 @@ static const char *unit_class_flag_names[] = { "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile", - "RoadNative", "BuildAnywhere" + "RoadNative", "BuildAnywhere", "Unreachable" }; static const char *flag_names[] = { "TradeRoute" ,"HelpWonder", "IgZOC", "NonMil", "IgTer", diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h --- freeciv/common/unittype.h 2006-08-18 10:52:03.0 +0300 +++ freeciv/common/unittype.h 2007-01-16 08:47:01.0 +0200 @@ -32,6 +32,7 @@ UCF_MISSILE, UCF_ROAD_NATIVE, UCF_BUILD_ANYWHERE, + UCF_UNREACHABLE, UCF_LAST }; diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset freeciv/data/civ1/units.ruleset --- freeciv/data/civ1/units.ruleset 2006-08-18 10:51:28.0 +0300 +++ freeciv/data/civ1/units.ruleset 2007-01-16 09:08:55.0 +0200 @@ -52,7 +52,7 @@ ; ; name = Name as used in other rulesets ; move_type = Where unit moves; Land, Sea, Both or Air. Air is special value for -; units which can only be attacked by units with "Fighter" flag +; airplanes ; min_speed = Minimum speed after damage and effects ; hp_loss_pct = Hitpoints lost each turn if unit not in city or airbase ; flags = List of unit class flags @@ -65,6 +65,8 @@ ; "Missile" = Unit is destroyed when it attacks ; "RoadNative"= Road tiles are always considered native terrain ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain +; "Unreachable" = Unit can be attacked only by units with "Fighter" flag or on +; city or airbase [unitclass_land] name = _("Land") @@ -85,14 +87,14 @@ move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "" +flags = "Unreachable" [unitclass_missile] name = _("Missile") move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "Missile" +flags = "Missile", "Unreachable" ; Below: The individual units, one per section. ; diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset freeciv/data/civ2/units.ruleset --- freeciv/data/civ2/units.ruleset 2006-08-18 10:51:28.0 +0300 +++ freeciv/data/civ2/units.ruleset 2007-01-16 09:09:21.0 +0200 @@ -52,7 +52,7 @@ ; ; name = Name as used in other ; move_type = Where unit moves; Land, Sea, Both or Air. Air is special value for -; units which can only be attacked by units with "Fighter" flag +; airplanes ; min_speed = Minimum speed after damage and effects ; hp_loss_pct = Hitpoints lost each turn if unit not in city or airbase ; flags = List of unit class flags @@ -65,13 +65,15 @@ ; "Missile" = Unit is destroyed when it attacks ; "RoadNative"= Road tiles are always considered native terrain ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain +; "Unreachable" = Unit can be attacked only by units with "Fighter" flag or on +; city or airbase [unitclass_missile] name = _("Missile") move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "Missile" +flags = "Missile", "Unreachable" [unitclass_land] name = _("Land") @@ -99,7 +101,7 @@ move_type = "Air" min_speed = 1 hp_loss_pct = 0 -flags = "" +flag