CornerObject

A base class for objects that sit on the corners of hexes.  There are many GameObjects such as settlements, cities, knights, etc., that sit on the intersection of three hexes.  CornerObject provides a base class for them all since they share much in common.

Derived From

GameObject

Project

ModelCore

Include

CornerObject.h

Summary
A base class for objects that sit on the corners of hexes.
The CornerObject destructor.
Compares another CornerObject to this one to see if they are the same.
Returns the first tile and corner the object is on.
Returns the second tile and corner the object is on.
Returns the third tile and corner the object is on.
Returns whether the CornerObject is on the given tile and corner.
Returns the color of the object.
Sets the color of the object.
Loads a CornerObject from an input stream.
Writes a CornerObject to an output stream.
The CornerObject constructor.
The first tile/corner this object is on.
The second tile/corner this object is on.
The third tile/corner this object is on.
The color of this object.

Public

Summary
The CornerObject destructor.
Compares another CornerObject to this one to see if they are the same.
Returns the first tile and corner the object is on.
Returns the second tile and corner the object is on.
Returns the third tile and corner the object is on.
Returns whether the CornerObject is on the given tile and corner.
Returns the color of the object.
Sets the color of the object.
Loads a CornerObject from an input stream.
Writes a CornerObject to an output stream.

Destructor

~CornerObject

virtual ~CornerObject()=0

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

Operators

operator==

bool operator==(const CornerObject &object) const

Compares another CornerObject to this one to see if they are the same.  All three tile/corner combinations and the color must be equal for the objects to be the same.

Returns

A bool giving the equality of the given object.  True if the object is the same, false if not.

Functions

tile1

TileCorner tile1() const

Returns the first tile and corner the object is on.

Returns

A std::pair of the first tile and corner the object is on.

tile2

TileCorner tile2() const

Returns the second tile and corner the object is on.

Returns

A std::pair of the second tile and corner the object is on.

tile3

TileCorner tile3() const

Returns the third tile and corner the object is on.

Returns

A std::pair of the third tile and corner the object is on.

onTile

bool onTile(const TileCorner tile)

Returns whether the CornerObject is on the given tile and corner.  Checks all three values against the tile.

Returns

A bool that is whether the CornerObject is on the given tile.  The value is true if it is, false if not.

Virtual Functions

color

virtual ColorType color() const

Returns the color of the object.

Returns

The color of the object.

color

virtual void color(const ColorType color)

Sets the color of the object.

Parameters

colorThe new color of the object.

load

virtual void load(wxDataInputStream &stream)

Loads a CornerObject from an input stream.

Parameters

streamThe input stream.

save

virtual void save(wxDataOutputStream &stream) const

Writes a CornerObject to an output stream.

Parameters

streamThe output stream.

Protected

Summary
The CornerObject constructor.

Constructor

CornerObject

CornerObject(const ColorType color,
const GamePtr &game,
const wxInt32 tile,
const wxInt32 corner,
const Vector &initial)

The CornerObject constructor.  Finds the neighboring tiles from the given tile and sets the coordinates for the object based on the tile and corner.

Parameters

colorThe color of this object.  Should be some player’s color.
gameThe current Game object.
tileThe tile the object is on.
cornerThe corner on the tile the object is on.  From 0 to 5 inclusive.
initialAny initial location if this is a generic object.

Private

Summary
The first tile/corner this object is on.
The second tile/corner this object is on.
The third tile/corner this object is on.
The color of this object.

Variables

mTile1

TileCorner mTile1

The first tile/corner this object is on.

mTile2

TileCorner mTile2

The second tile/corner this object is on.

mTile3

TileCorner mTile3

The third tile/corner this object is on.

mColor

ColorType mColor

The color of this object.

virtual ~CornerObject()=0
The CornerObject destructor.
bool operator==(const CornerObject &object) const
Compares another CornerObject to this one to see if they are the same.
TileCorner tile1() const
Returns the first tile and corner the object is on.
TileCorner tile2() const
Returns the second tile and corner the object is on.
TileCorner tile3() const
Returns the third tile and corner the object is on.
bool onTile(const TileCorner tile)
Returns whether the CornerObject is on the given tile and corner.
virtual ColorType color() const
Returns the color of the object.
virtual void load(wxDataInputStream &stream)
Loads a CornerObject from an input stream.
virtual void save(wxDataOutputStream &stream) const
Writes a CornerObject to an output stream.
CornerObject(const ColorType color,
const GamePtr &game,
const wxInt32 tile,
const wxInt32 corner,
const Vector &initial)
The CornerObject constructor.
TileCorner mTile1
The first tile/corner this object is on.
TileCorner mTile2
The second tile/corner this object is on.
TileCorner mTile3
The third tile/corner this object is on.
ColorType mColor
The color of this object.
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.
Still volatile.