<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39674 >
On Sun, 9 Sep 2007, Marko Lindqvist wrote:
> On 09/09/07, Per I. Mathisen wrote:
>> + && ((pbase && base_has_flag(pbase, BF_NO_STACK_DEATH))
>> + || !game.info.killstack
>> + || defender->tile->city)) {
>
> Use is_stack_vulnerable() instead.
Thanks. New patch.
- Per
Carpe noctem
Index: common/combat.c
===================================================================
--- common/combat.c (revision 13546)
+++ common/combat.c (working copy)
@@ -551,7 +551,7 @@
const struct tile *ptile)
{
struct unit *bestdef = NULL;
- int bestvalue = -1, best_cost = 0, rating_of_best = 0;
+ int bestvalue = -99, best_cost = 0, rating_of_best = 0;
/* Simply call win_chance with all the possible defenders in turn, and
* take the best one. It currently uses build cost as a tiebreaker in
@@ -574,7 +574,10 @@
= (int) (100000 * (1 - unit_win_chance(attacker, defender)));
assert(unit_def >= 0);
-
+ if (unit_has_type_flag(defender, F_GAMELOSS)
+ && !is_stack_vulnerable(defender->tile)) {
+ unit_def = -1; // then always use leader as last defender
+ }
if (unit_def > bestvalue) {
change = TRUE;
} else if (unit_def == bestvalue) {
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev