mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
fixed packet header bug in createVoxelEditMessage()
This commit is contained in:
parent
8a912feb32
commit
24ec0b0ddc
1 changed files with 2 additions and 2 deletions
|
@ -215,7 +215,6 @@ bool createVoxelEditMessage(unsigned char command, short int sequence,
|
||||||
|
|
||||||
bool success = true; // assume the best
|
bool success = true; // assume the best
|
||||||
int messageSize = MAXIMUM_EDIT_VOXEL_MESSAGE_SIZE; // just a guess for now
|
int messageSize = MAXIMUM_EDIT_VOXEL_MESSAGE_SIZE; // just a guess for now
|
||||||
int actualMessageSize = 3;
|
|
||||||
unsigned char* messageBuffer = new unsigned char[messageSize];
|
unsigned char* messageBuffer = new unsigned char[messageSize];
|
||||||
|
|
||||||
int numBytesPacketHeader = populateTypeAndVersion(messageBuffer, command);
|
int numBytesPacketHeader = populateTypeAndVersion(messageBuffer, command);
|
||||||
|
@ -223,6 +222,7 @@ bool createVoxelEditMessage(unsigned char command, short int sequence,
|
||||||
|
|
||||||
*sequenceAt = sequence;
|
*sequenceAt = sequence;
|
||||||
unsigned char* copyAt = &messageBuffer[numBytesPacketHeader + sizeof(sequence)];
|
unsigned char* copyAt = &messageBuffer[numBytesPacketHeader + sizeof(sequence)];
|
||||||
|
int actualMessageSize = numBytesPacketHeader + sizeof(sequence);
|
||||||
|
|
||||||
for (int i = 0; i < voxelCount && success; i++) {
|
for (int i = 0; i < voxelCount && success; i++) {
|
||||||
// get the coded voxel
|
// get the coded voxel
|
||||||
|
@ -232,7 +232,7 @@ bool createVoxelEditMessage(unsigned char command, short int sequence,
|
||||||
int lengthOfVoxelData = bytesRequiredForCodeLength(*voxelData)+SIZE_OF_COLOR_DATA;
|
int lengthOfVoxelData = bytesRequiredForCodeLength(*voxelData)+SIZE_OF_COLOR_DATA;
|
||||||
|
|
||||||
// make sure we have room to copy this voxel
|
// make sure we have room to copy this voxel
|
||||||
if (actualMessageSize+lengthOfVoxelData > MAXIMUM_EDIT_VOXEL_MESSAGE_SIZE) {
|
if (actualMessageSize + lengthOfVoxelData > MAXIMUM_EDIT_VOXEL_MESSAGE_SIZE) {
|
||||||
success = false;
|
success = false;
|
||||||
} else {
|
} else {
|
||||||
// add it to our message
|
// add it to our message
|
||||||
|
|
Loading…
Reference in a new issue