16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 23:19:19 +02:00

maintenance: null dereferencing fixes, vehicle load shadow render fix

This commit is contained in:
tmj-fstate
2018-10-13 15:03:51 +02:00
parent f8f0907d8a
commit 81c92383be
3 changed files with 3 additions and 6 deletions

View File

@@ -71,7 +71,7 @@ void TButton::Load( cParser &Parser, TDynamicObject const *Owner, TModel3d *pMod
if( ( pModelOn == nullptr ) if( ( pModelOn == nullptr )
&& ( pModelOff == nullptr ) ) { && ( pModelOff == nullptr ) ) {
// if we failed to locate even one state submodel, cry // if we failed to locate even one state submodel, cry
ErrorLog( "Bad model: failed to locate sub-model \"" + submodelname + "\" in 3d model \"" + pModel1->NameGet() + "\"", logtype::model ); ErrorLog( "Bad model: failed to locate sub-model \"" + submodelname + "\" in 3d model \"" + ( pModel1 != nullptr ? pModel1->NameGet() : pModel2 != nullptr ? pModel2->NameGet() : "NULL" ) + "\"", logtype::model );
} }
// pass submodel location to defined sounds // pass submodel location to defined sounds

View File

@@ -1730,7 +1730,7 @@ int TTrack::CrossSegment(int from, int into)
void TTrack::RaAnimListAdd(TTrack *t) void TTrack::RaAnimListAdd(TTrack *t)
{ // dodanie toru do listy animacyjnej { // dodanie toru do listy animacyjnej
if (SwitchExtension) if ((t != nullptr) && (SwitchExtension != nullptr))
{ {
if (t == this) if (t == this)
return; // siebie nie dodajemy drugi raz do listy return; // siebie nie dodajemy drugi raz do listy

View File

@@ -2168,13 +2168,10 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
} }
} }
} }
if( Dynamic->mdModel ) if( Dynamic->mdModel )
Render( Dynamic->mdModel, Dynamic->Material(), squaredistance ); Render( Dynamic->mdModel, Dynamic->Material(), squaredistance );
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} ); Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
// post-render cleanup // post-render cleanup
m_renderspecular = false; m_renderspecular = false;
if( Dynamic->fShade > 0.0f ) { if( Dynamic->fShade > 0.0f ) {
@@ -2193,7 +2190,7 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
if( Dynamic->mdModel ) if( Dynamic->mdModel )
Render( Dynamic->mdModel, Dynamic->Material(), squaredistance ); Render( Dynamic->mdModel, Dynamic->Material(), squaredistance );
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance ); Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
// post-render cleanup // post-render cleanup
break; break;
} }