Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#12921) Clean up combat.c
Home

[Freeciv-Dev] (PR#12921) Clean up combat.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12921) Clean up combat.c
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Mon, 2 May 2005 02:30:24 -0700
Reply-to: bugs@xxxxxxxxxxx

<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

Attachment: combat_cleanup-6.diff
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]