Index: ai/advmilitary.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v retrieving revision 1.107 diff -u -r1.107 advmilitary.c --- ai/advmilitary.c 2002/08/07 10:42:17 1.107 +++ ai/advmilitary.c 2002/08/23 19:34:33 @@ -54,15 +54,24 @@ int wall_value) { int defense; + bool do_wall = FALSE; if (!is_military_unit(punit)) { return 0; } - defense = get_defense_power(punit) * punit->hp * - (is_sailing_unit(punit) ? 1 : unit_type(punit)->firepower); - if (is_ground_unit(punit)) { - defense = (3 * defense) / 2; + defense = get_defense_power(punit) * punit->hp; + if (!is_sailing_unit(punit)) { + defense *= unit_type(punit)->firepower; + if (is_ground_unit(punit)) { + if (pcity) { + do_wall = (!igwall && city_got_citywalls(pcity)); + defense *= 3; + } + if (punit->activity != ACTIVITY_FORTIFIED ) { + defense /= 2; + } + } } defense /= POWER_DIVIDER; @@ -70,7 +79,7 @@ defense *= defense; } - if (!igwall && city_got_citywalls(pcity) && is_ground_unit(punit)) { + if (do_wall) { defense *= wall_value; defense /= 10; } @@ -102,10 +111,9 @@ if (defense > 1<<12) { freelog(LOG_VERBOSE, "Very large defense in assess_defense_quadratic: %d in %s", defense, pcity->name); - } - - if (defense > 1<<15) { - defense = 1<<15; /* more defense than we know what to do with! */ + if (defense > 1<<15) { + defense = 1<<15; /* more defense than we know what to do with! */ + } } return defense * defense;