baba-is-auto
C++17 Baba Is You simulator
Loading...
Searching...
No Matches
Object.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2026 Chris Ohk
2
3// I am making my contributions/submissions to this project solely in our
4// personal capacity and am not conveying any rights to any intellectual
5// property of any third parties.
6
7#ifndef BABA_IS_AUTO_NOUN_HPP
8#define BABA_IS_AUTO_NOUN_HPP
9
11
12#include <cstdint>
13#include <vector>
14
15namespace baba_is_auto
16{
17using ObjectID = std::uint64_t;
18
26{
27 ObjectID id = 0;
28 ObjectType type = ObjectType::ICON_EMPTY;
30};
31
46class Object
47{
48 public:
50 Object() = default;
51
54 explicit Object(std::vector<ObjectType> types);
55
59 bool operator==(const Object& rhs) const;
60
63 void Add(ObjectType type);
64
69 void Add(ObjectType type, Direction direction, ObjectID id);
70
73 void Add(const ObjectInstance& instance);
74
77 void Remove(ObjectType type);
78
82 bool Remove(ObjectID id);
83
86 std::vector<ObjectType> GetTypes() const;
87
90 const std::vector<ObjectInstance>& GetInstances() const;
91
96
101
105 bool HasType(ObjectType type) const;
106
109 bool HasTextType() const;
110
113 bool HasNounType() const;
114
117 bool HasVerbType() const;
118
121 bool HasPropertyType() const;
122
124 bool isRule = false;
125
126 private:
127 std::vector<ObjectInstance> m_instances;
128};
129} // namespace baba_is_auto
130
131#endif
Object class.
Definition Object.hpp:47
ObjectInstance * GetInstance(ObjectID id)
bool HasVerbType() const
bool isRule
Whether this object is part of an active rule.
Definition Object.hpp:124
Object(std::vector< ObjectType > types)
const std::vector< ObjectInstance > & GetInstances() const
bool operator==(const Object &rhs) const
void Add(ObjectType type)
bool HasPropertyType() const
void Add(const ObjectInstance &instance)
void Add(ObjectType type, Direction direction, ObjectID id)
void Remove(ObjectType type)
Object()=default
Default constructor.
bool HasNounType() const
bool HasTextType() const
bool Remove(ObjectID id)
const ObjectInstance * GetInstance(ObjectID id) const
std::vector< ObjectType > GetTypes() const
bool HasType(ObjectType type) const
Definition IAgent.hpp:14
std::uint64_t ObjectID
Definition Object.hpp:17
ObjectType
An enumerator for identifying the object.
Definition GameEnums.hpp:14
Direction
An enumerator for identifying the direction.
Definition GameEnums.hpp:142
Object instance struct.
Definition Object.hpp:26
Direction direction
Definition Object.hpp:29
ObjectType type
Definition Object.hpp:28