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.
SelectionObject.h
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. |
|
The SelectionObject constructor. Stores the given rule name and color.
| rule | The name of the IRule to execute when an object is selected. |
| color | The color any selection drawing should be done in. |
| wxString mRule |
The name of the IRule that should be called with the selection ID once something has been selected.
| const wxString &rule() |
| ColorType color() |
|
| virtual ~SelectionObject()=0 |
| wxString mRule |
| ColorType mColor |