Follow-up Comment #2, patch #4004 (project freeciv):
A suggested approach. It separates the concept "action" from the concept
"action enabler". An action is something a player can do. Examples of actions
include building a road, building a rail road and inciting a city to revolt.
It may be random if it will cause the desired result. It may cost something
like movement points. It may have a text for menu entries, a shortcut on the
keyboard and graphics for a graphical button (for the SDL-client). An action
enabler makes it legal for a player to do the enabled action. An example of an
action enabler is the effect Irrig_Possible.
Currently actions are hard coded (like "Poison well") or generated from
information in the rule set (like "Build Road"). Some action enablers are
effects (like Irrig_Possible), some are parts of other definitions (like an
extra's requirement vector) and some are hard coded (like the requirement that
one must be at war to poison a well).
It is not realistic to add an action enabler effect for building each extra.
Generalized action enablers do the same job. Generalized action enablers also
solve the current issue of road/river/bridge and will remove the need for
effects to enable some extras. Actions could be made impossible by not
defining any enablers for them. Generalized actions, should they be added,
will need something like generalized action enablers to avoid having to
implement the same action twice from different requirements and hoping they
both won't be active at the same time. Thinking about generalized actions can
be delayed until someone tries to add stuff like cost, menu text, keyboard
shortcuts or risk of creating a diplomatic incident to action enablers.
A generalized action enabler has the action it enables and a requirement
vector. Requirements that can't be expressed in an action enabler's
requirement vector will still apply but not move to the action enabler. They
will be tested for if the requirement vector is active. I think spy actions
are a nice place to start so I'll use them as an example. In the beginning
only the unit flag requirements would live in the generalized action enablers.
If it becomes possible to require a war between two players (for example by
adding a local range to the diplrel requirement type of patch 4051) that
requirement will move to the generalized action enabler as well. But until
that is done (and someone remove the war requirement from the enabler)
poisoning the well of an ally will still be impossible.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list