Work around issue 457, not fully fixed.

This commit is contained in:
Xawotihs
2010-10-09 10:37:47 +00:00
parent 7439d81454
commit 318aee5aec
+8 -1
View File
@@ -9,6 +9,7 @@
#include <JFileSystem.h> #include <JFileSystem.h>
#include "../include/GameOptions.h" #include "../include/GameOptions.h"
#include "../include/WResourceManager.h" #include "../include/WResourceManager.h"
#include <hge/hgeparticle.h>
#include <assert.h> #include <assert.h>
#ifdef WITH_FMOD #ifdef WITH_FMOD
#endif #endif
@@ -398,7 +399,13 @@ bool WCachedParticles::Attempt(string filename, int submode, int & error){
SAFE_DELETE(particles); SAFE_DELETE(particles);
particles = NEW hgeParticleSystemInfo; 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(); fileSys->CloseFile();
particles->sprite=NULL; particles->sprite=NULL;