Skip to content

Commit 099c9cd

Browse files
authored
Merge pull request fallahn#78 from QBouts/extend-property-types-with-object-type
Extended property type enum with "Object" type
2 parents b36d47d + a9f1f80 commit 099c9cd

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

tmxlite/include/tmxlite/Property.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ namespace tmx
5959
String,
6060
Colour,
6161
File,
62+
Object,
6263
Undef
6364
};
6465

@@ -104,6 +105,10 @@ namespace tmx
104105
\brief Returns the file path property as a string, relative to the map file
105106
*/
106107
const std::string& getFileValue() const { assert(m_type == Type::File); return m_stringValue; }
108+
/*!
109+
\brief Returns the property's value as an integer object handle
110+
*/
111+
int getObjectValue() const { assert(m_type == Type::Object); return m_intValue; }
107112

108113

109114
private:
@@ -119,4 +124,4 @@ namespace tmx
119124

120125
Type m_type;
121126
};
122-
}
127+
}

tmxlite/src/Property.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,10 @@ void Property::parse(const pugi::xml_node& node)
9595
m_type = Type::File;
9696
return;
9797
}
98+
else if (attribData == "object")
99+
{
100+
m_intValue = node.attribute("value").as_int(0);
101+
m_type = Type::Object;
102+
return;
103+
}
98104
}

0 commit comments

Comments
 (0)