Revert. Reloading is a hack and shouldn't be part of the API.

This commit is contained in:
Steve Checkoway
2006-03-18 13:26:01 +00:00
parent dd3206c4fc
commit c4835e0adb
7 changed files with 17 additions and 43 deletions
-5
View File
@@ -77,11 +77,6 @@ void Screen::BeginScreen()
this->RunCommands( THEME->GetMetricA(m_sName, "ScreenOnCommand") ); this->RunCommands( THEME->GetMetricA(m_sName, "ScreenOnCommand") );
} }
void Screen::ReloadScreen()
{
SCREENMAN->SetNewScreen( m_sName );
}
void Screen::Update( float fDeltaTime ) void Screen::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
-3
View File
@@ -48,9 +48,6 @@ public:
/* This is called when the screen is popped. */ /* This is called when the screen is popped. */
virtual void EndScreen() { } virtual void EndScreen() { }
/* Call this to reload the current screen. */
virtual void ReloadScreen();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual bool OverlayInput( const InputEventPlus &input ); virtual bool OverlayInput( const InputEventPlus &input );
virtual void Input( const InputEventPlus &input ); virtual void Input( const InputEventPlus &input );
+3 -3
View File
@@ -166,7 +166,7 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
CourseEntry ce; CourseEntry ce;
CourseUtil::MakeDefaultEditCourseEntry( ce ); CourseUtil::MakeDefaultEditCourseEntry( ce );
pCourse->m_vEntries.insert( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus(), ce ); pCourse->m_vEntries.insert( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus(), ce );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
break; break;
} }
case CourseEntryAction_Delete: case CourseEntryAction_Delete:
@@ -178,7 +178,7 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
} }
pCourse->m_vEntries.erase( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus() ); pCourse->m_vEntries.erase( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus() );
GAMESTATE->m_iEditCourseEntryIndex.Set( GAMESTATE->m_iEditCourseEntryIndex ); GAMESTATE->m_iEditCourseEntryIndex.Set( GAMESTATE->m_iEditCourseEntryIndex );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
break; break;
} }
} }
@@ -312,7 +312,7 @@ void ScreenOptionsEditCourse::ProcessMenuStart( const InputEventPlus &input )
CourseUtil::MakeDefaultEditCourseEntry( ce ); CourseUtil::MakeDefaultEditCourseEntry( ce );
pCourse->m_vEntries.push_back( ce ); pCourse->m_vEntries.push_back( ce );
GAMESTATE->m_iEditCourseEntryIndex.Set( pCourse->m_vEntries.size()-1 ); GAMESTATE->m_iEditCourseEntryIndex.Set( pCourse->m_vEntries.size()-1 );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
else if( iCurRow == (int)m_pRows.size()-1 ) // "done" else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
{ {
+9 -24
View File
@@ -163,11 +163,16 @@ void ScreenOptionsManageCourses::Init()
EDIT_MODE.Load( m_sName,"EditMode" ); EDIT_MODE.Load( m_sName,"EditMode" );
GAMESTATE->m_MasterPlayerNumber = GAMESTATE->GetFirstHumanPlayer(); GAMESTATE->m_MasterPlayerNumber = GAMESTATE->GetFirstHumanPlayer();
RebuildOptionRows();
} }
void ScreenOptionsManageCourses::RebuildOptionRows() void ScreenOptionsManageCourses::BeginScreen()
{ {
if( GAMESTATE->m_stEdit == STEPS_TYPE_INVALID ||
GAMESTATE->m_cdEdit == DIFFICULTY_INVALID )
{
SetNextCombination();
}
vector<OptionRowHandler*> vHands; vector<OptionRowHandler*> vHands;
int iIndex = 0; int iIndex = 0;
@@ -235,19 +240,6 @@ void ScreenOptionsManageCourses::RebuildOptionRows()
} }
ScreenOptions::InitMenu( vHands ); ScreenOptions::InitMenu( vHands );
m_bForceRebuild = false;
}
void ScreenOptionsManageCourses::BeginScreen()
{
if( GAMESTATE->m_stEdit == STEPS_TYPE_INVALID ||
GAMESTATE->m_cdEdit == DIFFICULTY_INVALID )
{
SetNextCombination();
}
if( m_bForceRebuild )
RebuildOptionRows();
ScreenOptions::BeginScreen(); ScreenOptions::BeginScreen();
@@ -265,12 +257,6 @@ void ScreenOptionsManageCourses::BeginScreen()
AfterChangeRow( GAMESTATE->m_MasterPlayerNumber ); AfterChangeRow( GAMESTATE->m_MasterPlayerNumber );
} }
void ScreenOptionsManageCourses::ReloadScreen()
{
m_bForceRebuild = true;
ScreenOptionsEditCourseSubMenu::ReloadScreen();
}
static LocalizedString COURSE_WILL_BE_LOST ( "ScreenOptionsManageCourses", "This course will be lost permanently." ); static LocalizedString COURSE_WILL_BE_LOST ( "ScreenOptionsManageCourses", "This course will be lost permanently." );
static LocalizedString CONTINUE_WITH_DELETE ( "ScreenOptionsManageCourses", "Continue with delete?" ); static LocalizedString CONTINUE_WITH_DELETE ( "ScreenOptionsManageCourses", "Continue with delete?" );
static LocalizedString ENTER_COURSE_NAME ( "ScreenOptionsManageCourses", "Enter a name for the course." ); static LocalizedString ENTER_COURSE_NAME ( "ScreenOptionsManageCourses", "Enter a name for the course." );
@@ -288,7 +274,7 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
if( !pCourse->IsAnEdit() ) if( !pCourse->IsAnEdit() )
FILEMAN->Remove( pCourse->GetCacheFilePath() ); FILEMAN->Remove( pCourse->GetCacheFilePath() );
delete pCourse; delete pCourse;
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
else if( SM == SM_Failure ) else if( SM == SM_Failure )
{ {
@@ -340,7 +326,6 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
WriteCourse(); WriteCourse();
RefreshTrail(); RefreshTrail();
m_bForceRebuild = true;
this->HandleScreenMessage( SM_GoToNextScreen ); this->HandleScreenMessage( SM_GoToNextScreen );
} }
} }
@@ -362,7 +347,7 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
pCourse->m_sPath = sDir + sNewName + sExt; pCourse->m_sPath = sDir + sNewName + sExt;
pCourse->m_sMainTitle = sNewName; pCourse->m_sMainTitle = sNewName;
WriteCourse(); WriteCourse();
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromContextMenu ) else if( SM == SM_BackFromContextMenu )
@@ -24,7 +24,6 @@ class ScreenOptionsManageCourses : public ScreenOptionsEditCourseSubMenu
public: public:
void Init(); void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void ReloadScreen();
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
protected: protected:
@@ -36,11 +35,9 @@ protected:
private: private:
Course *GetCourseWithFocus() const; Course *GetCourseWithFocus() const;
void RebuildOptionRows();
vector<Course*> m_vpCourses; vector<Course*> m_vpCourses;
ThemeMetricEnum<EditMode> EDIT_MODE; ThemeMetricEnum<EditMode> EDIT_MODE;
bool m_bForceRebuild;
}; };
#endif #endif
@@ -161,7 +161,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
return; return;
} }
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromDelete ) else if( SM == SM_BackFromDelete )
@@ -174,7 +174,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
FILEMAN->Remove( pSteps->GetFilename() ); FILEMAN->Remove( pSteps->GetFilename() );
SONGMAN->DeleteSteps( pSteps ); SONGMAN->DeleteSteps( pSteps );
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL ); GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromContextMenu ) else if( SM == SM_BackFromContextMenu )
@@ -185,7 +185,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
RString sNewName = ScreenTextEntry::s_sLastAnswer; RString sNewName = ScreenTextEntry::s_sLastAnswer;
PROFILEMAN->RenameLocalProfile( GAMESTATE->m_sEditLocalProfileID, sNewName ); PROFILEMAN->RenameLocalProfile( GAMESTATE->m_sEditLocalProfileID, sNewName );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromDeleteConfirm ) else if( SM == SM_BackFromDeleteConfirm )
@@ -202,7 +202,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
PROFILEMAN->DeleteLocalProfile( GetLocalProfileIDWithFocus() ); PROFILEMAN->DeleteLocalProfile( GetLocalProfileIDWithFocus() );
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromClearConfirm ) else if( SM == SM_BackFromClearConfirm )
@@ -211,7 +211,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
{ {
GAMESTATE->GetEditLocalProfile()->InitAll(); GAMESTATE->GetEditLocalProfile()->InitAll();
ReloadScreen(); SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromContextMenu ) else if( SM == SM_BackFromContextMenu )