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

> [kevin.in.ko...@gmail.com - Wed Mar 11 04:01:32 2009]:
> 
> Veteran and Hardened Workers do not gain work speed because of a
> trivial data typing error.
> 
> The default ruleset includes
> veteran_power_fact = 100, 150, 175, 200
> 
> In the file server/ruleset.c this is read in as a double and
> divided by 100
> 
> Hence internally power_fact = 1, 1.5, 1.75, 2
> 
> However  in common/unit.c power_fact is cast to an integer just
> before the activity rate is calculated
> 
> int fact = unit_type(punit)->veteran[punit->veteran].power_fact;
> 
> Now  power_fact = 1, 1, 1, 2
> 
> The fix is trivial replace the int with a double.

Ok, here is a the patch.


-----------------------------------------------------------------------
渦巻きに落ち、目覚めたら私はいい場所にいた。
diff --git a/common/unit.c b/common/unit.c
index c2e4af8..100af79 100644
--- a/common/unit.c
+++ b/common/unit.c
@@ -459,7 +459,7 @@ bool can_unit_change_homecity(const struct unit *punit)
 **************************************************************************/
 int get_activity_rate(const struct unit *punit)
 {
-  int fact = unit_type(punit)->veteran[punit->veteran].power_fact;
+  double fact = unit_type(punit)->veteran[punit->veteran].power_fact;
 
   /* The speed of the settler depends on its base move_rate, not on
    * the number of moves actually remaining or the adjusted move rate.
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to