|
TT Client Library 1.0.0
C++ library for Tandem Tales clients.
|
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. | |
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.
| 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.
| role | the role in question |
| 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.
| 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.
| const std::string & tt::Action::getDescription | ( | ) | const |
Returns a human-readable natural language description of the object.
| const Signature * tt::Action::getSignature | ( | ) | const |
Returns the signature of this object.
| const std::string & tt::Action::toString | ( | ) | const |
Returns a string representation of this object.
|
friend |
Override stream insertion operator to allow printing the Action class.
| os | an output stream to insert into |
| a | a reference to an action object |