Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: [PATCH] get rid of floating point calculations (PR#130
Home

[Freeciv-Dev] Re: [PATCH] get rid of floating point calculations (PR#130

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] get rid of floating point calculations (PR#1309)
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 15 Mar 2002 04:23:29 -0800 (PST)

On Fri, 15 Mar 2002, Raimar Falke wrote:

> On Tue, Mar 12, 2002 at 07:17:29PM +0100, Raimar Falke wrote:
> > On Sun, Mar 10, 2002 at 07:45:53AM -0800, Markus Linnala wrote:
> > > 
> > > Try to get rid of floating point calculations.
> > 
> > Some/all of these get cleaned up with the defense calculation cleanup
> > patch. The patch will be committed in the next few days.
> 
> Attached is a an updated patch for this and 1320.

It looks fine but I wouldn't mind an explanation for the division by 1.5 
in this bit:
==========================================================
diff -u -r1.187 aiunit.c
--- ai/aiunit.c 2002/03/13 11:49:19     1.187
+++ ai/aiunit.c 2002/03/15 08:01:02
@@ -1118,7 +1118,9 @@
     }
     d_val *= POWER_DIVIDER;
     d_val /= (unit_type(punit)->move_rate / SINGLE_MOVE);
-    if (unit_flag(punit, F_IGTER)) d_val /= 1.5;
+    if (unit_flag(punit, F_IGTER)) {
+      d_val = (d_val * 2) / 3;
+    }
     freelog(LOG_DEBUG,
            "%s@(%d,%d) looking for bodyguard, d_val=%d, my_val=%d",
            unit_type(punit)->name, punit->x, punit->y, d_val,
==========================================================

And in the last bit, please format the conditions in "if" properly, if you 
are already adding braces {}

Best,
G.





[Prev in Thread] Current Thread [Next in Thread]