From f2e0053c7defe6d5e5a95fd20113d01e174211bd Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 17 Dec 2006 08:00:03 +0000 Subject: [PATCH] Make* -> Driver::Create. Having these floating in arch.h isn't useful; if you create the class, you need the class definition to free it, and anyone creating a class is probably going to use it, too. --- stepmania/src/RageSoundManager.cpp | 3 +-- stepmania/src/StepMania.cpp | 2 +- stepmania/src/arch/ArchHooks/ArchHooks.cpp | 2 +- stepmania/src/arch/ArchHooks/ArchHooks.h | 2 ++ stepmania/src/arch/MovieTexture/MovieTexture.cpp | 2 +- stepmania/src/arch/MovieTexture/MovieTexture.h | 2 ++ stepmania/src/arch/Sound/RageSoundDriver.cpp | 2 +- stepmania/src/arch/Sound/RageSoundDriver.h | 2 ++ 8 files changed, 11 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 4de9e74b20..bac1551c24 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -21,7 +21,6 @@ #include "arch/Sound/RageSoundDriver.h" -#include "arch/arch.h" #include "arch/arch_default.h" /* @@ -52,7 +51,7 @@ void RageSoundManager::Init() if( sDrivers.empty() ) sDrivers = DEFAULT_SOUND_DRIVER_LIST; - m_pDriver = MakeRageSoundDriver( sDrivers ); + m_pDriver = RageSoundDriver::Create( sDrivers ); if( m_pDriver == NULL ) RageException::Throw( "%s", COULDNT_FIND_SOUND_DRIVER.GetValue().c_str() ); } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index f34a3f0fa4..fb0c5bfb90 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -896,7 +896,7 @@ int main(int argc, char* argv[]) SetCommandlineArguments( argc, argv ); /* Set up arch hooks first. This may set up crash handling. */ - HOOKS = MakeArchHooks(); + HOOKS = ArchHooks::Create(); HOOKS->Init(); #if !defined(DEBUG) /* Tricky: for other exceptions, we want a backtrace. To do this in Windows, diff --git a/stepmania/src/arch/ArchHooks/ArchHooks.cpp b/stepmania/src/arch/ArchHooks/ArchHooks.cpp index fee6c3352d..46451523e3 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks.cpp @@ -50,7 +50,7 @@ bool ArchHooks::GoToURL( RString sUrl ) return false; } -ArchHooks *MakeArchHooks() +ArchHooks *ArchHooks::Create() { return new ARCH_HOOKS; } diff --git a/stepmania/src/arch/ArchHooks/ArchHooks.h b/stepmania/src/arch/ArchHooks/ArchHooks.h index e04a111333..1d75104ee0 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks.h @@ -4,6 +4,8 @@ class ArchHooks { public: + static ArchHooks *Create(); + ArchHooks(): m_bHasFocus(true), m_bFocusChanged(false) { } virtual ~ArchHooks() { } virtual void Init() { } diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.cpp b/stepmania/src/arch/MovieTexture/MovieTexture.cpp index 604e24846d..82f9aa22cb 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture.cpp @@ -77,7 +77,7 @@ static Preference g_sMovieDrivers( "MovieDrivers", "" ); // "" == defau /* Try drivers in order of preference until we find one that works. */ static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); -RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) +RageMovieTexture *RageMovieTexture::Create( RageTextureID ID ) { DumpAVIDebugInfo( ID.filename ); diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.h b/stepmania/src/arch/MovieTexture/MovieTexture.h index 2746007d6a..43f20165d6 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture.h @@ -8,6 +8,8 @@ class RageMovieTexture : public RageTexture { public: + static RageMovieTexture *Create( RageTextureID ID ); + RageMovieTexture( RageTextureID ID ): RageTexture(ID) { } virtual ~RageMovieTexture() { } virtual void Update( float fDeltaTime ) { } diff --git a/stepmania/src/arch/Sound/RageSoundDriver.cpp b/stepmania/src/arch/Sound/RageSoundDriver.cpp index cd9f4a7830..97b8988916 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver.cpp @@ -11,7 +11,7 @@ RegisterSoundDriver::RegisterSoundDriver( const istring &sName, CreateRageDriver g_pRegistrees.Add( sName, pfn ); } -RageSoundDriver *MakeRageSoundDriver( const RString &drivers ) +RageSoundDriver *RageSoundDriver::Create( const RString &drivers ) { vector DriversToTry; split( drivers, ",", DriversToTry, true ); diff --git a/stepmania/src/arch/Sound/RageSoundDriver.h b/stepmania/src/arch/Sound/RageSoundDriver.h index ec2ea3fadd..9be106aaf8 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver.h +++ b/stepmania/src/arch/Sound/RageSoundDriver.h @@ -8,6 +8,8 @@ class RageSoundBase; class RageSoundDriver: public RageDriver { public: + static RageSoundDriver *Create( const RString &sDrivers ); + friend class RageSoundManager; /* Initialize. On failure, an error message is returned. */