Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Ben Webb via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 15 Jan 2003 11:11:21 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Jan 14, 2003 at 01:20:47PM -0800, Mike Kaufman via RT wrote:
> On Tue, Jan 14, 2003 at 03:19:42AM -0800, Ben Webb via RT wrote:
> > That seems rather counter-intuitive. Surely we have city_iterate already
> > for iterating over all cities? What if you don't want to iterate over
> > all cities? (As I've already said, there are a few places where you want
> > to consider only Player- and World- range effects.)
> then you put a particular city pointer in the init function...I don't see
> how this is counter-intuitive: if you don't want a particular city, you
> don't assign one.

No, I don't want _all_ cities, and I don't want _one_ city. I want _no_
cities. How can I get that from general effects?

Maybe my memory is failing me, but I can't think of anywhere in impr-gen
where the city iteration you describe would be needed, or useful. What's
it for?

> > Er, it's not just a single effect; you'd need to add additional effects
> > for Science_Bonus, Science_Pct, Tax_Bonus, Tax_Pct, Unit_Defend,
> > Unit_Attack, Unit_Attack_Firepower, Unit_Defend_Firepower, Unit_Recover,
> > Unit_Vet_Combat, Upgrade_One_Step, Upgrade_One_Leap, Upgrade_All_Step
> > and Upgrade_All_Leap, in the current code, and more if you add more unit
> > effect types. For example, in the default ruleset, the Unit_Recover
> > effect of United Nations works on units in the field, while the various
> > Unit_Defend effects work only on units in cities.
> After thinking about this, you may be right. Great Wall's UnitDefend effect
> I think convinces me.

That's exactly what prompted me to write the code in the first place... ;)

> > You are in a government which confers a 20% science bonus (e.g.
> > Knowledge). You have ten cities, each producing 1 science. This gives a
> > total science output of 10, plus 20% bonus, i.e. 12. A 20% bonus acting
> > on each city individually would give a per-city science output of 1.2,
> > which would be rounded down to 1, i.e. it would have no effect.
> I see: a product of integer arithmetic.

Exactly. Or a product of having an integer number of scientists in your
cities, depending on how you view the simulation, I guess! (This is
rarely an issue with Freeciv effects, since they are generally +50% or
+100%, so don't run into rounding issues very often.)

> Yes this could be a problem, but I suggest that these should be different
> effects.

Well, they could be, sure - but we've got a lot of effects already...

> > That might work, although you still have to look after destroyed buildings
> > that no longer have an owner - i.e. they belong to dead players.
> dead players are saved in savegames.

Ah, right - in that case you're fine, assuming that the dead players'
old buildings are also saved. (N.B. Your I_DESTROYED flag would be wiped
out if a destroyed building were replaced with a new one - so you'd have
to either forbid it from being rebuilt, or cancel the effects of the
destroyed building when the new building comes online.)

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"The Belle of New Orleans tried to show me once how to tango"



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