baba-is-auto
C++17 Baba Is You simulator
Loading...
Searching...
No Matches
baba_is_auto::Object Class Reference

Object class. More...

#include <Object.hpp>

Public Member Functions

 Object ()=default
 Default constructor.
 
 Object (std::vector< ObjectType > types)
 
bool operator== (const Object &rhs) const
 
void Add (ObjectType type)
 
void Add (ObjectType type, Direction direction, ObjectID id)
 
void Add (const ObjectInstance &instance)
 
void Remove (ObjectType type)
 
bool Remove (ObjectID id)
 
std::vector< ObjectTypeGetTypes () const
 
const std::vector< ObjectInstance > & GetInstances () const
 
ObjectInstanceGetInstance (ObjectID id)
 
const ObjectInstanceGetInstance (ObjectID id) const
 
bool HasType (ObjectType type) const
 
bool HasTextType () const
 
bool HasNounType () const
 
bool HasVerbType () const
 
bool HasPropertyType () const
 

Public Attributes

bool isRule = false
 Whether this object is part of an active rule.
 

Detailed Description

Object class.

This class represents objects such as nouns, operators, and properties. A noun is a word that corresponds to any possible in-game sprite. A few nouns like STAR have multiple corresponding sprites, while VIOLET and FLOWER words have the same corresponding sprites. A noun can be used as a NOUN IS VERB statement e.g. BABA IS YOU to give it a property or as a NOUN IS NOUN statement e.g. WALL IS WATER to turn an object into another object. An operator is a word that goes in between properties and nouns to show the relation between them. A property is something that can be attached to noun words to alter their behavior.

Constructor & Destructor Documentation

◆ Object() [1/2]

baba_is_auto::Object::Object ( )
default

Default constructor.

◆ Object() [2/2]

baba_is_auto::Object::Object ( std::vector< ObjectType types)
explicit

Constructs an object.

Parameters
typesA list of object types.

Member Function Documentation

◆ Add() [1/3]

void baba_is_auto::Object::Add ( const ObjectInstance instance)

Adds an existing object instance.

Parameters
instanceThe instance to add.

◆ Add() [2/3]

void baba_is_auto::Object::Add ( ObjectType  type)

Adds an object type.

Parameters
typeAn object type to add.

◆ Add() [3/3]

void baba_is_auto::Object::Add ( ObjectType  type,
Direction  direction,
ObjectID  id 
)

Adds an object instance.

Parameters
typeAn object type to add.
directionThe direction the object faces.
idThe stable map object ID, or zero outside a map.

◆ GetInstance() [1/2]

ObjectInstance * baba_is_auto::Object::GetInstance ( ObjectID  id)

Gets a writable object instance by ID.

Parameters
idThe stable map object ID.
Returns
The instance, or nullptr when it is absent.

◆ GetInstance() [2/2]

const ObjectInstance * baba_is_auto::Object::GetInstance ( ObjectID  id) const

Gets an object instance by ID.

Parameters
idThe stable map object ID.
Returns
The instance, or nullptr when it is absent.

◆ GetInstances()

const std::vector< ObjectInstance > & baba_is_auto::Object::GetInstances ( ) const

Gets the object instances in insertion order.

Returns
The object instances.

◆ GetTypes()

std::vector< ObjectType > baba_is_auto::Object::GetTypes ( ) const

Gets a list of object types, including duplicate stacked objects.

Returns
A list of object types.

◆ HasNounType()

bool baba_is_auto::Object::HasNounType ( ) const

Checks the object has noun type.

Returns
The flag indicates that the object has noun type.

◆ HasPropertyType()

bool baba_is_auto::Object::HasPropertyType ( ) const

Checks the object has property type.

Returns
The flag indicates that the object has property type.

◆ HasTextType()

bool baba_is_auto::Object::HasTextType ( ) const

Checks the object has text type.

Returns
The flag indicates that the object has text type.

◆ HasType()

bool baba_is_auto::Object::HasType ( ObjectType  type) const

Checks the object has specific type.

Parameters
typeAn object type to check.
Returns
The flag indicates that the object has specific type.

◆ HasVerbType()

bool baba_is_auto::Object::HasVerbType ( ) const

Checks the object has verb type.

Returns
The flag indicates that the object has verb type.

◆ operator==()

bool baba_is_auto::Object::operator== ( const Object rhs) const

Operator overloading for ==.

Parameters
rhsA right side of Object object.
Returns
The value that indicates two objects are equal.

◆ Remove() [1/2]

bool baba_is_auto::Object::Remove ( ObjectID  id)

Removes the object with the given stable ID.

Parameters
idThe stable map object ID.
Returns
Whether an object was removed.

◆ Remove() [2/2]

void baba_is_auto::Object::Remove ( ObjectType  type)

Removes an object type.

Parameters
typeAn object type to remove.

Member Data Documentation

◆ isRule

bool baba_is_auto::Object::isRule = false

Whether this object is part of an active rule.


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