Add error output, simplify

This commit is contained in:
Glenn Maynard
2003-03-05 09:51:32 +00:00
parent 4f120731aa
commit f5116967a8
+23 -19
View File
@@ -576,27 +576,31 @@ void Song::TidyUpData()
continue; // skip
SDL_Surface *img = IMG_Load( m_sSongDir + arrayImages[i] );
if( img )
if( !img )
{
int width = img->w;
int height = img->h;
SDL_FreeSurface( img );
LOG->Trace("Couldn't load %s%s: %s",
m_sSongDir.GetString(), arrayImages[i].GetString(), SDL_GetError());
continue;
}
if( !HasBackground() && width >= 320 && height >= 240 )
{
m_sBackgroundFile = arrayImages[i];
continue;
}
if( !HasBanner() && 100<=width && width<=320 && 50<=height && height<=240 )
{
m_sBannerFile = arrayImages[i];
continue;
}
if( !HasCDTitle() && width<=100 && height<=50 )
{
m_sCDTitleFile = arrayImages[i];
continue;
}
const int width = img->w;
const int height = img->h;
SDL_FreeSurface( img );
if( !HasBackground() && width >= 320 && height >= 240 )
{
m_sBackgroundFile = arrayImages[i];
continue;
}
if( !HasBanner() && 100<=width && width<=320 && 50<=height && height<=240 )
{
m_sBannerFile = arrayImages[i];
continue;
}
if( !HasCDTitle() && width<=100 && height<=50 )
{
m_sCDTitleFile = arrayImages[i];
continue;
}
}