fix and simplify
This commit is contained in:
@@ -25,17 +25,25 @@ void RageTextureID::Init()
|
|||||||
bHotPinkColorKey = false;
|
bHotPinkColorKey = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RageTextureID::equal(const RageTextureID &rhs) const
|
bool RageTextureID::operator<(const RageTextureID &rhs) const
|
||||||
{
|
{
|
||||||
if(filename != rhs.filename) return false;
|
if(filename < rhs.filename) return true;
|
||||||
if(iMaxSize != rhs.iMaxSize) return false;
|
if(filename > rhs.filename) return false;
|
||||||
if(iMipMaps != rhs.iMipMaps) return false;
|
if(iMaxSize < rhs.iMaxSize) return true;
|
||||||
if(iAlphaBits != rhs.iAlphaBits) return false;
|
if(iMaxSize > rhs.iMaxSize) return false;
|
||||||
if(iColorDepth != rhs.iColorDepth) return false;
|
if(iMipMaps < rhs.iMipMaps) return true;
|
||||||
if(bDither != rhs.bDither) return false;
|
if(iMipMaps > rhs.iMipMaps) return false;
|
||||||
if(bStretch != rhs.bStretch) return false;
|
if(iAlphaBits < rhs.iAlphaBits) return true;
|
||||||
if(bHotPinkColorKey != rhs.bHotPinkColorKey) return false;
|
if(iAlphaBits > rhs.iAlphaBits) return false;
|
||||||
return true;
|
if(iColorDepth < rhs.iColorDepth) return true;
|
||||||
|
if(iColorDepth > rhs.iColorDepth) return false;
|
||||||
|
if(bDither < rhs.bDither) return true;
|
||||||
|
if(bDither > rhs.bDither) return false;
|
||||||
|
if(bStretch < rhs.bStretch) return true;
|
||||||
|
if(bStretch > rhs.bStretch) return false;
|
||||||
|
if(bHotPinkColorKey < rhs.bHotPinkColorKey) return true;
|
||||||
|
if(bHotPinkColorKey > rhs.bHotPinkColorKey) return false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ struct RageTextureID
|
|||||||
bool bStretch;
|
bool bStretch;
|
||||||
bool bHotPinkColorKey; /* #FF00FF */
|
bool bHotPinkColorKey; /* #FF00FF */
|
||||||
|
|
||||||
/* Define an ordering so this can be used in a set<>. This defines a partial
|
bool operator< (const RageTextureID &rhs) const;
|
||||||
* ordering; use equal() to see if they're equal. */
|
|
||||||
bool operator< (const RageTextureID &rhs) const { return filename < rhs.filename; }
|
|
||||||
bool equal(const RageTextureID &rhs) const;
|
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
|||||||
@@ -76,17 +76,11 @@ RageTexture* RageTextureManager::LoadTexture( RageTextureID ID )
|
|||||||
std::map<RageTextureID, RageTexture*>::iterator p = m_mapPathToTexture.find(ID);
|
std::map<RageTextureID, RageTexture*>::iterator p = m_mapPathToTexture.find(ID);
|
||||||
while(p != m_mapPathToTexture.end())
|
while(p != m_mapPathToTexture.end())
|
||||||
{
|
{
|
||||||
if(p->first.equal(ID)) {
|
|
||||||
/* Found the texture. Just increase the refcount and return it. */
|
/* Found the texture. Just increase the refcount and return it. */
|
||||||
p->second->m_iRefCount++;
|
p->second->m_iRefCount++;
|
||||||
return p->second;
|
return p->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* short circuit */
|
|
||||||
if(p->first.filename > ID.filename) break;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the texture is not already loaded. Load it.
|
// the texture is not already loaded. Load it.
|
||||||
|
|
||||||
CString sDir, sFName, sExt;
|
CString sDir, sFName, sExt;
|
||||||
|
|||||||
Reference in New Issue
Block a user