gpg:: TurnBasedMatch
#include <turn_based_match.h>
A data structure containing data about the current state of a TurnBasedMatch
.
Summary
Constructors and Destructors |
|
---|---|
TurnBasedMatch()
|
|
TurnBasedMatch(std::shared_ptr< const TurnBasedMatchImpl > impl)
|
|
TurnBasedMatch(const TurnBasedMatch & copy_from)
Creates a copy of an existing
TurnBasedMatch . |
|
TurnBasedMatch(TurnBasedMatch && move_from)
Moves an existing
TurnBasedMatch . |
Public functions |
|
---|---|
AutomatchingSlotsAvailable() const
|
uint32_t
Returns the number of available auto-matching slots for the match.
|
CreatingParticipant() const
|
Returns the participant who created this match.
|
CreationTime() const
|
std::chrono::milliseconds
Returns the time at which this
TurnBasedMatch was created (expressed as milliseconds since the Unix epoch). |
Data() const
|
const std::vector< uint8_t > &
Returns the match data, if
HasData() is true. |
Description() const
|
const std::string &
Returns a server-generated summary of the state of the match.
|
HasData() const
|
bool
True if this object has data that were set during a previous turn.
|
HasPreviousMatchData() const
|
bool
True if this is the first turn of a rematch, and data from the previous Valid must return true for this function to be usable.
|
HasRematchId() const
|
bool
Returns true if this match has been rematched.
|
Id() const
|
const std::string &
Returns an ID that uniquely identifies this
TurnBasedMatch . |
LastUpdateTime() const
|
Returns the time at which this
TurnBasedMatch was last updated (expressed as milliseconds since the Unix epoch). |
LastUpdatingParticipant() const
|
Returns the participant who most recently updated this match.
|
Number() const
|
uint32_t
A number indicating how many matches preceded this one via rematching.
|
ParticipantResults() const
|
const gpg::ParticipantResults &
Returns the results for the match.
|
Participants() const
|
const std::vector< MultiplayerParticipant > &
A vector of all participants in this match.
|
PendingParticipant() const
|
Returns the participant whose turn it is to update this match.
|
PreviousMatchData() const
|
const std::vector< uint8_t > &
Data from the previous match, if HasPreviousMatchData().
|
RematchId() const
|
const std::string &
Returns the ID of the match which is a rematch of this match, if available.
|
Status() const
|
Returns the status of the match for the local participant.
|
SuggestedNextParticipant() const
|
A helper function which picks a valid participant from the set of joined, invitable, and auto-matching participants.
|
Valid() const
|
bool
Returns true if this
TurnBasedMatch is populated with data. |
Variant() const
|
uint32_t
Returns a game-specific variant identifier that can be used by a game to identify different game modes.
|
Version() const
|
uint32_t
A strictly incrementing ID, updated each time a match is modified.
|
operator=(const TurnBasedMatch & copy_from)
|
Assigns this
TurnBasedMatch by copying from another one. |
operator=(TurnBasedMatch && move_from)
|
Assigns this
TurnBasedMatch by moving another one into it. |
Public functions
AutomatchingSlotsAvailable
uint32_t AutomatchingSlotsAvailable() const
Returns the number of available auto-matching slots for the match.
This number is equal to the number of auto-matching slots with which the match was created, minus the number of participants who have already been added via auto-matching. Valid must return true for this function to be usable.
CreatingParticipant
MultiplayerParticipant CreatingParticipant() const
Returns the participant who created this match.
Valid must return true for this function to be usable.
CreationTime
std::chrono::milliseconds CreationTime() const
Returns the time at which this TurnBasedMatch was created
(expressed as milliseconds since the Unix epoch).
Valid must return true for this function to be usable.
Data
const std::vector< uint8_t > & Data() const
Description
const std::string & Description() const
Returns a server-generated summary of the state of the match.
Valid must return true for this function to be usable.
HasData
bool HasData() const
True if this object has data that were set during a previous turn.
Valid must return true for this function to be usable.
HasPreviousMatchData
bool HasPreviousMatchData() const
True if this is the first turn of a rematch, and data from the previous Valid must return true for this function to be usable.
HasRematchId
bool HasRematchId() const
Returns true if this match has been rematched.
Id
const std::string & Id() const
Returns an ID that uniquely identifies this TurnBasedMatch
.
Use with TurnBasedMultiplayerManager::FetchMatch
to retrieve this match at a later point. Valid must return true for this function to be usable.
LastUpdateTime
Timestamp LastUpdateTime() const
Returns the time at which this TurnBasedMatch
was last updated (expressed as milliseconds since the Unix epoch).
Valid must return true for this function to be usable.
LastUpdatingParticipant
MultiplayerParticipant LastUpdatingParticipant() const
Returns the participant who most recently updated this match.
Valid must return true for this function to be usable.
Number
uint32_t Number() const
A number indicating how many matches preceded this one via rematching.
Is set to 1 on the first match, and incremented by one on each rematch.
ParticipantResults
const gpg::ParticipantResults & ParticipantResults() const
Returns the results for the match.
Results can be set via TurnBasedMultiplayerManager::TakeMyTurn
, TurnBasedMultiplayerManager::FinishDuringMyTurn
, and other related functions. Always use ParticipantResults().WithResult(...)
to create a new ParticipantResults
object consistent with any existing ones. Valid must return true for this function to be usable.
Participants
const std::vector< MultiplayerParticipant > & Participants() const
A vector of all participants in this match.
Valid must return true for this function to be usable.
PendingParticipant
MultiplayerParticipant PendingParticipant() const
Returns the participant whose turn it is to update this match.
Valid must return true for this function to be usable.
PreviousMatchData
const std::vector< uint8_t > & PreviousMatchData() const
Data from the previous match, if HasPreviousMatchData().
Can only be called if Valid returns true.
RematchId
const std::string & RematchId() const
Returns the ID of the match which is a rematch of this match, if available.
Status
MatchStatus Status() const
Returns the status of the match for the local participant.
The status determines which actions can be taken on the match. Valid must return true for this function to be usable.
SuggestedNextParticipant
MultiplayerParticipant SuggestedNextParticipant() const
A helper function which picks a valid participant from the set of joined, invitable, and auto-matching participants.
If this function is always used to select the next participant, play will proceed through all participants in order, repeating if necessary. This function must only be called if Status() is MatchStatus::MY_TURN, as this is the only time that the result of this function can be meaningfully used. If called incorrectly, this function will return an invalid participant (MultiplayerParticipant::Valid() == false
).
TurnBasedMatch
TurnBasedMatch()
TurnBasedMatch
TurnBasedMatch( std::shared_ptr< const TurnBasedMatchImpl > impl )
Constructs a TurnBasedMatch
from a shared_ptr
to a TurnBasedMatchImpl
.
Intended for internal use by the API.
TurnBasedMatch
TurnBasedMatch( const TurnBasedMatch & copy_from )
Creates a copy of an existing TurnBasedMatch
.
Valid
bool Valid() const
Returns true if this TurnBasedMatch
is populated with data.
Must return true for the getter functions on the TurnBasedMatch
object (Id
, CreationTime
, etc...) to be usable.
Variant
uint32_t Variant() const
Returns a game-specific variant identifier that can be used by a game to identify different game modes.
Valid must return true for this function to be usable.
Version
uint32_t Version() const
A strictly incrementing ID, updated each time a match is modified.
operator=
TurnBasedMatch & operator=( const TurnBasedMatch & copy_from )
Assigns this TurnBasedMatch
by copying from another one.
operator=
TurnBasedMatch & operator=( TurnBasedMatch && move_from )
Assigns this TurnBasedMatch
by moving another one into it.