From 8b88557047ad397aac14c0dd161801501f95d97a Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Mon, 2 Jan 2012 14:04:42 +0000 Subject: [PATCH] Fix missing and incorrect bitshifts preventing the correct reading of life, tmp and dcolour --- src/save.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/save.c b/src/save.c index faf53ecba..361ba8d6e 100644 --- a/src/save.c +++ b/src/save.c @@ -1028,7 +1028,7 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c if(fieldDescriptor & 0x04) { if(i >= partsDataLen) goto fail; - partsptr[newIndex].life |= partsData[i++]; + partsptr[newIndex].life |= (((unsigned)partsData[i++]) << 8); } } @@ -1041,7 +1041,7 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c if(fieldDescriptor & 0x10) { if(i >= partsDataLen) goto fail; - partsptr[newIndex].tmp |= partsData[i++]; + partsptr[newIndex].tmp |= (((unsigned)partsData[i++]) << 8); } } @@ -1056,10 +1056,10 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c if(fieldDescriptor & 0x40) { if(i+3 >= partsDataLen) goto fail; - partsptr[newIndex].dcolour = partsData[i++]; - partsptr[newIndex].dcolour |= partsData[i++]<<8; - partsptr[newIndex].dcolour |= partsData[i++]<<16; - partsptr[newIndex].dcolour |= partsData[i++]<<24; + partsptr[newIndex].dcolour = (((unsigned)partsData[i++]) << 24); + partsptr[newIndex].dcolour |= (((unsigned)partsData[i++]) << 16); + partsptr[newIndex].dcolour |= (((unsigned)partsData[i++]) << 8); + partsptr[newIndex].dcolour |= ((unsigned)partsData[i++]); } //Read vx