diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index a671cc0d8..d8d07f091 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -2235,7 +2235,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet // so that it can send it out to them when it comes in - if(packet->dwBytes==0) + if(packet->dataBytes==0) { // Request for texture #ifndef _CONTENT_PACKAGE @@ -2256,7 +2256,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Client received custom texture %ls\n",packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); + app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived(packet->textureName); } } diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 76c71433c..636ea6560 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -796,7 +796,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way - if(packet->dwBytes==0) + if(packet->dataBytes==0) { // Request for texture #ifndef _CONTENT_PACKAGE @@ -821,7 +821,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Server received custom texture %ls\n",packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); + app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } } @@ -1714,4 +1714,4 @@ bool PlayerConnection::isGuest() } return isGuest; } -} \ No newline at end of file +} diff --git a/Minecraft.World/Network/Packets/TexturePacket.cpp b/Minecraft.World/Network/Packets/TexturePacket.cpp index 09b2bd9cf..bb179a8e5 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.cpp +++ b/Minecraft.World/Network/Packets/TexturePacket.cpp @@ -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;ipbData[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;iwriteShort((short)dataBytes); + for(std::uint32_t i=0;iwriteByte(this->pbData[i]); } diff --git a/Minecraft.World/Network/Packets/TexturePacket.h b/Minecraft.World/Network/Packets/TexturePacket.h index d4e199019..dfa5bd70f 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.h +++ b/Minecraft.World/Network/Packets/TexturePacket.h @@ -1,5 +1,5 @@ #pragma once - +#include #include "Packet.h" @@ -7,12 +7,12 @@ class TexturePacket : public Packet, public std::enable_shared_from_this create() { return std::shared_ptr(new TexturePacket()); } virtual int getId() { return 154; } -}; \ No newline at end of file +};