• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FAIL_M函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FAIL_M函数的典型用法代码示例。如果您正苦于以下问题:C++ FAIL_M函数的具体用法?C++ FAIL_M怎么用?C++ FAIL_M使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ap

// szNameArray is of size iMax; pNameCache is of size iMax+2.
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr<RString> *pNameCache )
{
	if( unlikely(pNameCache[0].get() == NULL) )
	{
		for( int i = 0; i < iMax; ++i )
		{
			auto_ptr<RString> ap( new RString( szNameArray[i] ) );
			pNameCache[i] = ap;
		}

		auto_ptr<RString> ap( new RString );
		pNameCache[iMax+1] = ap;
	}

	// iMax+1 is "Invalid".  iMax+0 is the NUM_ size value, which can not be converted
	// to a string.
	// Maybe we should assert on _Invalid?  It seems better to make 
	// the caller check that they're supplying a valid enum value instead of 
	// returning an inconspicuous garbage value (empty string). -Chris
	if (iVal < 0)
		FAIL_M(ssprintf("Value %i cannot be negative for enums! Enum hint: %s", iVal, szNameArray[0]));
	if (iVal == iMax)
		FAIL_M(ssprintf("Value %i cannot be a string with value %i! Enum hint: %s", iVal, iMax, szNameArray[0]));
	if (iVal > iMax+1)
		FAIL_M(ssprintf("Value %i is past the invalid value %i! Enum hint: %s", iVal, iMax, szNameArray[0]));
	return *pNameCache[iVal];
}
开发者ID:Pisces000221,项目名称:stepmania,代码行数:28,代码来源:EnumHelper.cpp


示例2: CloseDevice

	void CloseDevice()
	{
		MMRESULT mRes=0;
		
		if(m_hWaveIn)
		{
			UnPrepareBuffers();
			mRes=waveInClose(m_hWaveIn);
		}
		if(m_hOPFile)
		{
			mRes=mmioAscend(m_hOPFile, &m_stckOut, 0);
			if(mRes!=MMSYSERR_NOERROR)
			{
				FAIL_M("bad");
			}
			mRes=mmioAscend(m_hOPFile, &m_stckOutRIFF, 0);
			if(mRes!=MMSYSERR_NOERROR)
			{
				FAIL_M("bad");
			}
			mmioClose(m_hOPFile,0);
			m_hOPFile=NULL;
		}
		m_hWaveIn=NULL;
	}
开发者ID:goofwear,项目名称:stepmania,代码行数:26,代码来源:PitchDetectionTest.cpp


示例3: FAIL_M

