A repository of all things rules-related. A RuleSet is an aggregate container that can hold the many types of objects needed to run a certain set of rules in the game. A RuleSet can range in size from a single IRule for a very small variant, to dozens of IRules and ILogic, custom ImageSets, special BankData, PlayerData, or BuildData for the BankUI, PlayerUI and BuildUI, IDrawObjects, IGameObjects, and even an entire system of IRule branching logic for core game rules or an extensive variant, or anything in between. Every RuleSet must have a unique name (within its plugin object), and a flag to indicate whether an AI is required for a computer to play with the RuleSet.
The plugin rule objects (.dlls on Win32, .so files on Linux), provide the RuleSets that the core application has access to. A plugin object has its own <RuleSetDatabase> that stores all of the RuleSets until they are needed (if ever) by the core application. The PluginEngine queries all plugins that it can find and keeps record of them. Certain Maps require certain RuleSets in order to be played. The core application is responsible for ensuring that all RuleSets that a given Map needs are loaded before the game begins or continues from a saved spot. See PluginEngine, RuleEngine, and <RuleSetDatabase> for more details on how RuleSets are used throughout the game.
RuleSet.h
A repository of all things rules-related. | |
The RuleSet constructor. | |
Returns the AI flag. | |
Provides an iterator to the start of the PriorityLogicHash hash. | |
Provides an iterator to the end of the PriorityLogicHash hash. | |
Provides an iterator to the start of the IGameObject hash. | |
Provides an iterator to the end of the IGameObject set. | |
Provides an iterator to the start of the IDrawObject set. | |
Provides an iterator to the end of the IDrawObject set. | |
Provides an iterator to the start of the ImageSet list. | |
Provides an iterator to the end of the ImageSet list. | |
Provides an iterator to the start of the BankData list. | |
Provides an iterator to the end of the BankData list. | |
Provides an iterator to the start of the PlayerData list. | |
Provides an iterator to the end of the PlayerData list. | |
Provides an iterator to the start of the BuildData list. | |
Provides an iterator to the end of the BuildData list. | |
The RuleSet copy constructor. | |
Adds a piece of branch logic to the rule chain. | |
Adds an IGameObject to the RuleSet. | |
Adds an IDrawObject to the RuleSet. | |
Adds an ImageSet to the RuleSet. | |
Adds a piece of BankData to the RuleSet. | |
Adds a piece of PlayerData to the RuleSet. | |
Adds a piece of BuildData to the RuleSet. | |
The name of this RuleSet. | |
Whether this ruleset requires an AI for it to played in single player mode. | |
The hash of rule branching logic. | |
The hash of IGameObjects the RuleSet provides. | |
The std::set of IDrawObjects the RuleSet provides. | |
The std::list of ImageSets the RuleSet provides. | |
The std::list of BankData in the RuleSet. | |
The std::list of PlayerData in the RuleSet. | |
The std::list of BuildData in the RuleSet. |
The RuleSet constructor. | |
Returns the AI flag. | |
Provides an iterator to the start of the PriorityLogicHash hash. | |
Provides an iterator to the end of the PriorityLogicHash hash. | |
Provides an iterator to the start of the IGameObject hash. | |
Provides an iterator to the end of the IGameObject set. | |
Provides an iterator to the start of the IDrawObject set. | |
Provides an iterator to the end of the IDrawObject set. | |
Provides an iterator to the start of the ImageSet list. | |
Provides an iterator to the end of the ImageSet list. | |
Provides an iterator to the start of the BankData list. | |
Provides an iterator to the end of the BankData list. | |
Provides an iterator to the start of the PlayerData list. | |
Provides an iterator to the end of the PlayerData list. | |
Provides an iterator to the start of the BuildData list. | |
Provides an iterator to the end of the BuildData list. |
|
The RuleSet constructor. Sets the name and the AI flag. The AI flag indicates to the system whether or not a RuleSet needs AI written for its rules in order for the computer to play with it or not. For example, a RuleSet that simply alters the number of points the game is played to, or the number of stock cities, does not need an AI, but a RuleSet that adds a new tile type as a resource definitely needs an AI.
| name | The name of the RuleSet. Must be unique within the plugin object in which it resides. |
| needsAI | The AI flag. See above notes. |
| PriorityLogicHash::const_iterator branch_begin() const |
Provides an iterator to the start of the PriorityLogicHash hash.
A const_iterator to the start of prioritized rule branching ILogic hash.
| PriorityLogicHash::const_iterator branch_end() const |
Provides an iterator to the end of the PriorityLogicHash hash.
A const_iterator to the end of prioritized rule branching ILogic hash.
| GameObjectHash::const_iterator gameobjects_begin() const |
Provides an iterator to the start of the IGameObject hash.
A const_iterator to the start of the hash map of IGameObjects in this RuleSet.
| GameObjectHash::const_iterator gameobjects_end() const |
Provides an iterator to the end of the IGameObject set.
A const_iterator to the end of the hash map of IGameObject in this RuleSet.
| DrawObjectSet::const_iterator drawobjects_begin() const |
Provides an iterator to the start of the IDrawObject set.
A const_iterator to the start of the std::set of IDrawObjects in this RuleSet.
| DrawObjectSet::const_iterator drawobjects_end() const |
Provides an iterator to the end of the IDrawObject set.
A const_iterator to the end of the std::set of IDrawObjects in this RuleSet.
| PlayerDataList::const_iterator playerdata_begin() const |
Provides an iterator to the start of the PlayerData list.
A const_iterator to the start of the std::list of PlayerData in this RuleSet.
| PlayerDataList::const_iterator playerdata_end() const |
Provides an iterator to the end of the PlayerData list.
A const_iterator to the end of the std::list of PlayerData in this RuleSet.
The RuleSet copy constructor. | |
Adds a piece of branch logic to the rule chain. | |
Adds an IGameObject to the RuleSet. | |
Adds an IDrawObject to the RuleSet. | |
Adds an ImageSet to the RuleSet. | |
Adds a piece of BankData to the RuleSet. | |
Adds a piece of PlayerData to the RuleSet. | |
Adds a piece of BuildData to the RuleSet. | |
The name of this RuleSet. | |
Whether this ruleset requires an AI for it to played in single player mode. | |
The hash of rule branching logic. | |
The hash of IGameObjects the RuleSet provides. | |
The std::set of IDrawObjects the RuleSet provides. | |
The std::list of ImageSets the RuleSet provides. | |
The std::list of BankData in the RuleSet. | |
The std::list of PlayerData in the RuleSet. | |
The std::list of BuildData in the RuleSet. |
|
Adds a piece of branch logic to the rule chain. Branch logic is used to determine what IRule will follow after another IRule, when that kind of chaining is required. (For instance, Rule0 at the start of the game might usually go into placing settlements, but for A New World maps, it should go into placing ports.) Each piece of branch ILogic can have an associated priority number, and higher priority branch ILogic has precedence over lower numbered priority ILogic. All pieces of branch ILogic should return a wxString of the next name of the IRule to execute, or an empty string if it cannot decide with the given data.
| rule | The rule to branch after. |
| priority | The priority of this piece of branch ILogic. Higher priority numbers have precedence. |
| logic | The branch ILogic. |
|
Adds an IGameObject to the RuleSet. The IGameObjects are stored in a hash so that when loading a saved game from the disk, all IGameObjects can be instantiated correctly.
| name | The name of the IGameObject. |
| object | The IGameObject to add. |
|
Adds an IDrawObject to the RuleSet. Any IGameObject that needs to be visually represented in the scene graph must have an IDrawObject that knows how to draw it.
| object | The IDrawObject to add. |
|
Adds an ImageSet to the RuleSet. Some RuleSets might have their own bitmap data that they want to use as OpenGL textures or UI bitmaps. By providing an ImageSet, the RuleSet allows any other IDrawObjects, BankData, or PlayerData that need the images access through the ImageEngine.
| imageset | The ImageSet to add. |
|
Adds a piece of PlayerData to the RuleSet. See PlayerData for more details.
| playerdata | The PlayerData to add. |
| PriorityLogicHash mBranchHash |
The hash of rule branching logic. See RegisterBranch above for more details.
| GameObjectHash mGameObjectHash |
The hash of IGameObjects the RuleSet provides.
| DrawObjectSet mDrawObjectSet |
The std::set of IDrawObjects the RuleSet provides.
| ImageSetList mImageSetList |
The std::list of ImageSets the RuleSet provides.
| BankDataList mBankDataList |
The std::list of BankData in the RuleSet.
| PlayerDataList mPlayerDataList |
The std::list of PlayerData in the RuleSet.
| BuildDataList mBuildDataList |
The std::list of BuildData in the RuleSet.
|
| bool needsAI() const |
| PriorityLogicHash::const_iterator branch_begin() const |
| PriorityLogicHash::const_iterator branch_end() const |
| GameObjectHash::const_iterator gameobjects_begin() const |
| GameObjectHash::const_iterator gameobjects_end() const |
| DrawObjectSet::const_iterator drawobjects_begin() const |
| DrawObjectSet::const_iterator drawobjects_end() const |
| ImageSetList::const_iterator imagesets_begin() const |
| ImageSetList::const_iterator imagesets_end() const |
| BankDataList::const_iterator bankdata_begin() const |
| BankDataList::const_iterator bankdata_end() const |
| PlayerDataList::const_iterator playerdata_begin() const |
| PlayerDataList::const_iterator playerdata_end() const |
| BuildDataList::const_iterator builddata_begin() const |
| BuildDataList::const_iterator builddata_end() const |
|
|
|
|
|
|
|
| bool mNeedsAI |
| PriorityLogicHash mBranchHash |
| GameObjectHash mGameObjectHash |
| DrawObjectSet mDrawObjectSet |
| ImageSetList mImageSetList |
| BankDataList mBankDataList |
| PlayerDataList mPlayerDataList |
| BuildDataList mBuildDataList |