From 4e4bd9a11bf45370adbb0dbb510ef4eca3ecf188 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 11 Jun 2013 00:24:55 +0100 Subject: [PATCH] Signed integers can be negative, so prop>x does not always correctly indicate whether higher bytes are used --- src/client/GameSave.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 265ff27b1..2a7c9964b 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -1820,7 +1820,7 @@ char * GameSave::serialiseOPS(int & dataLength) { fieldDesc |= 1 << 1; partsData[partsDataLen++] = particles[i].life; - if(particles[i].life > 255) + if(particles[i].life & 0xFF00) { fieldDesc |= 1 << 2; partsData[partsDataLen++] = particles[i].life >> 8; @@ -1832,11 +1832,11 @@ char * GameSave::serialiseOPS(int & dataLength) { fieldDesc |= 1 << 3; partsData[partsDataLen++] = particles[i].tmp; - if(particles[i].tmp > 255) + if(particles[i].tmp & 0xFFFFFF00) { fieldDesc |= 1 << 4; partsData[partsDataLen++] = particles[i].tmp >> 8; - if(particles[i].tmp > 65535) + if(particles[i].tmp & 0xFFFF0000) { fieldDesc |= 1 << 12; partsData[partsDataLen++] = (particles[i].tmp&0xFF000000)>>24; @@ -1850,7 +1850,7 @@ char * GameSave::serialiseOPS(int & dataLength) { fieldDesc |= 1 << 5; partsData[partsDataLen++] = particles[i].ctype; - if(particles[i].ctype > 255) + if(particles[i].ctype & 0xFFFFFF00) { fieldDesc |= 1 << 9; partsData[partsDataLen++] = (particles[i].ctype&0xFF000000)>>24; @@ -1894,7 +1894,7 @@ char * GameSave::serialiseOPS(int & dataLength) { fieldDesc |= 1 << 10; partsData[partsDataLen++] = particles[i].tmp2; - if(particles[i].tmp2 > 255) + if(particles[i].tmp2 & 0xFF00) { fieldDesc |= 1 << 11; partsData[partsDataLen++] = particles[i].tmp2 >> 8;