master #7

Merged
BRNSystems merged 95 commits from Mirrorlandia_minetest/minetest:master into master 2024-01-28 00:16:42 +01:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit abf3142b26 - Show all commits

@ -552,6 +552,12 @@ NetworkPacket& NetworkPacket::operator<<(video::SColor src)
Buffer<u8> NetworkPacket::oldForgePacket() Buffer<u8> NetworkPacket::oldForgePacket()
{ {
// this is the dummy packet used to first contact the server
if (m_command == 0) {
assert(m_datasize == 0);
return Buffer<u8>();
}
Buffer<u8> sb(m_datasize + 2); Buffer<u8> sb(m_datasize + 2);
writeU16(&sb[0], m_command); writeU16(&sb[0], m_command);
if (m_datasize > 0) if (m_datasize > 0)

@ -277,8 +277,8 @@ void TestConnection::testConnectSendReceive()
Simple send-receive test Simple send-receive test
*/ */
{ {
NetworkPacket pkt; NetworkPacket pkt(0x4b, 0);
pkt.putRawPacket((u8*) "Hello World !", 14, 0); pkt.putRawString("Hello World !", 14);
auto sentdata = pkt.oldForgePacket(); auto sentdata = pkt.oldForgePacket();
@ -306,9 +306,9 @@ void TestConnection::testConnectSendReceive()
*/ */
{ {
const int datasize = 30000; const int datasize = 30000;
NetworkPacket pkt(0, datasize); NetworkPacket pkt(0xff, datasize);
for (u16 i=0; i<datasize; i++) { for (u16 i=0; i<datasize; i++) {
pkt << (u8) i/4; pkt << static_cast<u8>(i/4);
} }
infostream << "Sending data (size=" << datasize << "):"; infostream << "Sending data (size=" << datasize << "):";