TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
tt::Turn Class Reference

A turn is one participant in a session communicating their intentions for an action to the other participant. More...

#include <tt/world/Turn.h>

Public Types

enum  Type { PROPOSE , SUCCEED , FAIL , PASS }
 The kind of turn being taken. More...

Public Member Functions

std::string toString () const
 Returns a string representation of this object.
const std::string & getDescription () const
 Returns a human-readable natural language description of the object.
const std::string & getCode () const
 Returns a string of 1's and 0's that uniquely represents this object among other objects of the same type in the same story world.
const Action * getAction () const
 Returns the action associated with this turn.

Public Attributes

Role role
 The role of the participant taking this turn.
Type type
 The kind of turn being taken.

Friends

std::ostream & operator<< (std::ostream &os, const Turn &a)
 Override stream insertion operator to allow printing the Turn class.

Detailed Description

A turn is one participant in a session communicating their intentions for an action to the other participant.

There are four types of turns:

Author
Gage Birchmeier

Member Enumeration Documentation

◆ Type

The kind of turn being taken.

Enumerator
PROPOSE 

Used when one participant wants to suggest taking an action that requires the approval of their partner.

SUCCEED 

Used when one participant agrees to take a proposed action, or when a participant can take an action that does not require approval.

FAIL 

Used to reject a proposed action.

PASS 

Used when one participant does not want to act and wants to allow their partner to act instead.

Member Function Documentation

◆ getAction()

const Action * tt::Turn::getAction ( ) const

Returns the action associated with this turn.

Returns
the action associated with this turn

◆ getCode()

const std::string & tt::Turn::getCode ( ) const

Returns a string of 1's and 0's that uniquely represents this object among other objects of the same type in the same story world.

Every encoded object of the same type should return a string of the same length, even if it must be padded with 0's.

Returns
a string of 1's and 0's

◆ getDescription()

const std::string & tt::Turn::getDescription ( ) const

Returns a human-readable natural language description of the object.

Returns
a human-readable natural language description of the object

◆ toString()

std::string tt::Turn::toString ( ) const

Returns a string representation of this object.

Returns
a string describing this object

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Turn & a )
friend

Override stream insertion operator to allow printing the Turn class.

Parameters
osan output stream to insert into
aa reference to a turn object
Returns
the output stream referenced

The documentation for this class was generated from the following files: