Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2006:
[Freeciv-Dev] (PR#17827) Air and sea units should not receive terrain de
Home

[Freeciv-Dev] (PR#17827) Air and sea units should not receive terrain de

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#17827) Air and sea units should not receive terrain defense bonuses!
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 11 Jun 2006 15:51:12 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Accidentially while reading combat.c, I discovered to my surprise that air 
and sea units get terrain defense bonuses. Yep, that includes a Battleship 
stationed in a mountain city with river, as well as a Stealth Bomber 
flying over a forest tile. A Stealth Fighter has an 84% chance to win 
against a Stealth Bomber over plains, but only 8% against a Stealth Bomber 
hoovering over a mountain.

Surely that is not intentional? Patch attached.

   - Per
Index: common/combat.c
===================================================================
--- common/combat.c     (revision 12025)
+++ common/combat.c     (working copy)
@@ -395,11 +395,13 @@
 {
   int db, power = base_get_defense_power(punit);
 
-  db = 10 + punit->tile->terrain->defense_bonus / 10;
-  if (tile_has_special(punit->tile, S_RIVER)) {
-    db += (db * terrain_control.river_defense_bonus) / 100;
+  if (is_ground_unit(punit)) {
+    db = 10 + punit->tile->terrain->defense_bonus / 10;
+    if (tile_has_special(punit->tile, S_RIVER)) {
+      db += (db * terrain_control.river_defense_bonus) / 100;
+    }
+    power = (power * db) / 10;
   }
-  power = (power * db) / 10;
 
   return power;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#17827) Air and sea units should not receive terrain defense bonuses!, Per I. Mathisen <=