mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-24 23:10:47 +00:00
fix: remove byte type alias
This commit is contained in:
@@ -25,7 +25,7 @@ public:
|
||||
dis->readFully(data);
|
||||
}
|
||||
|
||||
byte getId() { return TAG_Byte_Array; }
|
||||
uint8_t getId() { return TAG_Byte_Array; }
|
||||
|
||||
wstring toString()
|
||||
{
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
class ByteTag : public Tag
|
||||
{
|
||||
public:
|
||||
byte data;
|
||||
uint8_t data;
|
||||
ByteTag(const wstring &name) : Tag(name) {}
|
||||
ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; }
|
||||
ByteTag(const wstring &name, uint8_t data) : Tag(name) {this->data = data; }
|
||||
|
||||
void write(DataOutput *dos) { dos->writeByte(data); }
|
||||
void load(DataInput *dis) { data = dis->readByte(); }
|
||||
|
||||
byte getId() { return TAG_Byte; }
|
||||
uint8_t getId() { return TAG_Byte; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
byte getId()
|
||||
uint8_t getId()
|
||||
{
|
||||
return TAG_Compound;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
tags[name] = tag->setName(wstring( name ));
|
||||
}
|
||||
|
||||
void putByte(const wchar_t * name, byte value)
|
||||
void putByte(const wchar_t * name, uint8_t value)
|
||||
{
|
||||
tags[name] = (new ByteTag(name,value));
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
|
||||
void putBoolean(const wchar_t * string, bool val)
|
||||
{
|
||||
putByte(string, val?static_cast<byte>(1):static_cast<byte>(0));
|
||||
putByte(string, val?static_cast<uint8_t>(1):static_cast<uint8_t>(0));
|
||||
}
|
||||
|
||||
Tag *get(const wchar_t *name)
|
||||
@@ -132,9 +132,9 @@ public:
|
||||
return tags.find(name) != tags.end();
|
||||
}
|
||||
|
||||
byte getByte(const wchar_t * name)
|
||||
uint8_t getByte(const wchar_t * name)
|
||||
{
|
||||
if (tags.find(name) == tags.end()) return (byte)0;
|
||||
if (tags.find(name) == tags.end()) return (uint8_t)0;
|
||||
return ((ByteTag *) tags[name])->data;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
|
||||
bool getBoolean(const wchar_t *string)
|
||||
{
|
||||
return getByte(string) != static_cast<byte>(0);
|
||||
return getByte(string) != static_cast<uint8_t>(0);
|
||||
}
|
||||
|
||||
void remove(const wstring &name)
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
void write(DataOutput *dos) { dos->writeDouble(data); }
|
||||
void load(DataInput *dis) { data = dis->readDouble(); }
|
||||
|
||||
byte getId() { return TAG_Double; }
|
||||
uint8_t getId() { return TAG_Double; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
void load(DataInput *dis) {};
|
||||
void write(DataOutput *dos) {};
|
||||
|
||||
byte getId() { return TAG_End; }
|
||||
uint8_t getId() { return TAG_End; }
|
||||
wstring toString() { return wstring( L"END" ); }
|
||||
|
||||
Tag *copy()
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
void write(DataOutput *dos) { dos->writeFloat(data); }
|
||||
void load(DataInput *dis) { data = dis->readFloat(); }
|
||||
|
||||
byte getId() { return TAG_Float; }
|
||||
uint8_t getId() { return TAG_Float; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
byte getId() { return TAG_Int_Array; }
|
||||
uint8_t getId() { return TAG_Int_Array; }
|
||||
|
||||
wstring toString()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
void write(DataOutput *dos) { dos->writeInt(data); }
|
||||
void load(DataInput *dis) { data = dis->readInt(); }
|
||||
|
||||
byte getId() { return TAG_Int; }
|
||||
uint8_t getId() { return TAG_Int; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -6,7 +6,7 @@ template <class T> class ListTag : public Tag
|
||||
{
|
||||
private:
|
||||
vector<Tag *> list;
|
||||
byte type;
|
||||
uint8_t type;
|
||||
|
||||
public:
|
||||
ListTag() : Tag(L"") {}
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
void write(DataOutput *dos)
|
||||
{
|
||||
if (list.size() > 0) type = (list[0])->getId();
|
||||
else type = static_cast<byte>(1);
|
||||
else type = static_cast<uint8_t>(1);
|
||||
|
||||
dos->writeByte(type);
|
||||
dos->writeInt((int)list.size());
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
byte getId() { return TAG_List; }
|
||||
uint8_t getId() { return TAG_List; }
|
||||
|
||||
wstring toString()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
void write(DataOutput *dos) { dos->writeLong(data); }
|
||||
void load(DataInput *dis) { data = dis->readLong(); }
|
||||
|
||||
byte getId() { return TAG_Long; }
|
||||
uint8_t getId() { return TAG_Long; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
void write(DataOutput *dos) { dos->writeShort(data); }
|
||||
void load(DataInput *dis) { data = dis->readShort(); }
|
||||
|
||||
byte getId() { return TAG_Short; }
|
||||
uint8_t getId() { return TAG_Short; }
|
||||
wstring toString()
|
||||
{
|
||||
static wchar_t buf[32];
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
data = dis->readUTF();
|
||||
}
|
||||
|
||||
byte getId() { return TAG_String; }
|
||||
uint8_t getId() { return TAG_String; }
|
||||
|
||||
wstring toString()
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ Tag *Tag::setName(const wstring& name)
|
||||
|
||||
Tag *Tag::readNamedTag(DataInput *dis)
|
||||
{
|
||||
byte type = dis->readByte();
|
||||
uint8_t type = dis->readByte();
|
||||
if ( static_cast<int>(type) == 0) return new EndTag();
|
||||
|
||||
// 4J Stu - readByte can return -1, so if it's that then also mark as the end tag
|
||||
@@ -96,7 +96,7 @@ Tag *Tag::readNamedTag(DataInput *dis)
|
||||
|
||||
Tag *tag = newTag(type, name);
|
||||
// short length = dis.readShort();
|
||||
// byte[] bytes = new byte[length];
|
||||
// byte[] bytes = new uint8_t[length];
|
||||
// dis.readFully(bytes);
|
||||
|
||||
tag->load(dis);
|
||||
@@ -116,7 +116,7 @@ void Tag::writeNamedTag(Tag *tag, DataOutput *dos)
|
||||
tag->write(dos);
|
||||
}
|
||||
|
||||
Tag *Tag::newTag(byte type, const wstring &name)
|
||||
Tag *Tag::newTag(uint8_t type, const wstring &name)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ Tag *Tag::newTag(byte type, const wstring &name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const wchar_t *Tag::getTagName(byte type)
|
||||
const wchar_t *Tag::getTagName(uint8_t type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -7,18 +7,18 @@ using namespace std;
|
||||
class Tag
|
||||
{
|
||||
public:
|
||||
static const byte TAG_End = static_cast<byte>(0);
|
||||
static const byte TAG_Byte = static_cast<byte>(1);
|
||||
static const byte TAG_Short = static_cast<byte>(2);
|
||||
static const byte TAG_Int = static_cast<byte>(3);
|
||||
static const byte TAG_Long = static_cast<byte>(4);
|
||||
static const byte TAG_Float = static_cast<byte>(5);
|
||||
static const byte TAG_Double = static_cast<byte>(6);
|
||||
static const byte TAG_Byte_Array = static_cast<byte>(7);
|
||||
static const byte TAG_String = static_cast<byte>(8);
|
||||
static const byte TAG_List = static_cast<byte>(9);
|
||||
static const byte TAG_Compound = static_cast<byte>(10);
|
||||
static const byte TAG_Int_Array = static_cast<byte>(11);
|
||||
static const uint8_t TAG_End = static_cast<uint8_t>(0);
|
||||
static const uint8_t TAG_Byte = static_cast<uint8_t>(1);
|
||||
static const uint8_t TAG_Short = static_cast<uint8_t>(2);
|
||||
static const uint8_t TAG_Int = static_cast<uint8_t>(3);
|
||||
static const uint8_t TAG_Long = static_cast<uint8_t>(4);
|
||||
static const uint8_t TAG_Float = static_cast<uint8_t>(5);
|
||||
static const uint8_t TAG_Double = static_cast<uint8_t>(6);
|
||||
static const uint8_t TAG_Byte_Array = static_cast<uint8_t>(7);
|
||||
static const uint8_t TAG_String = static_cast<uint8_t>(8);
|
||||
static const uint8_t TAG_List = static_cast<uint8_t>(9);
|
||||
static const uint8_t TAG_Compound = static_cast<uint8_t>(10);
|
||||
static const uint8_t TAG_Int_Array = static_cast<uint8_t>(11);
|
||||
|
||||
private:
|
||||
wstring name;
|
||||
@@ -30,15 +30,15 @@ public:
|
||||
virtual void write(DataOutput *dos) = 0;
|
||||
virtual void load(DataInput *dis) = 0;
|
||||
virtual wstring toString() = 0;
|
||||
virtual byte getId() = 0;
|
||||
virtual uint8_t getId() = 0;
|
||||
void print(ostream out);
|
||||
void print(char *prefix, wostream out);
|
||||
wstring getName();
|
||||
Tag *setName(const wstring& name);
|
||||
static Tag *readNamedTag(DataInput *dis);
|
||||
static void writeNamedTag(Tag *tag, DataOutput *dos);
|
||||
static Tag *newTag(byte type, const wstring &name);
|
||||
static const wchar_t *getTagName(byte type);
|
||||
static Tag *newTag(uint8_t type, const wstring &name);
|
||||
static const wchar_t *getTagName(uint8_t type);
|
||||
virtual ~Tag() {}
|
||||
virtual bool equals(Tag *obj); // 4J Brought forward from 1.2
|
||||
virtual Tag *copy() = 0; // 4J Brought foward from 1.2
|
||||
|
||||
Reference in New Issue
Block a user