This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
43 lines
706 B
C++
43 lines
706 B
C++
#pragma once
|
|
#include "Tag.h"
|
|
|
|
class StringTag : public Tag
|
|
{
|
|
public:
|
|
wstring data;
|
|
StringTag(const wstring &name) : Tag(name) {}
|
|
StringTag(const wstring &name, const wstring& data) : Tag(name) {this->data = data; }
|
|
|
|
void write(DataOutput *dos)
|
|
{
|
|
dos->writeUTF(data);
|
|
}
|
|
|
|
void load(DataInput *dis, int tagDepth)
|
|
{
|
|
data = dis->readUTF();
|
|
}
|
|
|
|
byte getId() { return TAG_String; }
|
|
|
|
wstring toString()
|
|
{
|
|
return data;
|
|
}
|
|
|
|
Tag *copy()
|
|
{
|
|
return new StringTag(getName(), data);
|
|
}
|
|
|
|
bool equals(Tag *obj)
|
|
{
|
|
if (Tag::equals(obj))
|
|
{
|
|
StringTag *o = (StringTag *) obj;
|
|
return ((data.empty() && o->data.empty()) || (!data.empty() && data.compare(o->data) == 0));
|
|
}
|
|
return false;
|
|
}
|
|
};
|