From: <wel...@us...> - 2010-05-02 11:41:50
|
Revision: 5845 http://planeshift.svn.sourceforge.net/planeshift/?rev=5845&view=rev Author: weltall2 Date: 2010-05-02 11:41:42 +0000 (Sun, 02 May 2010) Log Message: ----------- crash fixes from agy to the soundsystem Modified Paths: -------------- trunk/src/common/pssound/psemitter.cpp trunk/src/common/pssound/psmusic.cpp trunk/src/common/pssound/pssoundmngr.cpp Modified: trunk/src/common/pssound/psemitter.cpp =================================================================== --- trunk/src/common/pssound/psemitter.cpp 2010-05-02 11:39:41 UTC (rev 5844) +++ trunk/src/common/pssound/psemitter.cpp 2010-05-02 11:41:42 UTC (rev 5845) @@ -110,7 +110,7 @@ void psEmitter::Stop () { active = false; - + if (handle != NULL) { SndSysMgr->StopSound(handle); @@ -122,4 +122,5 @@ psEmitter *which = (psEmitter *) object; which->active = false; which->handle = NULL; -} \ No newline at end of file +} + Modified: trunk/src/common/pssound/psmusic.cpp =================================================================== --- trunk/src/common/pssound/psmusic.cpp 2010-05-02 11:39:41 UTC (rev 5844) +++ trunk/src/common/pssound/psmusic.cpp 2010-05-02 11:41:42 UTC (rev 5845) @@ -137,4 +137,5 @@ psMusic *which = (psMusic *) object; which->active = false; which->handle = NULL; -} \ No newline at end of file +} + Modified: trunk/src/common/pssound/pssoundmngr.cpp =================================================================== --- trunk/src/common/pssound/pssoundmngr.cpp 2010-05-02 11:39:41 UTC (rev 5844) +++ trunk/src/common/pssound/pssoundmngr.cpp 2010-05-02 11:41:42 UTC (rev 5845) @@ -74,9 +74,9 @@ psSoundManager::~psSoundManager () { + UnloadSectors(); delete voicequeue; delete SndSysMgr; - UnloadSectors(); // Note: SndSysMgr should take care of SoundControls .. we can ignore them } @@ -169,6 +169,8 @@ { /* yay active resource with the same name - steal the handle*/ newsector->musicarray[j]->handle = oldsector->activemusic->handle; + /* set handle to NULL */ + oldsector->activemusic->handle = NULL; newsector->activemusic = newsector->musicarray[j]; /* set the sound to active */ newsector->musicarray[j]->active = true; @@ -191,6 +193,8 @@ { /* yay active resource with the same name - steal the handle*/ newsector->ambientarray[j]->handle = oldsector->activeambient->handle; + /* set handle to NULL */ + oldsector->activeambient->handle = NULL; newsector->activeambient = newsector->ambientarray[j]; /* set the sound to active */ newsector->ambientarray[j]->active = true; @@ -212,7 +216,8 @@ iMeshWrapper *mesh; iMeshList *meshes; iEngine *engine; - psEmitter *emitter; + psEmitter *emitter; + psEmitter *factoryemitter; engine = psengine->GetEngine(); @@ -228,6 +233,8 @@ continue; } + factoryemitter = sector->emitterarray[j]; + if (!(searchSector = engine->FindSector( sector->name, NULL ))) { Error2("sector %s not found\n", (const char *) sector); @@ -235,9 +242,9 @@ } if (!(factory = engine->GetMeshFactories() - ->FindByName(sector->emitterarray[j]->factory))) + ->FindByName(factoryemitter->factory))) { - Error2("Could not find factory name %s", (const char *) sector->emitterarray[j]->factory); + Error2("Could not find factory name %s", (const char *) factoryemitter->factory); continue; } @@ -249,14 +256,14 @@ if (mesh->GetFactory() == factory) { - if (rng.Get() <= sector->emitterarray[j]->factory_prob) + if (rng.Get() <= factoryemitter->factory_prob) { emitter = new psEmitter; - emitter->resource = csString(sector->emitterarray[j]->resource); - emitter->minvol = sector->emitterarray[j]->minvol; - emitter->maxvol = sector->emitterarray[j]->maxvol; - emitter->maxrange = sector->emitterarray[j]->maxrange; + emitter->resource = csString(factoryemitter->resource); + emitter->minvol = factoryemitter->minvol; + emitter->maxvol = factoryemitter->maxvol; + emitter->maxrange = factoryemitter->maxrange; emitter->position = mesh->GetMovable()->GetPosition(); emitter->active = false; @@ -264,11 +271,8 @@ } } } - /* delete the factory node */ - sector->emitterarray.Delete(sector->emitterarray[j]); - j--; - + sector->DeleteEmitter(factoryemitter); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |