TileObject

Represents one hexagonally-shaped tile on the board.  The board itself is made up of an array of TileObjects.  All TileObjects have an index, a roll value (which may be -1 to indicate no roll), port corners (if the tile is a port), a port side (if the tile has a fixed orientation), a border flag (if the tile is one of the edges of the map), a tile type, and an array of integers that are the indices of other tiles that surround the tile.  A -1 along a tile’s side indicates that there is no tile bordering there (i.e., it is the edge of the map).

Other plugins may add more data fields to a tile based on their needs, by using the extensibility of the hash-map based Data class.

Derived From

Data GameObject

Project

ModelCore

Include

TileObject.h

Summary
Represents one hexagonally-shaped tile on the board.
The TileObject constructor.
Custom draw flags for a TileObject.
Returns the ChipObject that lays atop this tile.
Returns the PortObject that lays atop this tile.
Randomizes the rotation of this tile.
Creates or destroys the ChipObject for this TileObject.
Creates or destroys the PortObject for this TileObject.
Clones the TileObject.
Resets the class name of the TileObject.
Resets the display flags.
Turns a specific display flag on.
Loads a TileObject from an input stream.
Writes a TileObject to an output stream.
The ChipObject that lays atop this TileObject.
The PortObject that lays atop this TileObject.

Public

Summary
The TileObject constructor.
Custom draw flags for a TileObject.
Returns the ChipObject that lays atop this tile.
Returns the PortObject that lays atop this tile.
Randomizes the rotation of this tile.
Creates or destroys the ChipObject for this TileObject.
Creates or destroys the PortObject for this TileObject.
Clones the TileObject.
Resets the class name of the TileObject.
Resets the display flags.
Turns a specific display flag on.
Loads a TileObject from an input stream.
Writes a TileObject to an output stream.

Constructors

TileObject

TileObject(wxInt32 index = -1)

The TileObject constructor.  A TileObject should always have a valid index.

Parameters

indexThe index of this TileObject.

Enumerations

DrawFlags

Custom draw flags for a TileObject.  Available custom draw flags are: OutlineRed (outlines a tile in red)

Functions

chip

const ChipObjectPtr &chip() const

Returns the ChipObject that lays atop this tile.  May be NULL if none exists.

Returns

A const reference to a ChipObject shared_ptr.

port

const PortObjectPtr &port() const

Returns the PortObject that lays atop this tile.  May be NULL if none exists.

Returns

A const reference to a PortObject shared_ptr.

randomizeRotation

void randomizeRotation()

Randomizes the rotation of this tile.  The tile is rotated in multiples of 60 degrees.

This function must be called before the ports are calculated for the board, or else the port orientations will become improperly aligned.

createChipObject

void createChipObject(bool show)

Creates or destroys the ChipObject for this TileObject.  Only one ChipObject can exist at a time on a TileObject.

Parameters

showA flag to determine whether the ChipObject should be created or destroyed.  If true, the ChipObject should be created.  If false, destroyed.

createPortObject

void createPortObject(bool show)

Creates or destroys the PortObject for this TileObject.  Only one PortObject can exist at a time on a TileObject.

Parameters

showA flag to determine whether the PortObject should be created or destroyed.  If true, the PortObject should be created.  If false, destroyed.

Virtual Functions

Clone

virtual IGameObject *Clone()

Clones the TileObject.  Unused.

Returns

A NULL pointer.

name

virtual wxString name()

Resets the class name of the TileObject.

Returns

A const reference to a string containing the class name of the TileObject.

reset

virtual void reset()

Resets the display flags.  Also resets display flags for any ChipObject or PortObject on the tile.

set

virtual void set(const ObjectFlag flag)

Turns a specific display flag on.  Also turns the flag on for any ChipObject or PortObject on the tile.

Parameters

flagThe display flag to turn on.

load

virtual void load(wxDataInputStream &stream)

Loads a TileObject from an input stream.

Parameters

streamThe input stream.

save

virtual void save(wxDataOutputStream &stream) const

Writes a TileObject to an output stream.

Parameters

streamThe output stream.

Private

Summary
The ChipObject that lays atop this TileObject.
The PortObject that lays atop this TileObject.

Variables

mChipObject

ChipObjectPtr mChipObject

The ChipObject that lays atop this TileObject.  May be NULL.

mPortObject

PortObjectPtr mPortObject

The PortObject that lays atop this TileObject.  May be NULL.

TileObject(wxInt32 index = -1)
The TileObject constructor.
const ChipObjectPtr &chip() const
Returns the ChipObject that lays atop this tile.
const PortObjectPtr &port() const
Returns the PortObject that lays atop this tile.
void randomizeRotation()
Randomizes the rotation of this tile.
void createChipObject(bool show)
Creates or destroys the ChipObject for this TileObject.
Stores game information for a roll chip laying on top of a tile.
void createPortObject(bool show)
Creates or destroys the PortObject for this TileObject.
Stores game information for a port laying on top of a tile.
virtual IGameObject *Clone()
Clones the TileObject.
virtual wxString name()
Resets the class name of the TileObject.
virtual void reset()
Resets the display flags.
virtual void set(const ObjectFlag flag)
Turns a specific display flag on.
virtual void load(wxDataInputStream &stream)
Loads a TileObject from an input stream.
virtual void save(wxDataOutputStream &stream) const
Writes a TileObject to an output stream.
ChipObjectPtr mChipObject
The ChipObject that lays atop this TileObject.
PortObjectPtr mPortObject
The PortObject that lays atop this TileObject.
Stores data of many different kinds in string-based hash maps.
A default implementation of the IGameObject interface.
ModelCore provides all of the data classes and associated helper classes and functions required to represent a complete game.