typedef struct _depend_rule_ DependRule;
This structure is used define the requirements of upgrades or unit-types. The structure is used to define the base (the wanted) upgrade or unit-type and the requirements upgrades or unit-types. The requirements could be combination of and-rules and or-rules.
This structure is very complex because nearly everything has two meanings.
The depend-rule structure members:
Next rule in hash chain for the base upgrade/unit-type. Next and-rule for the requirements.
If DependRule::Type is DependRuleUnitType, the counter is how many units of the unit-type are required, if zero no unit of this unit-type is allowed. if DependRule::Type is DependRuleUpgrade, for a non-zero counter the upgrade must be researched, for a zero counter the upgrade must be unresearched.
Type of the rule, DependRuleUnitType for an unit-type, DependRuleUpgrade for an upgrade.
Contains the element of rule. Depending on DependRule::Type.
An unit-type pointer.
An upgrade pointer.
For the base upgrade/unit-type the rules which must be meet. For the requirements alternative or-rules.
|next hash chain, or rules |
|UnitType * UnitType|
|Upgrade * Upgrade|
|unit-type pointer |
|an unit-type or upgrade |
|required object |
|how many required |