<URL: http://bugs.freeciv.org/Ticket/Display.html?id=37264 >

 request_unit_return() does not take in to account helicopter hitpoint
loss when determining if returning to city makes sense. This patch
fixes that.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/control.c freeciv/client/control.c
--- freeciv/client/control.c	2007-02-12 15:27:45.000000000 +0200
+++ freeciv/client/control.c	2007-03-01 17:18:50.000000000 +0200
@@ -1111,9 +1111,12 @@
 
   if ((path = path_to_nearest_allied_city(punit))) {
     int turns = pf_last_position(path)->turn;
+    int max_hp = unit_type(punit)->hp;
 
-    if (punit->hp + turns * get_unit_bonus(punit, EFT_UNIT_RECOVER)
-	< unit_type(punit)->hp) {
+    if (punit->hp + turns *
+        (get_unit_bonus(punit, EFT_UNIT_RECOVER)
+         - (max_hp * get_unit_class(unit_type(punit))->hp_loss_pct / 100))
+	< max_hp) {
       struct unit_order order;
 
       order.order = ORDER_ACTIVITY;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to