diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/ai/advmilitary.c freeciv-phased/ai/advmilitary.c --- freeciv/ai/advmilitary.c Thu Mar 7 13:17:24 2002 +++ freeciv-phased/ai/advmilitary.c Tue Mar 12 17:13:27 2002 @@ -164,7 +164,8 @@ int v; bool sailing; - if (unit_flag(punit, F_NO_LAND_ATTACK)) return(0); + if (unit_flag(punit, F_NO_LAND_ATTACK) + && city_got_building(pcity, B_COASTAL)) return(0); /* harmless */ sailing = is_sailing_unit(punit); if (sailing && !is_terrain_near_tile(pcity->x, pcity->y, T_OCEAN)) return(0); @@ -477,6 +478,9 @@ memset(desire, 0, sizeof(desire)); unit_type_iterate(i) { if (!is_ai_simple_military(i)) continue; + if (unit_type_flag(i, F_PARTIAL_INVIS) && ai_handicap(pplayer, H_SUB)) { + return; + } m = unit_types[i].move_type; if ((m == LAND_MOVING || m == SEA_MOVING)) { k = num_unknown_techs_for_goal(pplayer,unit_types[i].tech_requirement); diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/ai/aiunit.c freeciv-phased/ai/aiunit.c --- freeciv/ai/aiunit.c Thu Mar 7 13:17:25 2002 +++ freeciv-phased/ai/aiunit.c Tue Mar 12 17:09:51 2002 @@ -2290,7 +2290,6 @@ { return !unit_type_flag(type, F_NONMIL) && !unit_type_flag(type, F_MISSILE) - && !unit_type_flag(type, F_NO_LAND_ATTACK) && !(get_unit_type(type)->transport_capacity >= 8); } diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/common/combat.c freeciv-phased/common/combat.c --- freeciv/common/combat.c Mon Mar 11 20:36:37 2002 +++ freeciv-phased/common/combat.c Tue Mar 12 16:57:30 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,11 @@ /* This will make units roughly evenly good defenders look alike. */ int unit_def = (int) (100000 * (1 - unit_win_chance(attacker, defender))); + /* F_NO_LAND_ATTACK units can only attack seaborne units, so let us + give them something to chew on. Go, subs, go! {:-) - Per */ + if (unit_flag(attacker, F_NO_LAND_ATTACK) + && is_sailing_unit(defender)) + unit_def += 100001; assert(unit_def >= 0); if (unit_def > bestvalue) { diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/common/player.h freeciv-phased/common/player.h --- freeciv/common/player.h Thu Mar 7 13:17:30 2002 +++ freeciv-phased/common/player.h Tue Mar 12 17:12:54 2002 @@ -47,7 +47,7 @@ H_CITYUNITS=16, /* doesn't know what units are in enemy cities */ H_STACKS=32, /* doesn't know what units are in stacks */ H_VETERAN=64, /* doesn't know veteran status of enemy units */ - H_SUB=128, /* doesn't know where subs may be lurking */ + H_SUB=128, /* doesn't know how to use subs or other partially invisible units */ /* below this point are milder handicaps that I can actually implement -- Syela */ H_RATES=256, /* can't set its rates beyond government limits */ H_TARGETS=512, /* can't target anything it doesn't know exists */ diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/server/stdinhand.c freeciv-phased/server/stdinhand.c --- freeciv/server/stdinhand.c Mon Mar 11 20:36:40 2002 +++ freeciv-phased/server/stdinhand.c Tue Mar 12 17:07:53 2002 @@ -1646,9 +1646,9 @@ int h[11] = { -1, H_NONE, H_NONE, - H_RATES | H_TARGETS | H_HUTS, + H_RATES | H_TARGETS | H_HUTS | H_SUB, H_NONE, - H_RATES | H_TARGETS | H_HUTS, + H_RATES | H_TARGETS | H_HUTS | H_SUB, H_NONE, H_NONE, H_NONE, diff -u3NrX /home/perrin/freeciv/diff_ignore freeciv/server/unittools.c freeciv-phased/server/unittools.c --- freeciv/server/unittools.c Thu Mar 7 13:17:36 2002 +++ freeciv-phased/server/unittools.c Tue Mar 12 17:30:15 2002 @@ -139,7 +139,17 @@ return FALSE; } - if (unit_flag(punit, F_NO_LAND_ATTACK) && totile!=T_OCEAN) { + /* no_land_attack units can only attack seaborne units, and cannot + attack coastal fortresses */ + if ((unit_flag(punit, F_NO_LAND_ATTACK)) + && (!is_sailing_unit(pdefender))) { + notify_player(unit_owner(punit), "Game: Target has no seaborne units"); + return FALSE; + } + if ((unit_flag(punit, F_NO_LAND_ATTACK)) + && (map_get_city(dest_x,dest_y) + && city_got_building(map_get_city(dest_x, dest_y), B_COASTAL))) { + notify_player(unit_owner(punit), "Game: City is protected by a costal fortress"); return FALSE; }