当前位置: 首页>>代码示例>>C++>>正文


C++ Course::GetCourseType方法代码示例

本文整理汇总了C++中Course::GetCourseType方法的典型用法代码示例。如果您正苦于以下问题:C++ Course::GetCourseType方法的具体用法?C++ Course::GetCourseType怎么用?C++ Course::GetCourseType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Course的用法示例。


在下文中一共展示了Course::GetCourseType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetSong


//.........这里部分代码省略.........
		if( GAMESTATE->m_PreferredDifficulty[PLAYER_1] != Difficulty_Invalid )
		{
			vDifficultiesToShow.push_back( GAMESTATE->m_PreferredDifficulty[PLAYER_1] );
		}
		else
		{
			FOREACH_ENUM( Difficulty, dc )
				vDifficultiesToShow.push_back( dc );
		}
	}

	ASSERT( !vDifficultiesToShow.empty() );

	// Search for a Song and Steps to play during the demo.
	for( int i=0; i<1000; i++ )
	{
		Song* pSong = vSongs[RandomInt(vSongs.size())];

		ASSERT( pSong != NULL );
		if( !pSong->HasMusic() )
			continue;	// skip
		if( !pSong->NormallyDisplayed() )
			continue;
		if( !pSong->ShowInDemonstrationAndRanking() )
			continue;	// skip

		Difficulty dc = vDifficultiesToShow[ RandomInt(vDifficultiesToShow.size()) ];
		Steps* pSteps = SongUtil::GetStepsByDifficulty( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, dc );

		if( pSteps == NULL )
			continue;	// skip

		if( !PREFSMAN->m_bAutogenSteps && pSteps->IsAutogen())
			continue;	// skip

		// Found something we can use!
		GAMESTATE->m_pCurSong.Set( pSong );
		// We just changed the song. Reset the original sync data.
		AdjustSync::ResetOriginalSyncData();
		FOREACH_PlayerNumber( p )
			GAMESTATE->m_pCurSteps[p].Set( pSteps );

		bool bShowModifiers = randomf(0,1) <= SHOW_COURSE_MODIFIERS_PROBABILITY;
		if( bShowModifiers )
		{
			/* If we have a modifier course containing this song, apply its
			 * modifiers. Only check fixed course entries. */
			vector<Course*> apCourses;
			SONGMAN->GetAllCourses( apCourses, false );
			vector<const CourseEntry *> apOptions;
			vector<Course*> apPossibleCourses;
			for( unsigned j = 0; j < apCourses.size(); ++j )
			{
				Course *lCourse = apCourses[j];
				const CourseEntry *pEntry = lCourse->FindFixedSong( pSong );
				if( pEntry == NULL || pEntry->attacks.size() == 0 )
					continue;

				if( !ALLOW_ADVANCED_MODIFIERS )
				{
					// There are some confusing mods that we don't want to show in demonstration.
					bool bModsAreOkToShow = true;
					AttackArray aAttacks = pEntry->attacks;
					if( !pEntry->sModifiers.empty() )
						aAttacks.push_back( Attack::FromGlobalCourseModifier( pEntry->sModifiers ) );
					FOREACH_CONST( Attack, aAttacks, a )
					{
						RString s = a->sModifiers;
						s.MakeLower();
						// todo: allow themers to modify this list? -aj
						if( s.find("dark") != string::npos ||
							s.find("stealth") != string::npos )
						{
							bModsAreOkToShow = false;
							break;
						}
					}
					if( !bModsAreOkToShow )
						continue;	// skip
				}

				apOptions.push_back( pEntry );
				apPossibleCourses.push_back( pCourse );
			}

			if( !apOptions.empty() )
			{
				int iIndex = RandomInt( apOptions.size() );
				m_pCourseEntry = apOptions[iIndex];
				Course *lCourse = apPossibleCourses[iIndex]; 

				PlayMode pm = CourseTypeToPlayMode( lCourse->GetCourseType() );
				GAMESTATE->m_PlayMode.Set( pm );
				GAMESTATE->m_pCurCourse.Set( lCourse );
				FOREACH_PlayerNumber( p )
				{
					GAMESTATE->m_pCurTrail[p].Set( lCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType ) );
					ASSERT( GAMESTATE->m_pCurTrail[p] != NULL );
				}
			}
开发者ID:Ancaro,项目名称:stepmania,代码行数:101,代码来源:ScreenJukebox.cpp

示例2: SetSong


//.........这里部分代码省略.........
		{
			FOREACH_Difficulty( dc )
				vDifficultiesToShow.push_back( dc );
		}
	}

	ASSERT( !vDifficultiesToShow.empty() )

	//
	// Search for a Song and Steps to play during the demo
	//
	for( int i=0; i<1000; i++ )
	{
		if( vSongs.size() == 0 )
			return;

		Song* pSong = vSongs[rand()%vSongs.size()];

		if( !pSong->HasMusic() )
			continue;	// skip
		if( UNLOCKMAN->SongIsLocked(pSong) )
			continue;
		if( !pSong->ShowInDemonstrationAndRanking() )
			continue;	// skip

		Difficulty dc = vDifficultiesToShow[ rand()%vDifficultiesToShow.size() ];
		Steps* pSteps = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyle()->m_StepsType, dc );

		if( pSteps == NULL )
			continue;	// skip

		if( !PREFSMAN->m_bAutogenSteps && pSteps->IsAutogen())
			continue;	// skip

		// Found something we can use!
		GAMESTATE->m_pCurSong.Set( pSong );
		// We just changed the song. Reset the original sync data.
		GAMESTATE->ResetOriginalSyncData();
		FOREACH_PlayerNumber( p )
			GAMESTATE->m_pCurSteps[p].Set( pSteps );
		

		bool bShowModifiers = randomf(0,1) <= SHOW_COURSE_MODIFIERS_PROBABILITY;
		if( bShowModifiers )
		{
			/* If we have a modifier course containing this song, apply its modifiers.  Only check
			 * fixed course entries. */
			vector<Course*> apCourses;
			SONGMAN->GetAllCourses( apCourses, false );
			vector<const CourseEntry *> apOptions;
			vector<Course*> apPossibleCourses;
			for( unsigned i = 0; i < apCourses.size(); ++i )
			{
				Course *pCourse = apCourses[i];
				const CourseEntry *pEntry = pCourse->FindFixedSong( pSong );
				if( pEntry == NULL || pEntry->attacks.size() == 0 )
					continue;
				

				if( !ALLOW_ADVANCED_MODIFIERS )
				{
					// There are some confusing mods that we don't want to show in demonstration.
					bool bModsAreOkToShow = true;
					AttackArray aAttacks = pEntry->attacks;
					if( !pEntry->modifiers.empty() )
						aAttacks.push_back( Attack::FromGlobalCourseModifier( pEntry->modifiers ) );
					FOREACH_CONST( Attack, aAttacks, a )
					{
						CString s = a->sModifiers;
						s.MakeLower();
						if( s.find("dark") != CString::npos ||
							s.find("stealth") != CString::npos )
						{
							bModsAreOkToShow = false;
							break;
						}
					}
					if( !bModsAreOkToShow )
						continue;	// skip
				}


				apOptions.push_back( pEntry );
				apPossibleCourses.push_back( pCourse );
			}

			if( !apOptions.empty() )
			{
				int iIndex = rand()%apOptions.size();
				m_pCourseEntry = apOptions[iIndex];
				Course *pCourse = apPossibleCourses[iIndex]; 
			
				GAMESTATE->m_PlayMode = CourseTypeToPlayMode( pCourse->GetCourseType() );
				GAMESTATE->m_pCurCourse.Set( pCourse );
				FOREACH_PlayerNumber( p )
				{
					GAMESTATE->m_pCurTrail[p].Set( pCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType ) );
					ASSERT( GAMESTATE->m_pCurTrail[p] );
				}
			}
开发者ID:BitMax,项目名称:openitg,代码行数:101,代码来源:ScreenJukebox.cpp


注:本文中的Course::GetCourseType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。