remove return value; always true and never checked (texture load errors

are handled with warnings and a dummy texture)
This commit is contained in:
Glenn Maynard
2005-10-11 02:15:27 +00:00
parent a736d97aa2
commit a808a49b65
8 changed files with 20 additions and 26 deletions
+3 -5
View File
@@ -22,12 +22,12 @@ Banner::Banner()
} }
/* Ugly: if sIsBanner is false, we're actually loading something other than a banner. */ /* Ugly: if sIsBanner is false, we're actually loading something other than a banner. */
bool Banner::Load( RageTextureID ID, bool bIsBanner ) void Banner::Load( RageTextureID ID, bool bIsBanner )
{ {
if( ID.filename == "" ) if( ID.filename == "" )
{ {
LoadFallback(); LoadFallback();
return true; return;
} }
if( bIsBanner ) if( bIsBanner )
@@ -38,10 +38,8 @@ bool Banner::Load( RageTextureID ID, bool bIsBanner )
TEXTUREMAN->DisableOddDimensionWarning(); TEXTUREMAN->DisableOddDimensionWarning();
TEXTUREMAN->VolatileTexture( ID ); TEXTUREMAN->VolatileTexture( ID );
bool ret = Sprite::Load( ID ); Sprite::Load( ID );
TEXTUREMAN->EnableOddDimensionWarning(); TEXTUREMAN->EnableOddDimensionWarning();
return ret;
}; };
void Banner::Update( float fDeltaTime ) void Banner::Update( float fDeltaTime )
+1 -1
View File
@@ -16,7 +16,7 @@ public:
virtual ~Banner() { } virtual ~Banner() { }
virtual Actor *Copy() const; virtual Actor *Copy() const;
virtual bool Load( RageTextureID ID, bool bIsBanner=true ); virtual void Load( RageTextureID ID, bool bIsBanner=true );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
+2 -3
View File
@@ -69,11 +69,10 @@ void FadingBanner::DrawPrimitives()
} }
} }
bool FadingBanner::Load( RageTextureID ID, bool bLowResToHighRes ) void FadingBanner::Load( RageTextureID ID, bool bLowResToHighRes )
{ {
BeforeChange( bLowResToHighRes ); BeforeChange( bLowResToHighRes );
bool bRet = m_Banner[m_iIndexLatest].Load(ID); m_Banner[m_iIndexLatest].Load(ID);
return bRet;
} }
/* If bLowResToHighRes is true, we're fading from a low-res banner to the /* If bLowResToHighRes is true, we're fading from a low-res banner to the
+1 -1
View File
@@ -17,7 +17,7 @@ public:
/* If you previously loaded a cached banner, and are now loading the full- /* If you previously loaded a cached banner, and are now loading the full-
* resolution banner, set bLowResToHighRes to true. */ * resolution banner, set bLowResToHighRes to true. */
bool Load( RageTextureID ID, bool bLowResToHighRes=false ); void Load( RageTextureID ID, bool bLowResToHighRes=false );
void LoadFromSong( const Song* pSong ); // NULL means no song void LoadFromSong( const Song* pSong ); // NULL means no song
void LoadAllMusic(); void LoadAllMusic();
void LoadMode(); void LoadMode();
+1 -2
View File
@@ -23,7 +23,7 @@ GradeDisplay::GradeDisplay()
SetGrade( PLAYER_1, Grade_NoData ); SetGrade( PLAYER_1, Grade_NoData );
} }
bool GradeDisplay::Load( RageTextureID ID ) void GradeDisplay::Load( RageTextureID ID )
{ {
ID.bStretch = true; ID.bStretch = true;
Sprite::Load( ID ); Sprite::Load( ID );
@@ -38,7 +38,6 @@ bool GradeDisplay::Load( RageTextureID ID )
LOG->Warn( sError ); LOG->Warn( sError );
Dialog::OK( sError ); Dialog::OK( sError );
} }
return true;
} }
void GradeDisplay::Update( float fDeltaTime ) void GradeDisplay::Update( float fDeltaTime )
+1 -1
View File
@@ -12,7 +12,7 @@ class GradeDisplay : public Sprite
{ {
public: public:
GradeDisplay(); GradeDisplay();
virtual bool Load( RageTextureID ID ); virtual void Load( RageTextureID ID );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
+9 -11
View File
@@ -103,17 +103,15 @@ RageTextureID Sprite::SongBannerTexture( RageTextureID ID )
} }
/* deprecated */ /* deprecated */
bool Sprite::LoadBG( RageTextureID ID ) void Sprite::LoadBG( RageTextureID ID )
{ {
return Load( SongBGTexture(ID) ); Load( SongBGTexture(ID) );
} }
bool Sprite::Load( RageTextureID ID ) void Sprite::Load( RageTextureID ID )
{ {
if( ID.filename.empty() ) if( !ID.filename.empty() )
return true; LoadFromTexture( ID );
else
return LoadFromTexture( ID );
}; };
void Sprite::LoadFromNode( const CString& sDir, const XNode* pNode ) void Sprite::LoadFromNode( const CString& sDir, const XNode* pNode )
@@ -937,19 +935,19 @@ public:
static int Load( T* p, lua_State *L ) static int Load( T* p, lua_State *L )
{ {
RageTextureID ID( SArg(1) ); RageTextureID ID( SArg(1) );
lua_pushboolean( L, p->Load(ID) ); p->Load( ID );
return 1; return 0;
} }
static int LoadBackground( T* p, lua_State *L ) static int LoadBackground( T* p, lua_State *L )
{ {
RageTextureID ID( SArg(1) ); RageTextureID ID( SArg(1) );
lua_pushboolean( L, p->Load(Sprite::SongBGTexture(ID)) ); p->Load( Sprite::SongBGTexture(ID) );
return 1; return 1;
} }
static int LoadBanner( T* p, lua_State *L ) static int LoadBanner( T* p, lua_State *L )
{ {
RageTextureID ID( SArg(1) ); RageTextureID ID( SArg(1) );
lua_pushboolean( L, p->Load(Sprite::SongBannerTexture(ID)) ); p->Load( Sprite::SongBannerTexture(ID) );
return 1; return 1;
} }
+2 -2
View File
@@ -32,8 +32,8 @@ public:
/* Just a convenience function; load an image that'll be used in the /* Just a convenience function; load an image that'll be used in the
* background. */ * background. */
virtual bool LoadBG( RageTextureID ID ); virtual void LoadBG( RageTextureID ID );
virtual bool Load( RageTextureID ID ); virtual void Load( RageTextureID ID );
void UnloadTexture(); void UnloadTexture();
RageTexture* GetTexture() { return m_pTexture; }; RageTexture* GetTexture() { return m_pTexture; };