remove Stats.html

add XML stylesheet for Stats.xml
This commit is contained in:
Chris Danford
2004-07-11 01:58:55 +00:00
parent ec2ed49e2f
commit c301e1eb83
14 changed files with 102 additions and 1626 deletions
+28 -3
View File
@@ -10,12 +10,14 @@
#include "StepsUtil.h"
#include "CourseUtil.h"
#include "TrailUtil.h"
#include "GameState.h"
#include <set>
#include "Foreach.h"
const CString CATALOG_XML = "Catalog.xml";
void SaveCatalogXml( CString sDir )
void SaveCatalogXml()
{
CString fn = sDir + CATALOG_XML;
CString fn = CATALOG_XML_FILE;
LOG->Trace( "Writing %s ...", fn.c_str() );
@@ -87,6 +89,29 @@ void SaveCatalogXml( CString sDir )
}
}
{
XNode* pNode = xml.AppendChild( "DifficultiesToShow" );
set<Difficulty> vDiffs;
GAMESTATE->GetDifficultiesToShow( vDiffs );
for( set<Difficulty>::const_iterator iter = vDiffs.begin(); iter != vDiffs.end(); iter++ )
{
pNode->AppendChild( "Difficulty", DifficultyToString(*iter) );
}
}
{
XNode* pNode = xml.AppendChild( "CourseDifficultiesToShow" );
set<CourseDifficulty> vDiffs;
GAMESTATE->GetCourseDifficultiesToShow( vDiffs );
for( set<CourseDifficulty>::const_iterator iter = vDiffs.begin(); iter != vDiffs.end(); iter++ )
{
pNode->AppendChild( "CourseDifficulty", DifficultyToString(*iter) );
}
}
xml.SaveToFile(fn);
LOG->Trace( "Done." );
+6 -1
View File
@@ -3,7 +3,12 @@
#ifndef CATALOG_XML_H
#define CATALOG_XML_H
void SaveCatalogXml( CString sDir );
#include "GameConstantsAndTypes.h"
const CString CATALOG_XML = "Catalog.xml";
const CString CATALOG_XML_FILE = DATA_DIR + "Catalog.xml";
void SaveCatalogXml();
#endif
+1 -1
View File
@@ -297,7 +297,7 @@ const int ITEM_NONE = -1;
#define BG_ANIMS_DIR CString("BGAnimations/")
#define VISUALIZATIONS_DIR CString("Visualizations/")
#define RANDOMMOVIES_DIR CString("RandomMovies/")
#define DATA_DIR CString("Data/")
//
+39 -21
View File
@@ -1674,34 +1674,52 @@ bool GameState::ChangePreferredDifficulty( PlayerNumber pn, Difficulty dc )
return true;
}
bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir )
void GameState::GetDifficultiesToShow( set<Difficulty> &ret )
{
// FIXME: This clamps to between the min and the max difficulty, but
// it really should round to the nearest difficulty that's in
// DIFFICULTIES_TO_SHOW.
CStringArray asDiff;
split( DIFFICULTIES_TO_SHOW, ",", asDiff );
Difficulty mind = (Difficulty)(NUM_DIFFICULTIES-1);
Difficulty maxd = (Difficulty)0;
for( unsigned i=0; i<asDiff.size(); i++ )
static float fExpiration = -999;
static set<Difficulty> cache;
if( RageTimer::GetTimeSinceStart() < fExpiration )
{
Difficulty d = StringToDifficulty( asDiff[i] );
if( d == DIFFICULTY_INVALID )
continue;
mind = min( mind, d );
maxd = max( maxd, d );
ret = cache;
return;
}
Difficulty diff = (Difficulty)(m_PreferredDifficulty[pn]+dir);
CStringArray asDiff;
split( DIFFICULTIES_TO_SHOW, ",", asDiff );
ASSERT( asDiff.size() > 0 );
if( diff < mind || diff > maxd )
return false;
cache.clear();
for( unsigned i = 0; i < asDiff.size(); ++i )
{
Difficulty d = StringToDifficulty(asDiff[i]);
if( d == DIFFICULTY_INVALID )
RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow", asDiff[i].c_str() );
cache.insert( d );
}
return ChangePreferredDifficulty( pn, diff );
fExpiration = RageTimer::GetTimeSinceStart()+1;
ret = cache;
}
static void GetCourseDifficultiesToShow( set<CourseDifficulty> &ret )
bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir )
{
set<Difficulty> asDiff;
GetDifficultiesToShow( asDiff );
Difficulty d = m_PreferredDifficulty[pn];
while( 1 )
{
d = (Difficulty)(d+dir);
if( d < 0 || d >= NUM_DIFFICULTIES )
return false;
if( asDiff.find(d) == asDiff.end() )
continue; /* not available */
}
return ChangePreferredDifficulty( pn, d );
}
void GameState::GetCourseDifficultiesToShow( set<CourseDifficulty> &ret )
{
static float fExpiration = -999;
static set<CourseDifficulty> cache;
@@ -1719,7 +1737,7 @@ static void GetCourseDifficultiesToShow( set<CourseDifficulty> &ret )
for( unsigned i = 0; i < asDiff.size(); ++i )
{
CourseDifficulty cd = StringToCourseDifficulty(asDiff[i]);
if( cd == NUM_DIFFICULTIES )
if( cd == DIFFICULTY_INVALID )
RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow", asDiff[i].c_str() );
cache.insert( cd );
}
+7
View File
@@ -13,6 +13,7 @@
#include <map>
#include <deque>
#include <set>
class Song;
class Steps;
@@ -288,6 +289,12 @@ public:
//
int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting
bool IsTimeToPlayAttractSounds();
//
// DifficultiesToShow stuff
//
void GetDifficultiesToShow( set<Difficulty> &AddTo );
void GetCourseDifficultiesToShow( set<CourseDifficulty> &AddTo );
};
+1 -1
View File
@@ -64,7 +64,7 @@ NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesL
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
NotesLoaderSM.cpp NotesLoaderSM.h NotesWriterDWI.cpp NotesWriterDWI.h NotesWriterSM.cpp NotesWriterSM.h \
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h Profile.cpp Profile.h \
ProfileHtml.cpp ProfileHtml.h RandomSample.cpp RandomSample.h ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
RandomSample.cpp RandomSample.h ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
ScoreKeeperRave.cpp ScoreKeeperRave.h Song.cpp song.h SongCacheIndex.cpp SongCacheIndex.h \
SongOptions.cpp SongOptions.h SongUtil.cpp SongUtil.h StageStats.cpp StageStats.h Steps.cpp Steps.h \
StepsUtil.cpp StepsUtil.h Style.cpp Style.h \
+10 -9
View File
@@ -14,7 +14,6 @@
#include <ctime>
#include "ThemeManager.h"
#include "CryptManager.h"
#include "ProfileHtml.h"
#include "ProfileManager.h"
#include "RageFileManager.h"
#include "ScoreKeeperMAX2.h"
@@ -22,11 +21,13 @@
#include "UnlockSystem.h"
#include "XmlFile.h"
#include "Foreach.h"
#include "CatalogXml.h"
//
// Old file versions for backward compatibility
//
#define SM_300_STATISTICS_INI "statistics.ini"
const CString STYLE_XSL = "Style.xsl";
const CString STYLE_CSS = "Style.css";
#define GUID_SIZE_BYTES 8
@@ -678,7 +679,10 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
xml.AppendChild( SaveAwardsCreateNode() );
xml.AppendChild( SaveRecentSongScoresCreateNode() );
xml.AppendChild( SaveRecentCourseScoresCreateNode() );
bool bSaved = xml.SaveToFile(fn);
DISP_OPT opts = optDefault;
opts.stylesheet = STYLE_XSL;
bool bSaved = xml.SaveToFile(fn, &opts);
// Update file cache, or else IsAFile in CryptManager won't see this new file.
FILEMAN->FlushDirCache( sDir );
@@ -1257,12 +1261,9 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const
{
ASSERT( PROFILEMAN );
SaveStatsWebPage(
sDir,
this,
PROFILEMAN->GetMachineProfile(),
IsMachine() ? HTML_TYPE_MACHINE : HTML_TYPE_PLAYER
);
FileCopy( THEME->GetPathO("Profile",STYLE_XSL), sDir+STYLE_XSL );
FileCopy( THEME->GetPathO("Profile",STYLE_CSS), sDir+STYLE_CSS );
FileCopy( CATALOG_XML_FILE, sDir+CATALOG_XML );
}
void Profile::SaveMachinePublicKeyToDir( CString sDir ) const
File diff suppressed because it is too large Load Diff
-42
View File
@@ -1,42 +0,0 @@
/* ProfileHtml - Helpers for generating an HTML web page based on Profile data. */
#ifndef ProfileHtml_H
#define ProfileHtml_H
#include "Profile.h"
enum HtmlType { HTML_TYPE_MACHINE, HTML_TYPE_PLAYER };
void SaveStatsWebPage(
CString sDir,
const Profile *pProfile,
const Profile *pMachineProfile,
HtmlType htmlType
);
#endif
/*
* (c) 2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -2
View File
@@ -33,7 +33,6 @@ SongManager* SONGMAN = NULL; // global and accessable from anywhere in our progr
#define SONGS_DIR "Songs/"
#define COURSES_DIR "Courses/"
#define DATA_DIR "Data/"
#define MAX_EDITS_PER_PROFILE 200
@@ -93,7 +92,7 @@ void SongManager::InitAll( LoadingWindow *ld )
* even visible, we should be fixing it, not showing a progress display. */
if( ld )
ld->SetText( "Saving Catalog.xml ..." );
SaveCatalogXml( DATA_DIR );
SaveCatalogXml();
}
void SongManager::Reload( LoadingWindow *ld )
+5 -13
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -59,10 +59,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\temp\stepmania\Program
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -96,10 +96,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /pdb:none /debug
# Begin Special Build Tool
IntDir=.\../Release6
TargetDir=\temp\stepmania\Program
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -884,14 +884,6 @@ SOURCE=.\Profile.h
# End Source File
# Begin Source File
SOURCE=.\ProfileHtml.cpp
# End Source File
# Begin Source File
SOURCE=.\ProfileHtml.h
# End Source File
# Begin Source File
SOURCE=.\RandomSample.cpp
# End Source File
# Begin Source File
-6
View File
@@ -794,12 +794,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="Profile.h">
</File>
<File
RelativePath="ProfileHtml.cpp">
</File>
<File
RelativePath="ProfileHtml.h">
</File>
<File
RelativePath=".\RandomSample.cpp">
</File>
+3
View File
@@ -1230,6 +1230,9 @@ bool XNode::SaveToFile( CString sFile, LPDISP_OPT opt )
LOG->Warn("Couldn't open %s for writing: %s", sFile.c_str(), f.GetError().c_str() );
return false;
}
f.PutLine( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" );
if( !opt->stylesheet.empty() )
f.PutLine( "<?xml-stylesheet type=\"text/xsl\" href=\"" + opt->stylesheet + "\"?>" );
if( !this->GetXML(f, opt) )
return false;
if( f.Flush() == -1 )
+1
View File
@@ -91,6 +91,7 @@ struct DISP_OPT
bool newline; // newline when new tag
bool reference_value; // do convert from entity to reference ( < -> &lt; )
LPXENTITYS entitys; // entity table for entity encode
CString stylesheet; // empty string = none
int tab_base; // internal usage
DISP_OPT() { newline = true; reference_value = true; entitys = &entityDefault; tab_base = 0; }