<URL: http://bugs.freeciv.org/Ticket/Display.html?id=38322 >
Fstk crashes if it seems that enemy cannot build defender against us.
Fix attached (S2_1 version).
Another bug found by testing Mongols scenario (number 4)
- ML
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c 2007-03-05 19:14:29.000000000 +0200
+++ freeciv/ai/aiunit.c 2007-03-17 17:44:10.000000000 +0200
@@ -1390,13 +1390,16 @@
if (move_time > 1) {
struct unit_type *def_type
= ai_choose_defender_versus(acity, punit->type);
- int v = unittype_def_rating_sq(punit->type, def_type,
- acity->owner, acity->tile, FALSE,
- do_make_unit_veteran(acity, def_type));
- if (v > vuln) {
- /* They can build a better defender! */
- vuln = v;
- benefit = unit_build_shield_cost(def_type);
+
+ if (def_type) {
+ int v = unittype_def_rating_sq(punit->type, def_type,
+ acity->owner, acity->tile, FALSE,
+ do_make_unit_veteran(acity, def_type));
+ if (v > vuln) {
+ /* They can build a better defender! */
+ vuln = v;
+ benefit = unit_build_shield_cost(def_type);
+ }
}
}
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev