[Freeciv-Dev] [patch #3671] Minor optimization to has_defense()

2013-02-09 Thread Marko Lindqvist
Update of patch #3671 (project freeciv):

  Status:  Ready For Test => Done   
 Assigned to:None => cazfi  
 Open/Closed:Open => Closed 


___

Reply to this item at:

  

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #3671] Minor optimization to has_defense()

2013-02-05 Thread Marko Lindqvist
URL:
  

 Summary: Minor optimization to has_defense()
 Project: Freeciv
Submitted by: cazfi
Submitted on: Wed 06 Feb 2013 05:08:56 AM EET
Category: ai
Priority: 5 - Normal
  Status: Ready For Test
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 2.5.0

___

Details:

As has_defense() wants to know only if unit has any defense power at all, call
base_get_defense_power() instead of get_defense_power(). Latter only
multiplies result of former with positive value -> if former returns 0, so
does multiplied, if former returns non-zero, so does multiplied.

This alone is minor optimization, but getting rid of one call to
get_defense_power() is also step towards rivers as road types. Currently river
defense bonus is applied in get_defense_bonus(), while road bonuses apply in
defense_multiplication(). Any call to get_defense_bonus() without
defense_multiplication() call would get different result when river is handled
as road type. I want to clean up that interface a bit.



___

File Attachments:


---
Date: Wed 06 Feb 2013 05:08:56 AM EET  Name: HasDefenseOptimization.patch 
Size: 558B   By: cazfi



___

Reply to this item at:

  

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev