Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2002:
[Freeciv-Dev] Wrong ruleset hint and dangerous division (PR#1853)
Home

[Freeciv-Dev] Wrong ruleset hint and dangerous division (PR#1853)

[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] Wrong ruleset hint and dangerous division (PR#1853)
From: nightmare@xxxxxxxxxx
Date: Mon, 29 Jul 2002 09:52:06 -0700 (PDT)

Full_Name: Davide Pagnin
Version: 1.13.1-devel
Distribution: Don't know
Client: Both (or N/A)
OS: linux
Submission from: (NULL) (193.205.82.101)


In the file data/defaults/units.ruleset there is a variable called
firepower_factor, in the [units_adjust] section.

The comment says:
firepower_factor=1     ; Multiply firepower by this value. Set it
                       ; to zero to disable firepower altogether.

This is wrong (perhaps outdated) because the relevant code in the 
server/ruleset.c file is:

   game.firepower_factor =
     secfile_lookup_int_default(file, 1, "units_adjust.firepower_factor");

   ...

   packet.hp = u->hp / game.firepower_factor;

A this division is made without checking that game.firepower_factor is
different from zero. (Thus, if you want to disable firepower altogether
and try the suggestion, you get a division by zero signal!).

Shortly will come a patch.



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Wrong ruleset hint and dangerous division (PR#1853), nightmare <=