Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] (PR#18511) [Patch] PF & hp_loss_pct
Home

[Freeciv-Dev] (PR#18511) [Patch] PF & hp_loss_pct

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18511) [Patch] PF & hp_loss_pct
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Tue, 11 Jul 2006 10:40:21 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  This patch fixes how pathfinding handles danger in respect to 
unit_class.hp_loss_pct.


  - ML


diff -Nurd -X.diff_ignore freeciv/common/aicore/pf_tools.c 
freeciv/common/aicore/pf_tools.c
--- freeciv/common/aicore/pf_tools.c    2006-07-11 19:05:51.828125000 +0300
+++ freeciv/common/aicore/pf_tools.c    2006-07-11 19:51:55.750000000 +0300
@@ -636,21 +636,21 @@
   case HELI_MOVING:
     /* Helicoptors are treated similarly to airplanes. */
     parameter->get_MC = single_airmove;
-    if (get_player_bonus(unit_owner(punit), EFT_UNIT_RECOVER)
-       >= unit_type(punit)->hp / 10) {
-      /* United nations cancels out helicoptor fuel loss. */
-      parameter->is_pos_dangerous = NULL;
-    } else {
-      /* Otherwise, don't risk fuel loss. */
-      parameter->is_pos_dangerous = air_is_pos_dangerous;
-      parameter->turn_mode = TM_WORST_TIME;
-    }
     break;
   default:
     freelog(LOG_ERROR, "Impossible move type to pft_fill_unit_parameter()!");
     break;
   }
 
+  if (!parameter->is_pos_dangerous
+      && get_player_bonus(unit_owner(punit), EFT_UNIT_RECOVER)
+      < (unit_type(punit)->hp *
+         get_unit_class(unit_type(punit))->hp_loss_pct / 100)) {
+    /* United nations cancels out helicoptor fuel loss. */
+    parameter->is_pos_dangerous = air_is_pos_dangerous;
+    parameter->turn_mode = TM_WORST_TIME;
+  }
+
   if (get_unit_move_type(unit_type(punit)) == LAND_MOVING 
       && !unit_flag(punit, F_IGZOC)) {
     parameter->get_zoc = is_my_zoc;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#18511) [Patch] PF & hp_loss_pct, Marko Lindqvist <=