fix Character::UndemandGraphics unloading graphics too early if used
by multiple screens at once
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageTextureID.h"
|
||||
|
||||
Character::Character()
|
||||
{
|
||||
m_iPreloadRefcount = 0;
|
||||
}
|
||||
|
||||
bool Character::Load( CString sCharDir )
|
||||
{
|
||||
@@ -172,14 +176,20 @@ bool Character::Has2DElems()
|
||||
|
||||
void Character::DemandGraphics()
|
||||
{
|
||||
CString s = GetIconPath();
|
||||
if( !s.empty() )
|
||||
m_Preload.Load( s );
|
||||
++m_iPreloadRefcount;
|
||||
if( m_iPreloadRefcount == 1 )
|
||||
{
|
||||
CString s = GetIconPath();
|
||||
if( !s.empty() )
|
||||
m_Preload.Load( s );
|
||||
}
|
||||
}
|
||||
|
||||
void Character::UndemandGraphics()
|
||||
{
|
||||
m_Preload.UnloadAll();
|
||||
--m_iPreloadRefcount;
|
||||
if( m_iPreloadRefcount == 0 )
|
||||
m_Preload.UnloadAll();
|
||||
}
|
||||
|
||||
// lua start
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef lua_State Lua;
|
||||
class Character
|
||||
{
|
||||
public:
|
||||
// Character();
|
||||
Character();
|
||||
~Character() { }
|
||||
|
||||
bool Load( CString sCharDir ); // return true if success
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
|
||||
CString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
|
||||
RageTexturePreloader m_Preload;
|
||||
int m_iPreloadRefcount;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user