RuleHashMixin

A mixin object for IRules that allows specialized execution based on a hash key.  Some rules need the capability to be flexible for situations they have no knowledge of.  For instance, when loading a saved game from disk, the IRule has knowledge of the game’s internal State field, but no knowledge of how to actually return to that state in the View because it is plugin-specific knowledge.  By calling the ExecuteHash function with the name of the current State, a mixed-in IRule that handles that State, provided by the plugin that sets the State, can be called that returns the View to its needed on-screen representation, allowing the game to continue from exactly where it left off.

Derived From

BaseMixin

Project

RulesCore

Include

RuleHashMixin.h

Summary
A mixin object for IRules that allows specialized execution based on a hash key.
Executes the IRule whose name is stored in the hash at the given key.

Protected

Summary
Executes the IRule whose name is stored in the hash at the given key.

Functions

ExecuteHash

bool ExecuteHash(const wxString &key,
const DataObject &object)

Executes the IRule whose name is stored in the hash at the given key.  If no IRule name exists at the given hash key, the function immediately returns false and no rule is executed.  It is up to the calling IRule to determine what to do in that case.

Parameters

keyThe key of the hashed IRule to execute.
objectThe DataObject to pass to the IRule.

Returns

A bool giving whether an IRule name existed at the given key.  The value is true if a name existed, false if not.

The interface for a single game rule.
bool ExecuteHash(const wxString &key,
const DataObject &object)
Executes the IRule whose name is stored in the hash at the given key.
The base class for any IRule or ILogic mixin objects.
RulesCore is the HOSS of Cities3D.
A generic container for passing any kind of data around.