diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-07-21 18:07:45 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-07-21 18:11:59 +0200 |
commit | f1f783877f0f8338a225244faff4e40efe10a4ce (patch) | |
tree | e071d5df7024fbc3c72713517672f217096ea47f /src/NBT/CompoundTag.hpp | |
parent | 315bb38444b8e363b4d8f2702d45d42fa585f619 (diff) | |
download | MinedMap-f1f783877f0f8338a225244faff4e40efe10a4ce.tar MinedMap-f1f783877f0f8338a225244faff4e40efe10a4ce.zip |
NBT: rework type system
Diffstat (limited to 'src/NBT/CompoundTag.hpp')
-rw-r--r-- | src/NBT/CompoundTag.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/NBT/CompoundTag.hpp b/src/NBT/CompoundTag.hpp index 310b995..68e2390 100644 --- a/src/NBT/CompoundTag.hpp +++ b/src/NBT/CompoundTag.hpp @@ -26,6 +26,7 @@ #pragma once +#include "EndTag.hpp" #include "Tag.hpp" #include <string> @@ -37,18 +38,21 @@ namespace NBT { class CompoundTag : public Tag, public std::unordered_map<std::string, std::shared_ptr<const Tag>> { public: + static const MakeType<CompoundTag> Type; + + CompoundTag(Buffer *buffer) { while (true) { std::pair<std::string, std::shared_ptr<const Tag>> v = Tag::readNamedTag(buffer); - if (v.second->getType() == Type::End) + if (v.second->getType() == EndTag::Type) break; insert(std::move(v)); } } - virtual Type getType() const { - return Type::Compound; + virtual const TagType & getType() const { + return Type; } virtual void print(std::ostream& os, const std::string &indent) const { |