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

An action is a signed asset that causes a change in a story world's state. More...

#include <tt/world/Action.h>

Public Member Functions

 Action ()
 Constructs a new blank action.
const std::unordered_set< const Entity * > & getConsenting () const
 Returns an unmodifiable set of entities in the story world representing the characters who need to agree to take the action.
bool consents (Role role) const
 Returns true if the given story role controls one or more of the consenting characters for this action.
const 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 Signature * getSignature () const
 Returns the signature of this object.

Public Attributes

int id
 This asset's ID number, which is unique among other assets of the same type.
std::string name
 This asset's name, which is unique among other assets of the same type.

Friends

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

Detailed Description

An action is a signed asset that causes a change in a story world's state.

The agents in a session negotiate when actions happen via turns.

Author
Gage Birchmeier

Member Function Documentation

◆ consents()

bool tt::Action::consents ( Role role) const

Returns true if the given story role controls one or more of the consenting characters for this action.

An action with no consenting character requires on the consent of the game master. An action whose only consenting character is the player character requires only the consent of the player. All other actions require the consent of both roles.

Parameters
rolethe role in question
Returns
true if the given role needs to consent to take this action

◆ getCode()

const std::string & tt::Action::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

◆ getConsenting()

const std::unordered_set< const Entity * > & tt::Action::getConsenting ( ) const

Returns an unmodifiable set of entities in the story world representing the characters who need to agree to take the action.

An action with no consenting characters represents an accident or happening that can occur and time it is convenient for the story. An action with one consenting character means it is taken by a single character. An action with two or more consenting characters means it is a joint action taken by many characters who all need to have a reason to do it. Note that a character can be involved in an action without being a consenting character if the action represents something that happens to the character against their will.

Returns
the action's set of consenting characters

◆ getDescription()

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

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

Returns
a human-readable natural language description of the object

◆ getSignature()

const Signature * tt::Action::getSignature ( ) const

Returns the signature of this object.

Returns
a pointer to the signature of this Action.

◆ toString()

const std::string & tt::Action::toString ( ) const

Returns a string representation of this object.

Returns
a string describing this object

◆ operator<<

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

Override stream insertion operator to allow printing the Action class.

Parameters
osan output stream to insert into
aa reference to an action object
Returns
the output stream referenced

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