Game of Ur
0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Toggle main menu visibility
Loading...
Searching...
No Matches
house.hpp
Go to the documentation of this file.
1
11
12
#ifndef ZOAPPHOUSE_H
13
#define ZOAPPHOUSE_H
14
15
#include <memory>
16
17
#include <glm/glm.hpp>
18
19
#include "
piece.hpp
"
20
21
29
class
House
{
30
public
:
35
enum
Type
: uint8_t {
36
REGULAR,
//< A regular house, with no special rules.
37
ROSETTE,
//< A rosette house, granting its occupant special immunity, and deciding whether counters are won, lost, or neither, by the active player during GamePhase::PLAY.
38
};
39
44
enum
Region
: uint8_t {
45
BATTLEFIELD,
//< A tile that can be occupied by either player, and making up the main part of the route they compete over.
46
BLACK=RoleID::BLACK,
//< A small region only usable by the player playing black.
47
WHITE=RoleID::WHITE,
//< A small region only usable by the player playing white.
48
};
49
57
House
(glm::i8vec2 nextCell,
Type
houseType,
Region
region):
58
mNextCell
{ nextCell },
59
mType
{ houseType },
60
mRegion
{ region }
61
{}
62
72
void
move
(std::shared_ptr<Piece> gamePiece);
73
79
std::weak_ptr<Piece>
getOccupantReference
() {
return
mOccupant
; }
80
86
PieceIdentity
getOccupant
()
const
;
87
94
bool
isOccupied
()
const
{
return
!
mOccupant
.expired(); }
95
102
bool
isRosette
()
const
{
return
mType
== Type::ROSETTE; };
103
109
Region
getRegion
()
const
{
return
mRegion
; }
110
116
Type
getType
()
const
{
return
mType
; }
117
123
glm::i8vec2
getNextCellDirection
()
const
{
return
mNextCell
; }
124
146
bool
canMove
(
const
Piece
& gamePiece)
const
;
147
148
private
:
153
glm::i8vec2
mNextCell
;
154
159
Type
mType
;
160
165
Region
mRegion
;
166
171
std::weak_ptr<Piece>
mOccupant
{};
172
};
173
174
#endif
House::getNextCellDirection
glm::i8vec2 getNextCellDirection() const
Gets an integral vector pointing to the location of the next House, relative to this one.
Definition
house.hpp:123
House::mNextCell
glm::i8vec2 mNextCell
Direction to the location of the next House, relative to this one.
Definition
house.hpp:153
House::canMove
bool canMove(const Piece &gamePiece) const
Tests whether a given piece can move into this house.
Definition
house.cpp:3
House::mType
Type mType
The type of House this one is.
Definition
house.hpp:159
House::getType
Type getType() const
Gets which type of house this house is.
Definition
house.hpp:116
House::Type
Type
The type of a house.
Definition
house.hpp:35
House::Region
Region
The region this house belongs to.
Definition
house.hpp:44
House::isOccupied
bool isOccupied() const
Tests whether this house is already occupied by a game piece.
Definition
house.hpp:94
House::isRosette
bool isRosette() const
Tests whether this house is a rosette house.
Definition
house.hpp:102
House::mRegion
Region mRegion
The region in which this House lies.
Definition
house.hpp:165
House::House
House(glm::i8vec2 nextCell, Type houseType, Region region)
Constructs a new House.
Definition
house.hpp:57
House::move
void move(std::shared_ptr< Piece > gamePiece)
Validates and applies a move, replacing the reference to the currently occupying piece with a new one...
Definition
house.cpp:28
House::mOccupant
std::weak_ptr< Piece > mOccupant
The piece occupying this house, if any.
Definition
house.hpp:171
House::getOccupant
PieceIdentity getOccupant() const
Gets the identity of the piece occupying this house.
Definition
house.cpp:39
House::getRegion
Region getRegion() const
Gets the region this house belongs to.
Definition
house.hpp:109
House::getOccupantReference
std::weak_ptr< Piece > getOccupantReference()
Gets a reference to the piece already occupying this house, if any.
Definition
house.hpp:79
Piece
The state of a single piece of the game.
Definition
piece.hpp:52
piece.hpp
Contains definitions for pieces belonging to different sets used by competing players.
PieceIdentity
Data uniquely identifying a piece used in the game.
Definition
piece.hpp:29
src
app
game_of_ur_data
house.hpp
Generated on
for Game of Ur by
1.17.0