Skip to content

Commit 6c754a6

Browse files
committed
fix: Add parameter 'isBoundary'
- A flag to indicate it is boundary
1 parent b6f9027 commit 6c754a6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Includes/baba-is-auto/Games/Object.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class Object
4545

4646
//! Adds an object type.
4747
//! \param type An object type to add.
48-
void Add(ObjectType type);
48+
//! \param isBoundary A flag to indicate it is boundary.
49+
void Add(ObjectType type, bool isBoundary);
4950

5051
//! Removes an object type.
5152
//! \param type An object type to remove.

Sources/baba-is-auto/Games/Object.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@ bool Object::operator==(const Object& rhs) const
2323
return m_types == rhs.m_types;
2424
}
2525

26-
void Object::Add(ObjectType type)
26+
void Object::Add(ObjectType type, bool isBoundary)
2727
{
2828
if (m_types.find(type) != m_types.end())
2929
{
30-
m_types[type] += 1;
30+
if (isBoundary)
31+
{
32+
m_types[type] = 1;
33+
}
34+
else
35+
{
36+
m_types[type] += 1;
37+
}
3138
}
3239
else
3340
{

0 commit comments

Comments
 (0)