mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +02:00
hopefully fix for tileset particle related crash in windows; particles must be removed from objects before the particle manager is cleared
This commit is contained in:
@@ -52,19 +52,31 @@ Object::Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos) {
|
|||||||
|
|
||||||
Object::~Object(){
|
Object::~Object(){
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
renderer.removeObjectFromQuadCache(this);
|
|
||||||
if(stateCallback) {
|
|
||||||
stateCallback->removingObjectEvent(this);
|
|
||||||
//renderer.getGame()->getGui()->removeObject(this);
|
|
||||||
}
|
|
||||||
// fade(and by this remove) all unit particle systems
|
// fade(and by this remove) all unit particle systems
|
||||||
while(unitParticleSystems.empty() == false) {
|
while(unitParticleSystems.empty() == false) {
|
||||||
unitParticleSystems.back()->fade();
|
unitParticleSystems.back()->fade();
|
||||||
unitParticleSystems.pop_back();
|
unitParticleSystems.pop_back();
|
||||||
}
|
}
|
||||||
|
renderer.removeObjectFromQuadCache(this);
|
||||||
|
if(stateCallback) {
|
||||||
|
stateCallback->removingObjectEvent(this);
|
||||||
|
//renderer.getGame()->getGui()->removeObject(this);
|
||||||
|
}
|
||||||
delete resource;
|
delete resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Object::end(){
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
//Logger::getInstance().add("Object", true);
|
||||||
|
// set Objects to fading and remove them from list.
|
||||||
|
// its needed because otherwise they will be accessed from the destructor
|
||||||
|
while(unitParticleSystems.empty() == false) {
|
||||||
|
unitParticleSystems.back()->fade();
|
||||||
|
unitParticleSystems.pop_back();
|
||||||
|
}
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
void Object::initParticles(){
|
void Object::initParticles(){
|
||||||
if(this->objectType==NULL) return;
|
if(this->objectType==NULL) return;
|
||||||
if(this->objectType->hasParticles()){
|
if(this->objectType->hasParticles()){
|
||||||
|
@@ -61,6 +61,7 @@ public:
|
|||||||
Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos);
|
Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos);
|
||||||
~Object();
|
~Object();
|
||||||
|
|
||||||
|
void end(); //to kill particles
|
||||||
void initParticles();
|
void initParticles();
|
||||||
static void setStateCallback(ObjectStateInterface *value) { stateCallback=value; }
|
static void setStateCallback(ObjectStateInterface *value) { stateCallback=value; }
|
||||||
|
|
||||||
|
@@ -71,6 +71,13 @@ SurfaceCell::~SurfaceCell() {
|
|||||||
delete object;
|
delete object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SurfaceCell::end(){
|
||||||
|
if(object!=NULL){
|
||||||
|
object->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SurfaceCell::isFree() const {
|
bool SurfaceCell::isFree() const {
|
||||||
return object==NULL || object->getWalkable();
|
return object==NULL || object->getWalkable();
|
||||||
}
|
}
|
||||||
@@ -126,6 +133,18 @@ Map::~Map() {
|
|||||||
startLocations = NULL;
|
startLocations = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Map::end(){
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
Logger::getInstance().add("Map", true);
|
||||||
|
//read heightmap
|
||||||
|
for(int j = 0; j < surfaceH; ++j) {
|
||||||
|
for(int i = 0; i < surfaceW; ++i) {
|
||||||
|
getSurfaceCell(i, j)->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
int Map::getSurfaceCellArraySize() const {
|
int Map::getSurfaceCellArraySize() const {
|
||||||
return (surfaceW * surfaceH);
|
return (surfaceW * surfaceH);
|
||||||
}
|
}
|
||||||
|
@@ -105,6 +105,7 @@ public:
|
|||||||
SurfaceCell();
|
SurfaceCell();
|
||||||
~SurfaceCell();
|
~SurfaceCell();
|
||||||
|
|
||||||
|
void end(); //to kill particles
|
||||||
//get
|
//get
|
||||||
const Vec3f &getVertex() const {return vertex;}
|
const Vec3f &getVertex() const {return vertex;}
|
||||||
float getHeight() const {return vertex.y;}
|
float getHeight() const {return vertex.y;}
|
||||||
@@ -176,6 +177,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Map();
|
Map();
|
||||||
~Map();
|
~Map();
|
||||||
|
void end(); //to kill particles
|
||||||
Checksum * getChecksumValue() { return &checksumValue; }
|
Checksum * getChecksumValue() { return &checksumValue; }
|
||||||
|
|
||||||
void init(Tileset *tileset);
|
void init(Tileset *tileset);
|
||||||
|
@@ -136,6 +136,8 @@ void World::end(){
|
|||||||
factions.clear();
|
factions.clear();
|
||||||
fogOfWarOverride = false;
|
fogOfWarOverride = false;
|
||||||
|
|
||||||
|
map.end();
|
||||||
|
|
||||||
//stats will be deleted by BattleEnd
|
//stats will be deleted by BattleEnd
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user