|
TT Client Library 1.0.0
C++ library for Tandem Tales clients.
|
An entity is an asset that represents a character, object, place, or idea in a story world.
More...
#include <tt/world/Entity.h>


Public Member Functions | |
| bool | isPlayer () const |
| Returns true if this entity represents the player character in its story world. | |
| 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. | |
| std::string | toString () const override |
| Returns a string representation of this object. | |
| virtual const Entity * | toEntity () const override |
If this value represents an tt::Entity, this method returns a pointer to that entity; all other values return nullptr. | |
| virtual std::string_view | getType () const override |
| Returns the type of value (either "Entity" or "Constant"). | |
| Public Member Functions inherited from tt::Value | |
| virtual | ~Value ()=default |
| Virtual destructor so Entity and Value can have their own. | |
| virtual bool | toBool () const |
| If this value represents a Boolean, this method converts it into a bool; all other values are converted to false. | |
| virtual double | toNumber () const |
| If this value represents a number, this method convert it into a double; all other values are converted to NaN. | |
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. | |
Static Public Attributes | |
| static constexpr std::string_view | TYPE = "Entity" |
| Type identifier used for deserialization. | |
Protected Member Functions | |
| virtual bool | equals (const Value &other) const override |
| Used for polymorphic ==. | |
An entity is an asset that represents a character, object, place, or idea in a story world.
|
overrideprotectedvirtual |
Used for polymorphic ==.
| other | another value object |
Implements tt::Value.
| const std::string & tt::Entity::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::string & tt::Entity::getDescription | ( | ) | const |
Returns a human-readable natural language description of the object.
|
overridevirtual |
Returns the type of value (either "Entity" or "Constant").
Used in JSON deserialization
Reimplemented from tt::Value.
| bool tt::Entity::isPlayer | ( | ) | const |
Returns true if this entity represents the player character in its story world.
By default, the entity with ID number 0 is assumed to be the player character.
|
overridevirtual |
If this value represents an tt::Entity, this method returns a pointer to that entity; all other values return nullptr.
Reimplemented from tt::Value.
|
overridevirtual |
Returns a string representation of this object.
Reimplemented from tt::Value.