Browse Source

Fix those scary SystemErrors we see in DS

As it turns out, my old OnServerInitComplete fix didn't check to see if
the script had an OnServerInitComplete method. So, when we called that
method-of-doom from C++, we'd see a SystemError. Aside from removing an
error message, this probably has no effect.
Adam Johnson 12 years ago
parent
commit
c13a12c58e
  1. 9
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

9
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -859,14 +859,14 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
// We should really let the script know about that via OnServerInitComplete anyway because it's // We should really let the script know about that via OnServerInitComplete anyway because it's
// not good to make assumptions about game state in workarounds for that method not being called // not good to make assumptions about game state in workarounds for that method not being called
plNetClientApp* na = plNetClientApp::GetInstance(); plNetClientApp* na = plNetClientApp::GetInstance();
if (!na->GetFlagsBit(plNetClientApp::kLoadingInitialAgeState) && if (!na->GetFlagsBit(plNetClientApp::kLoadingInitialAgeState) && na->GetFlagsBit(plNetClientApp::kPlayingGame))
na->GetFlagsBit(plNetClientApp::kPlayingGame))
{ {
plgDispatch::Dispatch()->UnRegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey()); plgDispatch::Dispatch()->UnRegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey());
if (fPyFunctionInstances[kfunc_OnServerInitComplete])
{
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
// call it // call it
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnServerInitComplete],
fPyFunctionInstances[kfunc_OnServerInitComplete],
(char*)fFunctionNames[kfunc_OnServerInitComplete], nil); (char*)fFunctionNames[kfunc_OnServerInitComplete], nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -882,6 +882,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
// display any output (NOTE: this would be disabled in production) // display any output (NOTE: this would be disabled in production)
DisplayPythonOutput(); DisplayPythonOutput();
} }
}
// display python output // display python output
DisplayPythonOutput(); DisplayPythonOutput();

Loading…
Cancel
Save