The interface for a single game rule. The class IRule is an implementation of the Command design pattern. An IRule is a piece of code that does something in the Game. What that something is is completely up to the IRule-derived object. An IRule may call other IRules from within itself, or execute ILogic to determine what course of action to take. IRules can also be extended by something derived from BaseMixin so that their behavior is pluggable, and different RuleSets can extend the functionality of exisiting IRules. An IRule may make itself undoable by implementing the IUndoable interface.
All IRules are originally created and stored in a RuleSet within a plugin object. An IRule within a RuleSet is stored in a string-based hash map. All IRules have a string that is the key used to execute them. When that RuleSet is loaded into the game via the IPluginEngine, all IRules (and ILogic) within the RuleSet are transferred from their RuleSet hash map into the into the main RuleEngine hash map, which, in the end, holds the aggregation of all IRules in all RuleSets for the game.
NOTE: An IRule-derived class should be created and stored in a RuleSet through one of the <IMPLEMENT_RULE>, <IMPLEMENT_RULE_REPLACE>, or <IMPLEMENT_RULE_MIXIN> macros in <RuleSetDatabase>.
Project
RulesCore
Include
IRule.h
Summary
| The interface for a single game rule. |
| |
| |
| |
| |
| |
| |
| |