Worked around a crash during level reloads.
Global state in bh_marin.c isn't being deinitialized, and this was causing some code to incorrectly execute during a level restart. Said code has been commented out, as it appears to have been previously disabled. Improved the deinitialization in pheromon.c to make similar crashes more obvious.
This commit is contained in:
parent
5d730a8930
commit
2d2faf1247
2 changed files with 43 additions and 8 deletions
|
@ -13719,6 +13719,12 @@ void GetPointToFaceMarineTowards(STRATEGYBLOCK *sbPtr,VECTORCH *output) {
|
|||
return;
|
||||
}
|
||||
|
||||
// SBF - 20080518 - commented out - this block of code is a NO-OP
|
||||
// due to the aliased targetModule variable. This code might have
|
||||
// been disabled intentionally? In any case, disabling this code
|
||||
// works around a crash in FarNPC_GetTargetAIModuleForMarineRespond
|
||||
// during level reloads.
|
||||
#if 0 // SBF - 20080518 - commented out
|
||||
if (NpcSquad.alertZone) {
|
||||
/* Might want to face towards trouble. */
|
||||
if (sbPtr->containingModule->m_aimodule!=NpcSquad.alertZone) {
|
||||
|
@ -13726,7 +13732,7 @@ void GetPointToFaceMarineTowards(STRATEGYBLOCK *sbPtr,VECTORCH *output) {
|
|||
targetModule = FarNPC_GetTargetAIModuleForMarineRespond(sbPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Did that work? */
|
||||
|
||||
if (targetModule) {
|
||||
|
@ -13745,6 +13751,7 @@ void GetPointToFaceMarineTowards(STRATEGYBLOCK *sbPtr,VECTORCH *output) {
|
|||
|
||||
}
|
||||
}
|
||||
#endif // SBF - 20080518 - commented out
|
||||
|
||||
AdjModuleRefPtr = sbPtr->containingModule->m_aimodule->m_link_ptrs;
|
||||
/* check if there is a module adjacency list */
|
||||
|
|
|
@ -182,16 +182,44 @@ End of level clean up for pheromone system
|
|||
void CleanUpPheromoneSystem(void)
|
||||
{
|
||||
#if 1
|
||||
if (Pher_Player1) DeallocateMem(Pher_Player1);
|
||||
if (Pher_Player2) DeallocateMem(Pher_Player2);
|
||||
if (Pher_Ai1) DeallocateMem(Pher_Ai1);
|
||||
if (Pher_Player1 != NULL) {
|
||||
DeallocateMem(Pher_Player1);
|
||||
Pher_Player1 = NULL;
|
||||
}
|
||||
if (Pher_Player2 != NULL) {
|
||||
DeallocateMem(Pher_Player2);
|
||||
Pher_Player2 = NULL;
|
||||
}
|
||||
if (Pher_Ai1 != NULL) {
|
||||
DeallocateMem(Pher_Ai1);
|
||||
Pher_Ai1 = NULL;
|
||||
}
|
||||
PherPl_ReadBuf = NULL;
|
||||
PherPl_WriteBuf = NULL;
|
||||
PherAi_Buf = NULL;
|
||||
#endif
|
||||
|
||||
#if SUPER_PHEROMONE_SYSTEM
|
||||
if (Pher_Aliens1) DeallocateMem(Pher_Aliens1);
|
||||
if (Pher_Aliens2) DeallocateMem(Pher_Aliens2);
|
||||
if (Pher_Marines1) DeallocateMem(Pher_Marines1);
|
||||
if (Pher_Marines2) DeallocateMem(Pher_Marines2);
|
||||
if (Pher_Aliens1 != NULL) {
|
||||
DeallocateMem(Pher_Aliens1);
|
||||
Pher_Aliens1 = NULL;
|
||||
}
|
||||
if (Pher_Aliens2 != NULL) {
|
||||
DeallocateMem(Pher_Aliens2);
|
||||
Pher_Aliens2 = NULL;
|
||||
}
|
||||
if (Pher_Marines1 != NULL) {
|
||||
DeallocateMem(Pher_Marines1);
|
||||
Pher_Marines1 = NULL;
|
||||
}
|
||||
if (Pher_Marines2 != NULL) {
|
||||
DeallocateMem(Pher_Marines2);
|
||||
Pher_Marines2 = NULL;
|
||||
}
|
||||
PherAls_ReadBuf = NULL;
|
||||
PherAls_WriteBuf = NULL;
|
||||
PherMars_ReadBuf = NULL;
|
||||
PherMars_WriteBuf = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue