Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Represents a single piece. More...
#include <PiecePool.h>
Classes | |
struct | cConnector |
class | cPieceModifier |
Base class (interface) for piece modifiers. More... | |
class | cVerticalLimit |
Base class (interface) for the vertical limit of piece placement. More... | |
class | cVerticalStrategy |
Base class (interface) for strategies for placing the starting pieces vertically. More... | |
Public Types | |
typedef std::vector< cConnector > | cConnectors |
typedef std::shared_ptr< cPieceModifier > | cPieceModifierPtr |
typedef std::vector< cPieceModifierPtr > | cPieceModifiers |
typedef std::shared_ptr< cVerticalLimit > | cVerticalLimitPtr |
typedef std::shared_ptr< cVerticalStrategy > | cVerticalStrategyPtr |
Public Member Functions | |
virtual bool | CanRotateCCW (int a_NumRotations) const =0 |
Returns true if the piece can be rotated CCW the specific number of 90-degree turns. More... | |
virtual cConnectors | GetConnectors (void) const =0 |
Returns all of the available connectors that the piece has. More... | |
virtual cCuboid | GetHitBox (void) const =0 |
Returns the "hitbox" of this piece. More... | |
cPieceModifiers | GetModifiers (void) const |
virtual Vector3i | GetSize (void) const =0 |
Returns the dimensions of this piece. More... | |
int | GetStartingPieceHeight (int a_BlockX, int a_BlockZ) |
Returns the height, based on m_VerticalStrategy, for this piece when used as the starting piece. More... | |
cVerticalLimitPtr | GetVerticalLimit (void) const |
cVerticalStrategyPtr | GetVerticalStrategy (void) const |
cCuboid | RotateHitBoxToConnector (const cConnector &a_MyConnector, const Vector3i &a_ToConnectorPos, int a_NumCCWRotations) const |
Returns the hitbox after the specified number of rotations and moved so that a_MyConnector is placed at a_ToConnectorPos. More... | |
cConnector | RotateMoveConnector (const cConnector &a_Connector, int a_NumCCWRotations, int a_MoveX, int a_MoveY, int a_MoveZ) const |
Returns a copy of the connector that is rotated and then moved by the specified amounts. More... | |
cCuboid | RotateMoveHitBox (int a_NumCCWRotations, int a_MoveX, int a_MoveY, int a_MoveZ) const |
Returns the hitbox after the specified number of CCW rotations and moved by the specified amounts. More... | |
Vector3i | RotatePos (const Vector3i &a_Pos, int a_NumCCWRotations) const |
Returns a copy of the a_Pos after rotating the piece the specified number of CCW rotations. More... | |
bool | SetPieceModifiersFromString (const AString &a_Definition, bool a_LogWarnings) |
Sets the modifiers with their params in the string. More... | |
bool | SetVerticalLimitFromString (const AString &a_LimitDesc, bool a_LogWarnings) |
Sets the vertical limit based on the description string. More... | |
void | SetVerticalStrategy (cVerticalStrategyPtr a_VerticalStrategy) |
bool | SetVerticalStrategyFromString (const AString &a_StrategyDesc, bool a_LogWarnings) |
Sets the vertical strategy based on the description in the string. More... | |
virtual | ~cPiece () |
Public Attributes | |
cPieceModifiers | m_Modifiers |
The modifiers which are modifying piece's blocks. More... | |
cVerticalLimitPtr | m_VerticalLimit |
The checker that verifies each placement's vertical position. More... | |
cVerticalStrategyPtr | m_VerticalStrategy |
The strategy used for vertical placement of this piece when it is used as a starting piece. More... | |
Represents a single piece.
Can have multiple connectors of different types where other pieces can connect.
Definition at line 20 of file PiecePool.h.
typedef std::vector<cConnector> cPiece::cConnectors |
Definition at line 95 of file PiecePool.h.
typedef std::shared_ptr<cPieceModifier> cPiece::cPieceModifierPtr |
Definition at line 174 of file PiecePool.h.
typedef std::vector<cPieceModifierPtr> cPiece::cPieceModifiers |
Definition at line 176 of file PiecePool.h.
typedef std::shared_ptr<cVerticalLimit> cPiece::cVerticalLimitPtr |
Definition at line 148 of file PiecePool.h.
typedef std::shared_ptr<cVerticalStrategy> cPiece::cVerticalStrategyPtr |
Definition at line 121 of file PiecePool.h.
|
inlinevirtual |
Definition at line 24 of file PiecePool.h.
|
pure virtual |
Returns true if the piece can be rotated CCW the specific number of 90-degree turns.
Implemented in cPrefab.
|
pure virtual |
Returns all of the available connectors that the piece has.
Each connector has a (relative) position in the piece, and a type associated with it.
Implemented in cPrefab.
|
pure virtual |
Returns the "hitbox" of this piece.
A hitbox is what is compared and must not intersect other pieces' hitboxes when generating.
Implemented in cPrefab.
|
inline |
Definition at line 228 of file PiecePool.h.
|
pure virtual |
Returns the dimensions of this piece.
The dimensions cover the entire piece, there is no block that the piece generates outside of this size.
Implemented in cPrefab.
|
inline |
Returns the height, based on m_VerticalStrategy, for this piece when used as the starting piece.
If there's no strategy assigned to this piece, returns -1.
Definition at line 204 of file PiecePool.h.
|
inline |
Definition at line 223 of file PiecePool.h.
|
inline |
Definition at line 218 of file PiecePool.h.
cCuboid cPiece::RotateHitBoxToConnector | ( | const cConnector & | a_MyConnector, |
const Vector3i & | a_ToConnectorPos, | ||
int | a_NumCCWRotations | ||
) | const |
Returns the hitbox after the specified number of rotations and moved so that a_MyConnector is placed at a_ToConnectorPos.
Definition at line 152 of file PiecePool.cpp.
cPiece::cConnector cPiece::RotateMoveConnector | ( | const cConnector & | a_Connector, |
int | a_NumCCWRotations, | ||
int | a_MoveX, | ||
int | a_MoveY, | ||
int | a_MoveZ | ||
) | const |
Returns a copy of the connector that is rotated and then moved by the specified amounts.
Definition at line 107 of file PiecePool.cpp.
cCuboid cPiece::RotateMoveHitBox | ( | int | a_NumCCWRotations, |
int | a_MoveX, | ||
int | a_MoveY, | ||
int | a_MoveZ | ||
) | const |
Returns the hitbox after the specified number of CCW rotations and moved by the specified amounts.
Definition at line 168 of file PiecePool.cpp.
Returns a copy of the a_Pos after rotating the piece the specified number of CCW rotations.
Definition at line 73 of file PiecePool.cpp.
bool cPiece::SetPieceModifiersFromString | ( | const AString & | a_Definition, |
bool | a_LogWarnings | ||
) |
Sets the modifiers with their params in the string.
If a_LogWarnings is true, logs the parsing problems into the server console. Returns true if successful, false if strategy parsing failed (no strategy assigned).
Definition at line 50 of file PiecePool.cpp.
bool cPiece::SetVerticalLimitFromString | ( | const AString & | a_LimitDesc, |
bool | a_LogWarnings | ||
) |
Sets the vertical limit based on the description string.
Returns true if successful, false if limit parsing failed (no limit assigned). If a_LogWarnings is true, any problem is reported into the server console.
Definition at line 35 of file PiecePool.cpp.
|
inline |
Definition at line 213 of file PiecePool.h.
bool cPiece::SetVerticalStrategyFromString | ( | const AString & | a_StrategyDesc, |
bool | a_LogWarnings | ||
) |
Sets the vertical strategy based on the description in the string.
If a_LogWarnings is true, logs the parsing problems into the server console. Returns true if successful, false if strategy parsing failed (no strategy assigned).
Definition at line 20 of file PiecePool.cpp.
cPieceModifiers cPiece::m_Modifiers |
The modifiers which are modifying piece's blocks.
Definition at line 185 of file PiecePool.h.
cVerticalLimitPtr cPiece::m_VerticalLimit |
The checker that verifies each placement's vertical position.
Definition at line 182 of file PiecePool.h.
cVerticalStrategyPtr cPiece::m_VerticalStrategy |
The strategy used for vertical placement of this piece when it is used as a starting piece.
Definition at line 179 of file PiecePool.h.