mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-28 17:45:34 +00:00
Remove Win32 byte types from texture packets
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
TexturePacket::TexturePacket()
|
||||
{
|
||||
this->textureName = L"";
|
||||
this->dwBytes = 0;
|
||||
this->dataBytes = 0;
|
||||
this->pbData = NULL;
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ TexturePacket::~TexturePacket()
|
||||
// }
|
||||
}
|
||||
|
||||
TexturePacket::TexturePacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes)
|
||||
TexturePacket::TexturePacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
this->textureName = textureName;
|
||||
this->pbData = pbData;
|
||||
this->dwBytes = dwBytes;
|
||||
this->dataBytes = dataBytes;
|
||||
}
|
||||
|
||||
void TexturePacket::handle(PacketListener *listener)
|
||||
@@ -37,13 +37,13 @@ void TexturePacket::handle(PacketListener *listener)
|
||||
void TexturePacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
textureName = dis->readUTF();
|
||||
dwBytes = (DWORD)dis->readShort();
|
||||
dataBytes = (std::uint32_t)dis->readShort();
|
||||
|
||||
if(dwBytes>0)
|
||||
if(dataBytes>0)
|
||||
{
|
||||
this->pbData= new BYTE [dwBytes];
|
||||
this->pbData= new std::uint8_t [dataBytes];
|
||||
|
||||
for(DWORD i=0;i<dwBytes;i++)
|
||||
for(std::uint32_t i=0;i<dataBytes;i++)
|
||||
{
|
||||
this->pbData[i] = dis->readByte();
|
||||
}
|
||||
@@ -53,8 +53,8 @@ void TexturePacket::read(DataInputStream *dis) //throws IOException
|
||||
void TexturePacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeUTF(textureName);
|
||||
dos->writeShort((short)dwBytes);
|
||||
for(DWORD i=0;i<dwBytes;i++)
|
||||
dos->writeShort((short)dataBytes);
|
||||
for(std::uint32_t i=0;i<dataBytes;i++)
|
||||
{
|
||||
dos->writeByte(this->pbData[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user