bool RageSoundDriver_OSS::GetData()
{
	/* Look for a free buffer. */
	audio_buf_info ab;
	if( ioctl(fd, SNDCTL_DSP_GETOSPACE, &ab) == -1 )
		FAIL_M( ssprintf("ioctl(SNDCTL_DSP_GETOSPACE): %s", strerror(errno)) );

	if( !ab.fragments )
		return false;
		
	const int chunksize = ab.fragsize;
	
	static int16_t *buf = NULL;
	if(!buf)
		buf = new int16_t[chunksize / sizeof(int16_t)];

	this->Mix( buf, chunksize/bytes_per_frame, last_cursor_pos, GetPosition() );

	int wrote = write( fd, buf, chunksize );
  	if( wrote != chunksize )
		FAIL_M( ssprintf("write didn't: %i (%s)", wrote, wrote == -1? strerror(errno): "") );

	/* Increment last_cursor_pos. */
	last_cursor_pos += chunksize / bytes_per_frame;

	return true;
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:27,代码来源:RageSoundDriver_OSS.cpp


示例4: PathForFolderType

static void PathForFolderType( char dir[PATH_MAX], OSType folderType )
{
	FSRef fs;

	if( FSFindFolder(kUserDomain, folderType, kDontCreateFolder, &fs) )
		FAIL_M( ssprintf("FSFindFolder(%lu) failed.", folderType) );
	if( FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
		FAIL_M( "FSRefMakePath() failed." );
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:9,代码来源:ArchHooks_MacOSX.cpp


示例5: FAIL_M

void InputHandler::ButtonPressed( DeviceInput di, bool Down )
{
	if( di.ts.IsZero() )
	{
		di.ts = m_LastUpdate.Half();
		++m_iInputsSinceUpdate;
	}

	INPUTFILTER->ButtonPressed( di, Down );

	if( m_iInputsSinceUpdate >= 50 )
	{
		/*
		 * We havn't received an update in a long time, so warn about it.  We expect to receive
		 * input events before the first UpdateTimer call only on the first update.  Leave
		 * m_iInputsSinceUpdate where it is, so we only warn once.  Only updates that didn't provide
		 * a timestamp are counted; if the driver provides its own timestamps, UpdateTimer is
		 * optional.
		 *
		 * This can also happen if a device sends a lot of inputs at once; for example, a keyboard
		 * driver that sends every key in one frame.  If that's really needed (wasteful), increase
		 * the threshold.
		 */
		LOG->Warn( "InputHandler::ButtonPressed: Driver sent 50 updates without calling UpdateTimer" );
		FAIL_M("x");
	}
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:27,代码来源:InputHandler.cpp


示例6: switch

void Course::SetCourseType( CourseType ct )
{
	if( GetCourseType() == ct )
		return;

	m_bRepeat = false;
	m_iLives = -1;
	if( !m_vEntries.empty() )
		m_vEntries[0].fGainSeconds = 0;

	switch( ct )
	{
	default:
		FAIL_M(ssprintf("Invalid course type: %i", ct));
	case COURSE_TYPE_NONSTOP:
		break;
	case COURSE_TYPE_ONI:
		m_iLives = 4;
		break;
	case COURSE_TYPE_ENDLESS:
		m_bRepeat = true;
		break;
	case COURSE_TYPE_SURVIVAL:
		if( !m_vEntries.empty() )
			m_vEntries[0].fGainSeconds = 120;
		break;
	}
}
开发者ID:Jousway,项目名称:stepmania,代码行数:28,代码来源:Course.cpp


示例7: ASSERT

void ModelManager::UnloadModel( RageModelGeometry *m )
{
	m->m_iRefCount--;
	ASSERT( m->m_iRefCount >= 0 );

	if( m->m_iRefCount )
		return; /* Can't unload models that are still referenced. */

	for( auto i = m_mapFileToGeometry.begin(); i != m_mapFileToGeometry.end(); ++i )
	{
		if( i->second == m )
		{
			if( m_Prefs.m_bDelayedUnload )
			{
				// leave this geometry loaded
				return;
			}
			else
			{
				m_mapFileToGeometry.erase( i );	// remove map entry
				Rage::safe_delete( m );	// free the texture
				return;
			}
		}
	}

	FAIL_M("Tried to delete a texture that wasn't loaded");
}
开发者ID:dguzek,项目名称:stepmania,代码行数:28,代码来源:ModelManager.cpp


示例8: FAIL_M

void Alsa9Buf::SetSampleRate(int hz)
{
	samplerate = hz;
	samplerate_set_explicitly = true;

	if( !SetHWParams() )
	{
		/*
		 * If this fails, we're no longer set up; if we call SW param calls,
		 * ALSA will assert out on us (instead of gracefully returning an error).
		 *
		 * If we fail here, it means we set up the initial stream, but can't
		 * configure it to the sample rate we want.  This happened on a CS46xx
		 * with an old ALSA version, at least: snd_pcm_hw_params failed
		 * with ENOMEM.  It set up only 10 44.1khz streams; it may have been
		 * trying to increase one to 48khz and, for some reason, that needed
		 * more card memory.  (I've tried to work around that by setting up
		 * streams as 48khz to begin with, so we set it up as the maximum
		 * to begin with.)
		 */
		FAIL_M( ssprintf("SetHWParams(%i) failed", hz) );
	}

	SetSWParams();
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:25,代码来源:ALSA9Helpers.cpp


示例9: FixLilEndian

static void FixLilEndian()
{
#if defined(ENDIAN_LITTLE)
	static bool Initialized = false;
	if( Initialized )
		return; 
	Initialized = true;

	for( int i = 0; i < AVPixelFormats[i].bpp; ++i )
	{
		AVPixelFormat_t &pf = AVPixelFormats[i];

		if( !pf.bByteSwapOnLittleEndian )
			continue;

		for( int mask = 0; mask < 4; ++mask)
		{
			int m = pf.masks[mask];
			switch( pf.bpp )
			{
				case 24: m = Swap24(m); break;
				case 32: m = Swap32(m); break;
				default:
					 FAIL_M(ssprintf("Unsupported BPP value: %i", pf.bpp));
			}
			pf.masks[mask] = m;
		}
	}
#endif
}
开发者ID:InuSasha,项目名称:stepmania,代码行数:30,代码来源:MovieTexture_FFMpeg.cpp


示例10: switch

void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats )
{
	LifeMeter::Load( pPlayerState, pPlayerStageStats );

	PlayerNumber pn = pPlayerState->m_PlayerNumber;

	DrainType dtype = pPlayerState->m_PlayerOptions.GetStage().m_DrainType;
	switch( dtype )
	{
		case DrainType_Normal:
			m_fLifePercentage = INITIAL_VALUE;
			break;
			/* These types only go down, so they always start at full. */
		case DrainType_NoRecover:
		case DrainType_SuddenDeath:
			m_fLifePercentage = 1.0f;	break;
		default:
			FAIL_M(ssprintf("Invalid DrainType: %i", dtype));
	}

	// Change life difficulty to really easy if merciful beginner on
	m_bMercifulBeginnerInEffect = 
		GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR  &&  
		GAMESTATE->IsPlayerEnabled( pPlayerState )  &&
		GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == Difficulty_Beginner  &&
		PREFSMAN->m_bMercifulBeginner;

	AfterLifeChanged();
}
开发者ID:Charence,项目名称:stepmania,代码行数:29,代码来源:LifeMeterBar.cpp


示例11: switch

void LifeMeterTime::ChangeLife( TapNoteScore tns )
{
	if( GetLifeSeconds() <= 0 )
		return;

	float fMeterChange = 0;
	switch( tns )
	{
	default:
		FAIL_M(ssprintf("Invalid TapNoteScore: %i", tns));
	case TNS_W1:		fMeterChange = g_fTimeMeterSecondsChange[SE_W1];		break;
	case TNS_W2:		fMeterChange = g_fTimeMeterSecondsChange[SE_W2];		break;
	case TNS_W3:		fMeterChange = g_fTimeMeterSecondsChange[SE_W3];		break;
	case TNS_W4:		fMeterChange = g_fTimeMeterSecondsChange[SE_W4];		break;
	case TNS_W5:		fMeterChange = g_fTimeMeterSecondsChange[SE_W5];		break;
	case TNS_Miss:		fMeterChange = g_fTimeMeterSecondsChange[SE_Miss];		break;
	case TNS_HitMine:	fMeterChange = g_fTimeMeterSecondsChange[SE_HitMine];		break;
	case TNS_CheckpointHit:	fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointHit];	break;
	case TNS_CheckpointMiss:fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointMiss];	break;
	}

	float fOldLife = m_fLifeTotalLostSeconds;
	m_fLifeTotalLostSeconds -= fMeterChange;
	SendLifeChangedMessage( fOldLife, tns, HoldNoteScore_Invalid );
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:25,代码来源:LifeMeterTime.cpp


示例12: switch

int ScoreKeeperMAX2::TapNoteScoreToGradePoints( TapNoteScore tns, bool bBeginner )
{
	if( !GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS )
		tns = TNS_PERFECT;

	/* This is used for Oni percentage displays.  Grading values are currently in
	 * StageStats::GetGrade. */
	int iWeight = 0;
	switch( tns )
	{
	case TNS_NONE:			iWeight = 0;
	case TNS_AVOIDED_MINE:	iWeight = 0;
	case TNS_HIT_MINE:		iWeight = PREFSMAN->m_iGradeWeightHitMine;	break;
	case TNS_MISS:			iWeight = PREFSMAN->m_iGradeWeightMiss;		break;
	case TNS_BOO:			iWeight = PREFSMAN->m_iGradeWeightBoo;		break;
	case TNS_GOOD:			iWeight = PREFSMAN->m_iGradeWeightGood;		break;
	case TNS_GREAT:			iWeight = PREFSMAN->m_iGradeWeightGreat;	break;
	case TNS_PERFECT:		iWeight = PREFSMAN->m_iGradeWeightPerfect;	break;
	case TNS_MARVELOUS:		iWeight = PREFSMAN->m_iGradeWeightMarvelous;break;
	default: FAIL_M( ssprintf("%i", tns) );
	}
	if( bBeginner && PREFSMAN->m_bMercifulBeginner )
		iWeight = max( 0, iWeight );
	return iWeight;
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:25,代码来源:ScoreKeeperMAX2.cpp


示例13: URLRageFile_open

int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags )
{
	if( strncmp( filename, "rage://", 7 ) )
	{
		LOG->Warn("URLRageFile_open: Unexpected path \"%s\"", filename );
	    return -EIO;
	}
	filename += 7;

	int mode = 0;
	switch( flags )
	{
	case URL_RDONLY: mode = RageFile::READ; break;
	case URL_WRONLY: mode = RageFile::WRITE | RageFile::STREAMED; break;
	case URL_RDWR: FAIL_M( "O_RDWR unsupported" );
	}

	RageFile *f = new RageFile;
	if( !f->Open(filename, mode) )
	{
		LOG->Trace("Error opening \"%s\": %s", filename, f->GetError().c_str() );
		delete f;
	    return -EIO;
	}

	h->is_streamed = false;
	h->priv_data = f;
	return 0;
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:29,代码来源:MovieTexture_FFMpeg.cpp


示例14: ASSERT_M

GameInput Style::StyleInputToGameInput( int iCol, PlayerNumber pn ) const
{
	ASSERT_M( pn < NUM_PLAYERS  &&  iCol < MAX_COLS_PER_PLAYER,
		ssprintf("P%i C%i", pn, iCol) );
	bool bUsingOneSide = m_StyleType != StyleType_OnePlayerTwoSides && m_StyleType != StyleType_TwoPlayersSharedSides;

	FOREACH_ENUM( GameController, gc)
	{
		if( bUsingOneSide && gc != (int) pn )
			continue;

		int iButtonsPerController = INPUTMAPPER->GetInputScheme()->m_iButtonsPerController;
		for( GameButton gb=GAME_BUTTON_NEXT; gb < iButtonsPerController; gb=(GameButton)(gb+1) )
		{
			int iThisInputCol = m_iInputColumn[gc][gb-GAME_BUTTON_NEXT];
			if( iThisInputCol == END_MAPPING )
				break;

			if( iThisInputCol == iCol )
				return GameInput( gc, gb );
		}
	}

	FAIL_M( ssprintf("Invalid column number %i for player %i in the style %s", iCol, pn, GAMESTATE->GetCurrentStyle()->m_szName) );
};
开发者ID:Ancaro,项目名称:stepmania,代码行数:25,代码来源:Style.cpp


示例15: CFBundleGetMainBundle

Dialog::Result DialogDriver_MacOSX::AbortRetryIgnore( RString sMessage, RString sID )
{
	CFBundleRef bundle = CFBundleGetMainBundle();
	CFStringRef sIgnore = LSTRING( bundle, "Ignore" );
	CFStringRef sRetry = LSTRING( bundle, "Retry" );
	CFStringRef sAbort = LSTRING( bundle, "Abort" );
	CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sIgnore, sRetry, sAbort );

	CFRelease( sIgnore );
	CFRelease( sRetry );
	CFRelease( sAbort );
	switch( result )
	{
	case kCFUserNotificationDefaultResponse:
		Dialog::IgnoreMessage( sID );
		return Dialog::ignore;
	case kCFUserNotificationAlternateResponse:
		return Dialog::retry;
	case kCFUserNotificationOtherResponse:
	case kCFUserNotificationCancelResponse:
		return Dialog::abort;
	default:
		FAIL_M( ssprintf("Invalid response: %d.", int(result)) );
	}
}
开发者ID:goofwear,项目名称:stepmania,代码行数:25,代码来源:DialogDriver_MacOSX.cpp


示例16: FAIL_M

Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const
{
	if( st == StepsType_Invalid || dc == Difficulty_Invalid )
		return NULL;

	SongID songID;
	songID.FromSong( p );

	Steps *pRet = NULL;
	if( dc == Difficulty_Edit )
	{
		pRet = SongUtil::GetOneSteps( p, st, dc, -1, -1, sDescription, "", uHash, true );
	}
	else
	{
		pRet = SongUtil::GetOneSteps( p, st, dc, -1, -1, "", "", 0, true );
	}
	
	if( !bAllowNull && pRet == NULL )
		FAIL_M( ssprintf("%i, %i, \"%s\"", st, dc, sDescription.c_str()) );

	m_Cache.Set( pRet );
	
	return pRet;
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:25,代码来源:StepsUtil.cpp


示例17: ResetAnimation

void HoldJudgment::SetHoldJudgment( HoldNoteScore hns )
{
	//LOG->Trace( "Judgment::SetJudgment()" );

	// Matt: To save API. Command can handle if desired.
	if( hns != HNS_Missed )
	{
		ResetAnimation();
	}

	switch( hns )
	{
	case HNS_Held:
		m_sprJudgment->SetState( 0 );
		m_sprJudgment->PlayCommand( "Held" );
		break;
	case HNS_LetGo:
		m_sprJudgment->SetState( 1 );
		m_sprJudgment->PlayCommand( "LetGo" );
		break;
	case HNS_Missed:
		//m_sprJudgment->SetState( 2 ); // Matt: Not until after 5.0
		m_sprJudgment->PlayCommand( "MissedHold" );
		break;
	case HNS_None:
	default:
		FAIL_M(ssprintf("Cannot set hold judgment to %i", hns));
	}
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:29,代码来源:HoldJudgment.cpp


示例18: hr_ssprintf

void LowLevelWindow_Win32::BeginConcurrentRendering()
{
	if( !wglMakeCurrent( GraphicsWindow::GetHDC(), g_HGLRC_Background ) )
	{
		LOG->Warn( hr_ssprintf(GetLastError(), "wglMakeCurrent") );
		FAIL_M( hr_ssprintf(GetLastError(), "wglMakeCurrent") );
	}
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:8,代码来源:LowLevelWindow_Win32.cpp


示例19: find

void ActorFrame::MoveToHead( Actor* pActor )
{
	vector<Actor*>::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor );
	if( iter == m_SubActors.end() )	// didn't find
		FAIL_M("Nonexistent actor");

	m_SubActors.erase( iter );
	m_SubActors.insert( m_SubActors.begin(), pActor );
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:9,代码来源:ActorFrame.cpp


示例20: GetHoldNote

/* Get a hold note with the same track and end row as hn. */
int NoteData::GetMatchingHoldNote( const HoldNote &hn ) const
{
	for( int i=0; i<GetNumHoldNotes(); i++ )	// for each HoldNote
	{
		const HoldNote &ret = GetHoldNote(i);
		if( ret.iTrack == hn.iTrack && ret.iEndRow == hn.iEndRow )
			return i;
	}
	FAIL_M( ssprintf("%i..%i, %i", hn.iStartRow, hn.iEndRow, hn.iTrack) );
}
开发者ID:Fighter19,项目名称:PSPMania,代码行数:11,代码来源:NoteData.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FAIL_ON_ERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ FAIL_IF_NULL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap