SelectionObject

The base class for all selection-related IGameObjects.  Whenever an IRule requires that the user provide input to continue, for instance, when selecting a location for a settlement or road, it must pass a SelectionObject up to the View via the eventSelectionObject Event in the Controller.  The SelectionObject provides a rule name and color for any special selection drawing.  The rule name is the next IRule to execute when the user makes a valid selection.  When an object (or whatever) is selected in the View, it queries the SelectionObject for the name of its IRule, then calls the IRuleEngine with that IRule name, passing the ID of whatever object was selected as the DataObject.  The IRule then proceeds with the given information.

In this way, the View knows nothing at all about the specifics of object selection.  It simply reports the ID of any IGameObject selected to the IRule stored in the SelectionObject.

Derived From

GameObject

Project

RulesCore

Include

SelectionObject.h

Summary
The base class for all selection-related IGameObjects.
Returns the name of the IRule to call when an object is selected.
Returns the color any special selection drawing should be done in.
The SelectionObject constructor.
The SelectionObject destructor.
The name of the IRule that should be called with the selection ID once something has been selected.
The color that the selection objects should be drawn in.

Public

Summary
Returns the name of the IRule to call when an object is selected.
Returns the color any special selection drawing should be done in.

Functions

rule

const wxString &rule()

Returns the name of the IRule to call when an object is selected.

Returns

The name of the IRule to call.

color

ColorType color()

Returns the color any special selection drawing should be done in.

Returns

The color for special selection drawing.

Protected

Summary
The SelectionObject constructor.
The SelectionObject destructor.

Constructors

SelectionObject

SelectionObject(const wxString &rule,
const ColorType color) : mRule(rule), mColor(color)

The SelectionObject constructor.  Stores the given rule name and color.

Parameters

ruleThe name of the IRule to execute when an object is selected.
colorThe color any selection drawing should be done in.

Destructor

~SelectionObject

virtual ~SelectionObject()=0

The SelectionObject destructor.  It is pure virtual because this class must be derived from in order to be used.

Private

Summary
The name of the IRule that should be called with the selection ID once something has been selected.
The color that the selection objects should be drawn in.

Variables

mRule

wxString mRule

The name of the IRule that should be called with the selection ID once something has been selected.

mColor

ColorType mColor

The color that the selection objects should be drawn in.

An interface for all game objects.
const wxString &rule()
Returns the name of the IRule to call when an object is selected.
The interface for a single game rule.
ColorType color()
Returns the color any special selection drawing should be done in.
SelectionObject(const wxString &rule,
const ColorType color) : mRule(rule), mColor(color)
The SelectionObject constructor.
virtual ~SelectionObject()=0
The SelectionObject destructor.
wxString mRule
The name of the IRule that should be called with the selection ID once something has been selected.
ColorType mColor
The color that the selection objects should be drawn in.
A generic implementation of the Observer design pattern.
The communication mechanism between the View and the Model.
The interface for the rule engine.
A generic container for passing any kind of data around.
A default implementation of the IGameObject interface.
RulesCore is the HOSS of Cities3D.