After some more digging I found out that the problem lays at this method:
void NTCPlayerControl::Remove_Excess_Scripts(GameObject *Obj)
{
if(!Obj)
return;
// Loop trough all the scripts
SimpleDynVecClass<GameObjObserverClass *> Observers = Obj->Get_Observers();
int Count = Observers.Count();
for(int x = 0; x < Count; x++)
{
GameObjObserverClass *Current = Observers[x];
if(Current)
{
WideStringClass Name = Current->Get_Name();
if(Name.Compare(L"M00_GrantPowerup_Created") == 0 || Name.Substring(0, 4).Compare_No_Case(L"SSGM") == 0)
{
COutput("Should remove: %s\n", Current->Get_Name());
//Obj->Remove_Observer(Current);
}
}
}
}
As soon as I add the Obj->Remove_Observer line it starts crashing again. But I still haven't figured out why I cant add that line.
UPDATE:
I think somewhere in Scripts.dll there is code that assumes that all SSGM scripts are still attached.
I've changed the code to this to make sure the comparing is going right:
if(Current)
{
const char *ScriptName = Current->Get_Name();
//Name.Substring(0, 4).Compare_No_Case(L"SSGM") == 0
if(strcmp(ScriptName, "M00_GrantPowerup_Created") == 0 || (ScriptName && strlen(ScriptName) >= 4 && ScriptName[0] == 'S' && ScriptName[1] == 'S' && ScriptName[2] == 'G' && ScriptName[3] == 'M'))
{
COutput("Should remove: %s\n", Current->Get_Name());
Obj->Remove_Observer(Current);
}
}
[Updated on: Mon, 18 November 2013 15:42]
Report message to a moderator