From 63bb4faf7dac4534c8abc5bf9a9924e33c1c6401 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 4 Nov 2006 23:36:11 +0000 Subject: [PATCH] Make NotesWriterDWI also a namespace. --- stepmania/src/NotesWriterDWI.cpp | 16 +++++++++------- stepmania/src/NotesWriterDWI.h | 15 +-------------- stepmania/src/Song.cpp | 3 +-- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 87710dcb32..ab66121727 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -11,8 +11,10 @@ #include "song.h" #include "Steps.h" +static RString OptimizeDWIString( RString holds, RString taps ); + /* Output is an angle bracket expression without angle brackets, eg. "468". */ -RString NotesWriterDWI::NotesToDWIString( const TapNote tnCols[6] ) +static RString NotesToDWIString( const TapNote tnCols[6] ) { const char dirs[] = { '4', 'C', '2', '8', 'D', '6' }; RString taps, holds, ret; @@ -84,7 +86,7 @@ RString NotesWriterDWI::NotesToDWIString( const TapNote tnCols[6] ) return '0';*/ } -RString NotesWriterDWI::NotesToDWIString( TapNote tnCol1, TapNote tnCol2, TapNote tnCol3, TapNote tnCol4, TapNote tnCol5, TapNote tnCol6 ) +static RString NotesToDWIString( TapNote tnCol1, TapNote tnCol2, TapNote tnCol3, TapNote tnCol4, TapNote tnCol5, TapNote tnCol6 ) { TapNote tnCols[6]; tnCols[0] = tnCol1; @@ -96,12 +98,12 @@ RString NotesWriterDWI::NotesToDWIString( TapNote tnCol1, TapNote tnCol2, TapNot return NotesToDWIString( tnCols ); } -RString NotesWriterDWI::NotesToDWIString( TapNote tnCol1, TapNote tnCol2, TapNote tnCol3, TapNote tnCol4 ) +static RString NotesToDWIString( TapNote tnCol1, TapNote tnCol2, TapNote tnCol3, TapNote tnCol4 ) { return NotesToDWIString( tnCol1, TAP_EMPTY, tnCol2, tnCol3, TAP_EMPTY, tnCol4 ); } -char NotesWriterDWI::OptimizeDWIPair( char c1, char c2 ) +static char OptimizeDWIPair( char c1, char c2 ) { typedef pair cpair; static map< cpair, char > joins; @@ -136,7 +138,7 @@ char NotesWriterDWI::OptimizeDWIPair( char c1, char c2 ) return it->second; } -RString NotesWriterDWI::OptimizeDWIString( RString holds, RString taps ) +RString OptimizeDWIString( RString holds, RString taps ) { /* First, sort the holds and taps in ASCII order. This puts 2468 first. * This way 1379 combinations will always be found first, so we'll always @@ -189,7 +191,7 @@ RString NotesWriterDWI::OptimizeDWIString( RString holds, RString taps ) return ssprintf( "<%s>", ret.c_str() ); } -void NotesWriterDWI::WriteDWINotesField( RageFile &f, const Steps &out, int start ) +static void WriteDWINotesField( RageFile &f, const Steps &out, int start ) { NoteData notedata; out.GetNoteData( notedata ); @@ -311,7 +313,7 @@ void NotesWriterDWI::WriteDWINotesField( RageFile &f, const Steps &out, int star } } -bool NotesWriterDWI::WriteDWINotesTag( RageFile &f, const Steps &out ) +static bool WriteDWINotesTag( RageFile &f, const Steps &out ) { if( out.GetDifficulty() == DIFFICULTY_EDIT ) return false; // not supported by DWI diff --git a/stepmania/src/NotesWriterDWI.h b/stepmania/src/NotesWriterDWI.h index 62e5bb248a..461131ca72 100644 --- a/stepmania/src/NotesWriterDWI.h +++ b/stepmania/src/NotesWriterDWI.h @@ -3,22 +3,9 @@ #ifndef NOTES_WRITER_DWI_H #define NOTES_WRITER_DWI_H -#include "NoteTypes.h" - -class RageFile; class Song; -class Steps; -class NotesWriterDWI +namespace NotesWriterDWI { - RString NotesToDWIString( TapNote cNoteCol1, TapNote cNoteCol2, TapNote cNoteCol3, TapNote cNoteCol4, TapNote cNoteCol5, TapNote cNoteCol6 ); - RString NotesToDWIString( TapNote cNoteCol1, TapNote cNoteCol2, TapNote cNoteCol3, TapNote cNoteCol4 ); - void WriteDWINotesField( RageFile &f, const Steps &out, int start ); - bool WriteDWINotesTag( RageFile &f, const Steps &out ); - RString NotesToDWIString( const TapNote cNoteCols[6] ); - RString OptimizeDWIString( RString holds, RString taps ); - char OptimizeDWIPair( char c1, char c2 ); - -public: bool Write( RString sPath, const Song &out ); }; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 18ac192b9f..82d672c303 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -775,8 +775,7 @@ void Song::SaveToDWIFile() if( IsAFile(sPath) ) FileCopy( sPath, sPath + ".old" ); - NotesWriterDWI wr; - wr.Write(sPath, *this); + NotesWriterDWI::Write(sPath, *this); }