Index: ai/advmilitary.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v retrieving revision 1.92 diff -u -r1.92 advmilitary.c --- ai/advmilitary.c 2002/03/01 09:01:21 1.92 +++ ai/advmilitary.c 2002/03/01 10:03:42 @@ -618,14 +618,16 @@ unit_types[i].move_type == HELI_MOVING) && acity && acity->ai.invasion == 2) b0 = f * SHIELD_WEIGHTING; else { - int a_squared = acity->ai.a * acity->ai.a; - - /* See aiunit.c:find_something_to_kill() for comments. */ - - b0 = kill_desire(b, a, (f + (acity ? acity->ai.f : 0)), d, g); - if (acity && b * a_squared > acity->ai.f * d) { - b0 -= kill_desire(b, a_squared, acity->ai.f, d, g); - } + if (!acity) { + b0 = kill_desire(b, a, f, d, g); + } else { + int a_squared = acity->ai.a * acity->ai.a; + + b0 = kill_desire(b, a, f + acity->ai.f, d, g); + if (b * a_squared > acity->ai.f * d) { + b0 -= kill_desire(b, a_squared, acity->ai.f, d, g); + } + } } if (b0 > 0) { b0 -= l * SHIELD_WEIGHTING; @@ -826,13 +828,15 @@ unit_types[v].move_type == HELI_MOVING) && acity && acity->ai.invasion == 2) b0 = f * SHIELD_WEIGHTING; else { - int a_squared = acity->ai.a * acity->ai.a; + if (!acity) { + b0 = kill_desire(b, a, f, d, g); + } else { + int a_squared = acity->ai.a * acity->ai.a; - /* See aiunit.c:find_something_to_kill() for comments. */ - - b0 = kill_desire(b, a, (f + (acity ? acity->ai.f : 0)), d, g); - if (acity && b * a_squared > acity->ai.f * d) { - b0 -= kill_desire(b, a_squared, acity->ai.f, d, g); + b0 = kill_desire(b, a, f + acity->ai.f, d, g); + if (b * a_squared > acity->ai.f * d) { + b0 -= kill_desire(b, a_squared, acity->ai.f, d, g); + } } } b0 -= c * (unhap ? SHIELD_WEIGHTING + 2 * TRADE_WEIGHTING : SHIELD_WEIGHTING);