Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8754) effects patch
Home

[Freeciv-Dev] (PR#8754) effects patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8754) effects patch
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 17 May 2004 06:27:21 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8754 >

> [per@xxxxxxxxxxx - Mon May 17 12:47:48 2004]:
> 
> This patch is very neat, and it is also a lot shorter than both gen eff
> and gen impr. Still, not everything is obvious, so please add function
> comments to the patch as soon as possible.

Which parts do you find hardest to understand? I can comment those
better. I only added a general comment at the top of the file.

> I would like some more comments on how it intends to handle the corner
> cases. The reason why gen eff is so much more complicated is because it
> generalizes all the corner cases. I must assume you do not wish to do so,
> but this should be spelled out to enable a fair comparison between the two
> approaches.
> 
> Especially comment on Spy_Resistant, effects that affect units (not unit
> effects, but eg Sun Tzu and United Nations) and Palace. I am sure Mike can
> add more problem cases to this list.

The Sun Tzu instant veteran on combat victory and the United Nations HP
regen effects can be handled with get_player_bonus(plr, eff).

This maps well with the current code, which uses
player_owns_active_wonder() for this.

The Sun Tzu combat effect check is done in maybe_make_veteran(). It
would be a simple matter of replacing the player_owns_active_wonder(plr,
B_SUNTZU) with get_player_bonus(plr, EFT_LAND_UNIT_VET_COMBAT).

For the Barracks and Suntzu effect of making all new units veteran and
HP refresh, it would be done similarly to how this code does the
Cathedrals and Michaelangelo effects.

One would replace the relevant code with: get_city_bonus(pcity,
EFT_LAND_UNIT_VETERAN) and get_city_bonus(pcity, EFT_LAND_UNIT_RECOVER).

The Palace spy resistance effect can be done with get_city_bonus() as
well, as it only affects the city the palace is in. For the City Walls
spy resistance for attacks on itself corner case, it would be necessary
to use another flag and get_city_building_bonus().

> In gen eff, defn->outside determines if a particular effect that affects
> units only works for units in cities or for all units. Example: Barracks
> only work inside cities, and a barracks-equivalent wonder should only help
> units in cities, but Sun Tzu helps all units. How would you solve this?

Suntzu is just a global Barracks for the veteran on creation and refresh
effects. It is no different from what, say, Michaelangelo does. For the
combat veteran effect, please refer to what I said above.

> I find the 'effect group' solution would rather clever, however. I am not
> sure how gen eff solves the mutual exclusion of the power plants
> buildings.



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