The interface of a single piece of game logic. A piece of ILogic is not used on its own, but is incorporated into an IRule that requires logic to determine what course of action to take. The ILogic class provides a generic means of implementing such a thing. It has one function, Decide, which takes an input DataObject and fills in an output DataObject with its rendered decision.
All ILogic is originally created and stored in a RuleSet within a plugin object. An ILogic within a RuleSet is stored in a string-based hash map. All ILogic has a string that is the key used to execute it. When that RuleSet is loaded into the game via the IPluginEngine, all ILogic (and IRules) 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 ILogic in all RuleSets for the game.
NOTE: An ILogic-derived class should be created and stored in a RuleSet through one of the <IMPLEMENT_LOGIC>, <IMPLEMENT_LOGIC_MIXIN>, or <IMPLEMENT_DEFAULT_BRANCH> macros in <RuleSetDatabase>.
ILogic.h
The interface of a single piece of game logic. | |
Decides based on logic. | |
The ILogic destructor. |
|
Decides based on logic. Every piece of ILogic decides output based on the given input.
| input | The DataObject with data that helps the ILogic to make its decision. |
| output | The resulting DataObject containing the output of the ILogic. It comes in as an empty object and must be created and filled by the ILogic. |
|
| virtual ~ILogic()=0 |