diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index db4fecd09..8af8072da 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -9,6 +9,7 @@ #include #include "../include/GameOptions.h" #include "../include/WResourceManager.h" +#include #include #ifdef WITH_FMOD #endif @@ -398,7 +399,13 @@ bool WCachedParticles::Attempt(string filename, int submode, int & error){ SAFE_DELETE(particles); particles = NEW hgeParticleSystemInfo; - fileSys->ReadFile(particles, sizeof(hgeParticleSystemInfo)); + // We Skip reading the pointer as it may be larger than 4 bytes in the structure + void *dummyPointer; + fileSys->ReadFile(&dummyPointer, 4); + // we're actually trying to read more than the file size now, but it's no problem. + // Note that this fix is only to avoid the largest problems, filling a structure + // by directly reading a file, is really a bad idea ... + fileSys->ReadFile(&(particles->nEmission), sizeof(hgeParticleSystemInfo)); fileSys->CloseFile(); particles->sprite=NULL;