Index: ai/aicity.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v retrieving revision 1.105 diff -u -r1.105 aicity.c --- ai/aicity.c 2002/03/05 19:02:01 1.105 +++ ai/aicity.c 2002/03/05 20:21:19 @@ -869,9 +869,11 @@ while (TRUE) { if ((elviscost = ai_find_elvis_pos(pcity, &xp, &yp)) != 0) { - if (city_get_food_tile(xp, yp, pcity) > pcity->food_surplus) + int food = city_get_food_tile(xp, yp, pcity); + + if (food > pcity->food_surplus) break; - if (city_get_food_tile(xp, yp, pcity) == pcity->food_surplus && city_happy(pcity)) + if (food == pcity->food_surplus && city_happy(pcity)) break; /* scientists don't party */ if (elviscost >= 24) /* doesn't matter if we wtbb or not! */ break; /* no benefit here! */ Index: common/combat.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v retrieving revision 1.20 diff -u -r1.20 combat.c --- common/combat.c 2002/03/01 14:07:30 1.20 +++ common/combat.c 2002/03/05 20:21:23 @@ -453,14 +453,16 @@ { struct unit *bestdef = NULL; int bestvalue = -1, count = 0, best_cost = 0, rating_of_best = 0; + struct player *att_owner = unit_owner(attacker); unit_list_iterate(map_get_tile(x, y)->units, defender) { - if (pplayers_allied(unit_owner(attacker), unit_owner(defender))) + if (pplayers_allied(att_owner, unit_owner(defender))) continue; count++; if (unit_can_defend_here(defender)) { bool change = FALSE; int build_cost = unit_type(defender)->build_cost; + int defense_rating = get_defense_rating(attacker, defender); /* This will make units roughly evenly good defenders look alike. */ int unit_def = (int) (100000 * (1 - unit_win_chance(attacker, defender))); @@ -472,7 +474,7 @@ if (build_cost < best_cost) { change = TRUE; } else if (build_cost == best_cost) { - if (rating_of_best < get_defense_rating(attacker, defender)) { + if (rating_of_best < defense_rating) { change = TRUE; } } @@ -482,7 +484,7 @@ bestvalue = unit_def; bestdef = defender; best_cost = build_cost; - rating_of_best = get_defense_rating(attacker, bestdef); + rating_of_best = defense_rating; } } } unit_list_iterate_end;