--- freeciv-phased/common/combat.c.old Tue Mar 12 11:55:03 2002 +++ freeciv-phased/common/combat.c Tue Mar 12 13:20:43 2002 @@ -446,8 +446,9 @@ have anything to do with the value of a unit. It would be nice if the function was a bit more fuzzy about prioritizing, making it able to fx choose a 1a/9d unit over a 10a/10d unit. It should -also be able to spare units without full hp's to some extend, as these +also be able to spare units without full hp's to some extent, as these could be more valuable later. +A seaborne unit must attempt to defend a city against submarine attacks. **************************************************************************/ struct unit *get_defender(struct unit *attacker, int x, int y) { @@ -466,6 +467,13 @@ /* This will make units roughly evenly good defenders look alike. */ int unit_def = (int) (100000 * (1 - unit_win_chance(attacker, defender))); + /* Ensure that seaborne units that can only attack other seaborne + units can actually attack enemy seaborne units in a stack if + they are present, and not fail because the enemy chose to + defend with a ground unit. Go, subs, go! {:-) - Per */ + if (unit_flag(attacker, F_NO_LAND_ATTACK) + && is_sailing_unit(defender)) + unit_def += 100000; assert(unit_def >= 0); if (unit_def > bestvalue) { --- freeciv-phased/server/unittools.c.old Tue Mar 12 11:49:18 2002 +++ freeciv-phased/server/unittools.c Tue Mar 12 13:25:32 2002 @@ -139,7 +139,9 @@ return FALSE; } - if (unit_flag(punit, F_NO_LAND_ATTACK) && totile!=T_OCEAN) { + /* no_land_attack units can only attack seaborne units */ + if ((unit_flag(punit, F_NO_LAND_ATTACK)) + && (!is_sailing_unit(pdefender))) { return FALSE; }