[Freeciv-Dev] Re: (PR#8791) crash with civ1 ruleset
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8791 >
On Fri, 21 May 2004, Raimar Falke wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8791 >
>
> On Fri, May 21, 2004 at 06:12:33PM -0700, Jason Short wrote:
> >
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=8791 >
> >
> > Gregory Berkolaiko wrote:
> >
> > > I am not too sure what shall we do about it. multiplication by 10 is for
> > > veteran bonuses not to get lost. Later division by 30 is to keep numbers
> > > sane for larger units in default/civ2 rulesets.
> >
> > What about either:
> >
> > - Making it use floating point values?
> >
> > or
> >
> > - Calculating the POWER_DIVIDER when we load the ruleset?
>
> What about this patch? It works for both RCc you posted.
I am applying the attached patch, which is a modification of Raimars
patch. I added a comment and removed the assert. In fact if only attack
= 0, kill_desire returns sane values (negative desire to attack). And if
both attack and vuln are zero, you get SIGFPE, so why bother checking for
it?
Index: ai/advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.165
diff -u -u -r1.165 advmilitary.c
--- ai/advmilitary.c 2 May 2004 12:31:05 -0000 1.165
+++ ai/advmilitary.c 22 May 2004 06:15:58 -0000
@@ -798,6 +798,12 @@
/* Take into account reinforcements strength */
if (acity) attack += acity->ai.attack;
+
+ if (attack == 0) {
+ /* Yes, it can happen that a military unit has attack=1,
+ * for example militia with HP=1 (in civ1 ruleset). */
+ continue;
+ }
attack *= attack;
|
|