Hashes are unsigned.
(This is why Hungarian for types sucks: I had to search and replace these, instead of just changing the types. It doesn't help anything, either.) Simplify.
This commit is contained in:
@@ -94,8 +94,8 @@ void ThemeManager::SwitchTheme( CString sThemeName )
|
|||||||
m_sCurThemeName = sThemeName;
|
m_sCurThemeName = sThemeName;
|
||||||
|
|
||||||
// update hashes for metrics files
|
// update hashes for metrics files
|
||||||
m_iHashForCurThemeMetrics = GetHashForFile( GetMetricsPathFromName(m_sCurThemeName) );
|
m_uHashForCurThemeMetrics = GetHashForFile( GetMetricsPathFromName(m_sCurThemeName) );
|
||||||
m_iHashForBaseThemeMetrics = GetHashForFile( GetMetricsPathFromName(BASE_THEME_NAME) );
|
m_uHashForBaseThemeMetrics = GetHashForFile( GetMetricsPathFromName(BASE_THEME_NAME) );
|
||||||
|
|
||||||
// read new metrics. First read base metrics, then read cur theme's metrics, overriding base theme
|
// read new metrics. First read base metrics, then read cur theme's metrics, overriding base theme
|
||||||
m_pIniMetrics->Reset();
|
m_pIniMetrics->Reset();
|
||||||
@@ -169,37 +169,27 @@ try_element_again:
|
|||||||
GetThemeDirFromName(m_sCurThemeName),
|
GetThemeDirFromName(m_sCurThemeName),
|
||||||
GetThemeDirFromName(BASE_THEME_NAME) );
|
GetThemeDirFromName(BASE_THEME_NAME) );
|
||||||
}
|
}
|
||||||
else
|
asPossibleElementFilePaths[0].MakeLower();
|
||||||
|
if( asPossibleElementFilePaths[0].GetLength() > 5 && asPossibleElementFilePaths[0].Right(5) == "redir" ) // this is a redirect file
|
||||||
{
|
{
|
||||||
asPossibleElementFilePaths[0].MakeLower();
|
CString sRedirFilePath = asPossibleElementFilePaths[0];
|
||||||
if( asPossibleElementFilePaths[0].GetLength() > 5 && asPossibleElementFilePaths[0].Right(5) == "redir" ) // this is a redirect file
|
|
||||||
{
|
|
||||||
CString sRedirFilePath = asPossibleElementFilePaths[0];
|
|
||||||
|
|
||||||
CString sDir, sFName, sExt;
|
CString sDir, sFName, sExt;
|
||||||
splitrelpath( sRedirFilePath, sDir, sFName, sExt );
|
splitrelpath( sRedirFilePath, sDir, sFName, sExt );
|
||||||
|
|
||||||
CStdioFile file;
|
CStdioFile file;
|
||||||
file.Open( sRedirFilePath, CFile::modeRead );
|
file.Open( sRedirFilePath, CFile::modeRead );
|
||||||
CString sNewFileName;
|
CString sNewFileName;
|
||||||
file.ReadString( sNewFileName );
|
file.ReadString( sNewFileName );
|
||||||
// CString sNewFilePath = sDir+"\\"+sNewFileName; // This is what it used to be, FONT redirs were getting extra slashes
|
// CString sNewFilePath = sDir+"\\"+sNewFileName; // This is what it used to be, FONT redirs were getting extra slashes
|
||||||
// at the start of their file names, so I took out this extra slash - Andy.
|
// at the start of their file names, so I took out this extra slash - Andy.
|
||||||
CString sNewFilePath = sDir+sNewFileName;
|
CString sNewFilePath = sDir+sNewFileName;
|
||||||
if( sNewFileName == "" || !DoesFileExist(sNewFilePath) )
|
if( sNewFileName == "" || !DoesFileExist(sNewFilePath) )
|
||||||
{
|
throw RageException( "The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath, sNewFilePath );
|
||||||
throw RageException( "The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath, sNewFilePath );
|
return sNewFilePath;
|
||||||
}
|
|
||||||
else
|
|
||||||
return sNewFilePath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return asPossibleElementFilePaths[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return asPossibleElementFilePaths[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -220,8 +210,8 @@ try_metric_again:
|
|||||||
if (m_uNextReloadTicks == 0 || ::GetTickCount() > m_uNextReloadTicks)
|
if (m_uNextReloadTicks == 0 || ::GetTickCount() > m_uNextReloadTicks)
|
||||||
{
|
{
|
||||||
m_uNextReloadTicks = GetTickCount()+1000;
|
m_uNextReloadTicks = GetTickCount()+1000;
|
||||||
if( m_iHashForCurThemeMetrics != GetHashForFile(sCurMetricPath) ||
|
if( m_uHashForCurThemeMetrics != GetHashForFile(sCurMetricPath) ||
|
||||||
m_iHashForBaseThemeMetrics != GetHashForFile(sDefaultMetricPath) )
|
m_uHashForBaseThemeMetrics != GetHashForFile(sDefaultMetricPath) )
|
||||||
{
|
{
|
||||||
SwitchTheme(m_sCurThemeName); // force a reload of the metrics cache
|
SwitchTheme(m_sCurThemeName); // force a reload of the metrics cache
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ protected:
|
|||||||
|
|
||||||
IniFile* m_pIniMetrics; // make this a pointer so we don't have to include IniFile in this header!
|
IniFile* m_pIniMetrics; // make this a pointer so we don't have to include IniFile in this header!
|
||||||
DWORD m_uNextReloadTicks;
|
DWORD m_uNextReloadTicks;
|
||||||
int m_iHashForCurThemeMetrics;
|
unsigned m_uHashForCurThemeMetrics;
|
||||||
int m_iHashForBaseThemeMetrics;
|
unsigned m_uHashForBaseThemeMetrics;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user