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

View File

@@ -9,6 +9,7 @@
#include <JFileSystem.h>
#include "../include/GameOptions.h"
#include "../include/WResourceManager.h"
#include <hge/hgeparticle.h>
#include <assert.h>
#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;