Reset: guard against NULL HUD / lighting
This commit is contained in:
parent
6eb4e833ae
commit
2322fca9c9
1 changed files with 13 additions and 4 deletions
|
@ -221,8 +221,11 @@ public:
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
glPushClientAttrib(~0u);
|
glPushClientAttrib(~0u);
|
||||||
|
|
||||||
HUD *hud = static_cast<HUD*>(globals->get_subsystem("hud"));
|
// HUD can be NULL
|
||||||
hud->draw(state);
|
HUD *hud = static_cast<HUD*>(globals->get_subsystem("hud"));
|
||||||
|
if (hud) {
|
||||||
|
hud->draw(state);
|
||||||
|
}
|
||||||
|
|
||||||
glPopClientAttrib();
|
glPopClientAttrib();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
@ -255,6 +258,11 @@ public:
|
||||||
osg::Light* light = lightSource->getLight();
|
osg::Light* light = lightSource->getLight();
|
||||||
|
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||||
|
if (!l) {
|
||||||
|
// lighting is down during re-init
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_isSun) {
|
if (_isSun) {
|
||||||
light->setAmbient(Vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
light->setAmbient(Vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||||
light->setDiffuse(Vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
light->setDiffuse(Vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
@ -492,7 +500,8 @@ public:
|
||||||
void
|
void
|
||||||
FGRenderer::init( void )
|
FGRenderer::init( void )
|
||||||
{
|
{
|
||||||
eventHandler = new FGEventHandler();
|
if (!eventHandler)
|
||||||
|
eventHandler = new FGEventHandler();
|
||||||
|
|
||||||
sgUserDataInit( globals->get_props() );
|
sgUserDataInit( globals->get_props() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue