From 418b41ab22675cfb758be62eab7081979a7a939c Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 12 Jun 2006 22:51:43 +0000 Subject: [PATCH] add OptionRowHandler* MakeSimple( const MenuRowDef &mr ) --- stepmania/src/OptionRowHandler.cpp | 43 +++++++++++++++++++++++++++--- stepmania/src/OptionRowHandler.h | 2 ++ stepmania/src/ScreenMiniMenu.cpp | 31 +-------------------- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index d05f970f25..e94e7026ef 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -13,6 +13,7 @@ #include "SongManager.h" #include "Character.h" #include "PrefsManager.h" +#include "SongUtil.h" #include "StepsUtil.h" #include "GameManager.h" #include "Foreach.h" @@ -20,6 +21,8 @@ #include "CommonMetrics.h" #include "CharacterManager.h" #include "ScreenManager.h" +#include "ScreenMiniMenu.h" // for MenuRowDef +#include "FontCharAliases.h" #define ENTRY(s) THEME->GetMetric ("ScreenOptionsMaster",s) #define ENTRY_MODE(s,i) THEME->GetMetric ("ScreenOptionsMaster",ssprintf("%s,%i",(s).c_str(),(i+1))) @@ -333,7 +336,7 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList { vector vpSteps; Song *pSong = GAMESTATE->m_pCurSong; - pSong->GetSteps( vpSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); + SongUtil::GetSteps( pSong, vpSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); StepsUtil::RemoveLockedSteps( pSong, vpSteps ); StepsUtil::SortNotesArrayByDifficulty( vpSteps ); for( unsigned i=0; im_pCurSong->GetStepsByDifficulty( *m_pst, dc ); + Steps* pSteps = SongUtil::GetStepsByDifficulty( GAMESTATE->m_pCurSong, *m_pst, dc ); m_vSteps.push_back( pSteps ); } - GAMESTATE->m_pCurSong->GetSteps( m_vSteps, *m_pst, DIFFICULTY_EDIT ); + SongUtil::GetSteps( GAMESTATE->m_pCurSong, m_vSteps, *m_pst, DIFFICULTY_EDIT ); m_vDifficulties.resize( m_vSteps.size(), DIFFICULTY_EDIT ); if( sParam == "EditSteps" ) @@ -1254,6 +1257,40 @@ OptionRowHandler* OptionRowHandlerUtil::MakeNull() return pHand; } +OptionRowHandler* OptionRowHandlerUtil::MakeSimple( const MenuRowDef &mr ) +{ + OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull(); + + pHand->m_Def.m_sName = mr.sName; + FontCharAliases::ReplaceMarkers( pHand->m_Def.m_sName ); // Allow special characters + + pHand->m_Def.m_vEnabledForPlayers.clear(); + if( mr.pfnEnabled? mr.pfnEnabled():mr.bEnabled ) + { + FOREACH_EnabledPlayer( pn ) + pHand->m_Def.m_vEnabledForPlayers.insert( pn ); + } + + pHand->m_Def.m_bOneChoiceForAllPlayers = true; + pHand->m_Def.m_selectType = SELECT_ONE; + pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; + pHand->m_Def.m_bExportOnChange = false; + + pHand->m_Def.m_vsChoices = mr.choices; + + // Each row must have at least one choice. + if( pHand->m_Def.m_vsChoices.empty() ) + pHand->m_Def.m_vsChoices.push_back( "" ); + + pHand->m_Def.m_bAllowThemeTitle = mr.bThemeTitle; + pHand->m_Def.m_bAllowThemeItems = mr.bThemeItems; + + FOREACH( RString, pHand->m_Def.m_vsChoices, c ) + FontCharAliases::ReplaceMarkers( *c ); // Allow special characters + + return pHand; +} + /* * (c) 2002-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/OptionRowHandler.h b/stepmania/src/OptionRowHandler.h index ca07ca4dca..77b0512520 100644 --- a/stepmania/src/OptionRowHandler.h +++ b/stepmania/src/OptionRowHandler.h @@ -7,6 +7,7 @@ #include "GameCommand.h" #include "LuaReference.h" #include "RageUtil.h" +struct MenuRowDef; struct ConfOption; @@ -60,6 +61,7 @@ namespace OptionRowHandlerUtil { OptionRowHandler* Make( const Commands &cmds ); OptionRowHandler* MakeNull(); + OptionRowHandler* MakeSimple( const MenuRowDef &mrd ); void SelectExactlyOne( int iSelection, vector &vbSelectedOut ); int GetOneSelection( const vector &vbSelected ); diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp index 9543793bef..5a9d2ce560 100644 --- a/stepmania/src/ScreenMiniMenu.cpp +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -70,37 +70,8 @@ void ScreenMiniMenu::LoadMenu( const MenuDef* pDef ) vector vHands; for( unsigned r=0; rm_Def.m_sName = mr.sName; - FontCharAliases::ReplaceMarkers( pHand->m_Def.m_sName ); // Allow special characters - - pHand->m_Def.m_vEnabledForPlayers.clear(); - if( mr.pfnEnabled? mr.pfnEnabled():mr.bEnabled ) - { - FOREACH_EnabledPlayer( pn ) - pHand->m_Def.m_vEnabledForPlayers.insert( pn ); - } - - pHand->m_Def.m_bOneChoiceForAllPlayers = true; - pHand->m_Def.m_selectType = SELECT_ONE; - pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; - pHand->m_Def.m_bExportOnChange = false; - - pHand->m_Def.m_vsChoices = mr.choices; - - // Each row must have at least one choice. - if( pHand->m_Def.m_vsChoices.empty() ) - pHand->m_Def.m_vsChoices.push_back( "" ); - - pHand->m_Def.m_bAllowThemeTitle = mr.bThemeTitle; - pHand->m_Def.m_bAllowThemeItems = mr.bThemeItems; - - FOREACH( RString, pHand->m_Def.m_vsChoices, c ) - FontCharAliases::ReplaceMarkers( *c ); // Allow special characters - + OptionRowHandler *pHand = OptionRowHandlerUtil::MakeSimple( mr ); vHands.push_back( pHand ); }