[Freeciv-Dev] (PR#12921) Clean up combat.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12921 >
> [per - Mon May 02 07:54:34 2005]:
>
> On Thu, 28 Apr 2005, James Canete wrote:
> > New version.
>
> Hmm. I have to ask: Why?
I prefer having all the strength calculations in one place. It makes it
easier to modify the rules of combat, for example changing all the
multipliers to additions or subtractions, or putting in a multiplier cap
so there aren't any pikemen on a mountain fortress situations.
> It would seem easier to streamline the callers in this case, than making
> the code this messy.
>
Here's an alternate version of the patch that cleans it up a lot.
Instead of unwrapping the units' attributes and sending them as
parameters in get_defense_power() and get_attack_power(), it calculates
the power directly from the unit structs, and get_virtual_attack_power()
and get_virtual_defense_power() create fake units to use in the
calculations.
This was my original idea, but I found that create_virtual_unit() didn't
like to create units that were ownerless, so I put it on the back burner
until now.
Anyway, I haven't tested this version, but will report back when I do.
-James Canete
combat_cleanup-6.diff
Description: Binary data
|
|