@ -290,6 +290,8 @@ static bool SwitchNewGRFBlitter()
const bool animation_wanted = HasBit ( _display_opt , DO_FULL_ANIMATION ) ;
const char * cur_blitter = BlitterFactory : : GetCurrentBlitter ( ) - > GetName ( ) ;
VideoDriver : : GetInstance ( ) - > AcquireBlitterLock ( ) ;
for ( uint i = 0 ; i < lengthof ( replacement_blitters ) ; i + + ) {
if ( animation_wanted & & ( replacement_blitters [ i ] . animation = = 0 ) ) continue ;
if ( ! animation_wanted & & ( replacement_blitters [ i ] . animation = = 1 ) ) continue ;
@ -298,7 +300,10 @@ static bool SwitchNewGRFBlitter()
if ( ! IsInsideMM ( depth_wanted_by_grf , replacement_blitters [ i ] . min_grf_depth , replacement_blitters [ i ] . max_grf_depth + 1 ) ) continue ;
const char * repl_blitter = replacement_blitters [ i ] . name ;
if ( strcmp ( repl_blitter , cur_blitter ) = = 0 ) return false ;
if ( strcmp ( repl_blitter , cur_blitter ) = = 0 ) {
VideoDriver : : GetInstance ( ) - > ReleaseBlitterLock ( ) ;
return false ;
}
if ( BlitterFactory : : GetBlitterFactory ( repl_blitter ) = = NULL ) continue ;
DEBUG ( misc , 1 , " Switching blitter from '%s' to '%s'... " , cur_blitter , repl_blitter ) ;
@ -313,6 +318,8 @@ static bool SwitchNewGRFBlitter()
if ( BlitterFactory : : SelectBlitter ( cur_blitter ) = = NULL | | ! VideoDriver : : GetInstance ( ) - > AfterBlitterChange ( ) ) usererror ( " Failed to reinitialize video driver. Specify a fixed blitter in the config " ) ;
}
VideoDriver : : GetInstance ( ) - > ReleaseBlitterLock ( ) ;
return true ;
}