background assert -> warning. This fired, but I can't repro it and the assert didn't give useful data.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
#include "BackgroundUtil.h"
|
#include "BackgroundUtil.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
#include "RageFileDriverMemory.h"
|
||||||
|
|
||||||
ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge");
|
ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge");
|
||||||
ThemeMetric<float> TOP_EDGE ("Background","TopEdge");
|
ThemeMetric<float> TOP_EDGE ("Background","TopEdge");
|
||||||
@@ -250,9 +251,7 @@ void BackgroundImpl::Unload()
|
|||||||
|
|
||||||
void BackgroundImpl::Layer::Unload()
|
void BackgroundImpl::Layer::Unload()
|
||||||
{
|
{
|
||||||
for( map<BackgroundDef,Actor*>::iterator iter = m_BGAnimations.begin();
|
FOREACHM( BackgroundDef, Actor*, m_BGAnimations, iter )
|
||||||
iter != m_BGAnimations.end();
|
|
||||||
iter++ )
|
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
m_BGAnimations.clear();
|
m_BGAnimations.clear();
|
||||||
m_aBGChanges.clear();
|
m_aBGChanges.clear();
|
||||||
@@ -766,7 +765,16 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus
|
|||||||
m_pFadingBGA = m_pCurrentBGA;
|
m_pFadingBGA = m_pCurrentBGA;
|
||||||
|
|
||||||
map<BackgroundDef,Actor*>::const_iterator iter = m_BGAnimations.find( change.m_def );
|
map<BackgroundDef,Actor*>::const_iterator iter = m_BGAnimations.find( change.m_def );
|
||||||
ASSERT( iter != m_BGAnimations.end() );
|
if( iter == m_BGAnimations.end() )
|
||||||
|
{
|
||||||
|
XNode *pNode = change.m_def.CreateNode();
|
||||||
|
RageFileObjMem f;
|
||||||
|
pNode->GetXML( f, NULL );
|
||||||
|
LOG->Warn( "Tried to switch to a background that was never loaded\n" + f.GetString() );
|
||||||
|
SAFE_DELETE( pNode );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_pCurrentBGA = iter->second;
|
m_pCurrentBGA = iter->second;
|
||||||
|
|
||||||
if( m_pFadingBGA == m_pCurrentBGA )
|
if( m_pFadingBGA == m_pCurrentBGA )
|
||||||
|
|||||||
@@ -7,6 +7,48 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
|
||||||
|
bool BackgroundDef::operator<( const BackgroundDef &other ) const
|
||||||
|
{
|
||||||
|
#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false;
|
||||||
|
COMPARE( m_sEffect );
|
||||||
|
COMPARE( m_sFile1 );
|
||||||
|
COMPARE( m_sFile2 );
|
||||||
|
COMPARE( m_sColor1 );
|
||||||
|
COMPARE( m_sColor2 );
|
||||||
|
#undef COMPARE
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BackgroundDef::operator==( const BackgroundDef &other ) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
m_sEffect == other.m_sEffect &&
|
||||||
|
m_sFile1 == other.m_sFile1 &&
|
||||||
|
m_sFile2 == other.m_sFile2 &&
|
||||||
|
m_sColor1 == other.m_sColor1 &&
|
||||||
|
m_sColor2 == other.m_sColor2;
|
||||||
|
}
|
||||||
|
|
||||||
|
XNode *BackgroundDef::CreateNode() const
|
||||||
|
{
|
||||||
|
XNode* pNode = new XNode;
|
||||||
|
pNode->m_sName = "BackgroundDef";
|
||||||
|
|
||||||
|
if( !m_sEffect.empty() )
|
||||||
|
pNode->AppendAttr( "Effect", m_sEffect );
|
||||||
|
if( !m_sFile1.empty() )
|
||||||
|
pNode->AppendAttr( "File1", m_sFile1 );
|
||||||
|
if( !m_sFile2.empty() )
|
||||||
|
pNode->AppendAttr( "File2", m_sFile2 );
|
||||||
|
if( !m_sColor1.empty() )
|
||||||
|
pNode->AppendAttr( "Color1", m_sColor1 );
|
||||||
|
if( !m_sColor2.empty() )
|
||||||
|
pNode->AppendAttr( "Color2", m_sColor2 );
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
|
||||||
const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
|
const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
|
||||||
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
|
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
|
||||||
const CString BG_ANIMS_DIR = "BGAnimations/";
|
const CString BG_ANIMS_DIR = "BGAnimations/";
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#define BackgroundUtil_H
|
#define BackgroundUtil_H
|
||||||
|
|
||||||
class Song;
|
class Song;
|
||||||
|
struct XNode;
|
||||||
|
|
||||||
extern const CString RANDOM_BACKGROUND_FILE;
|
extern const CString RANDOM_BACKGROUND_FILE;
|
||||||
extern const CString NO_SONG_BG_FILE;
|
extern const CString NO_SONG_BG_FILE;
|
||||||
@@ -18,35 +19,16 @@ extern const CString SBT_CrossFade;
|
|||||||
|
|
||||||
struct BackgroundDef
|
struct BackgroundDef
|
||||||
{
|
{
|
||||||
BackgroundDef()
|
bool operator<( const BackgroundDef &other ) const;
|
||||||
{
|
bool operator==( const BackgroundDef &other ) const;
|
||||||
}
|
bool IsEmpty() const { return m_sFile1.empty() && m_sFile2.empty(); }
|
||||||
bool operator<( const BackgroundDef &other ) const
|
|
||||||
{
|
|
||||||
#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false;
|
|
||||||
COMPARE( m_sEffect );
|
|
||||||
COMPARE( m_sFile1 );
|
|
||||||
COMPARE( m_sFile2 );
|
|
||||||
COMPARE( m_sColor1 );
|
|
||||||
COMPARE( m_sColor2 );
|
|
||||||
#undef COMPARE
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool operator==( const BackgroundDef &other ) const
|
|
||||||
{
|
|
||||||
return
|
|
||||||
m_sEffect == other.m_sEffect &&
|
|
||||||
m_sFile1 == other.m_sFile1 &&
|
|
||||||
m_sFile2 == other.m_sFile2 &&
|
|
||||||
m_sColor1 == other.m_sColor1 &&
|
|
||||||
m_sColor2 == other.m_sColor2;
|
|
||||||
}
|
|
||||||
bool IsEmpty() { return m_sFile1.empty() && m_sFile2.empty(); }
|
|
||||||
CString m_sEffect; // "" == automatically choose
|
CString m_sEffect; // "" == automatically choose
|
||||||
CString m_sFile1; // must not be ""
|
CString m_sFile1; // must not be ""
|
||||||
CString m_sFile2; // may be ""
|
CString m_sFile2; // may be ""
|
||||||
CString m_sColor1; // "" == use default
|
CString m_sColor1; // "" == use default
|
||||||
CString m_sColor2; // "" == use default
|
CString m_sColor2; // "" == use default
|
||||||
|
|
||||||
|
XNode *CreateNode() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BackgroundChange
|
struct BackgroundChange
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ char* XNode::Load( const char* pszXml, PARSEINFO *pi /*= &piDefault*/ )
|
|||||||
//========================================================
|
//========================================================
|
||||||
bool XAttr::GetXML( RageFileBasic &f, DISP_OPT *opt ) const
|
bool XAttr::GetXML( RageFileBasic &f, DISP_OPT *opt ) const
|
||||||
{
|
{
|
||||||
return f.Write(m_sName + "='" + (opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(m_sValue):m_sValue) + "' ") != -1;
|
return f.Write(m_sName + "='" + (opt && opt->reference_value && opt->entitys ? opt->entitys->Entity2Ref(m_sValue) : m_sValue) + "' ") != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================
|
//========================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user