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


C++ FILogFile::DebugMsg方法代码示例

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


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

示例1: RandomNumberGeneratorSyncCheck

//------------------------------------------------------------------------------
bool CvDllGameContext::RandomNumberGeneratorSyncCheck(PlayerTypes ePlayer, ICvRandom1* pRandom, bool bIsHost)
{
	// uh oh! Check the Random number generator!
	const CvRandom& localSimRandomNumberGenerator = GC.getGame().getJonRand();
	CvRandom* pkRandom = GC.UnwrapRandomPointer(pRandom);

	if(localSimRandomNumberGenerator != *pkRandom)
	{
		FILogFile* logFile = LOGFILEMGR.GetLog("net_message_debug.log", 0);

		char formatBuf[128] = {"\0"};
		std::string rngLogMessage = "Game Random Number Generators are out of sync : local.seed=";
		_i64toa_s(localSimRandomNumberGenerator.getSeed(), formatBuf, 127, 10);	rngLogMessage += formatBuf;
		rngLogMessage += ", remote.seed=";
		_i64toa_s(pkRandom->getSeed(), formatBuf, 127, 10);	rngLogMessage += formatBuf; 
		rngLogMessage += "\n\tlocal.callCount=";
		_itoa_s(localSimRandomNumberGenerator.getCallCount(), formatBuf, 10); rngLogMessage += formatBuf;
		rngLogMessage += ", remote.callCount=";
		_itoa_s(pkRandom->getCallCount(), formatBuf, 10); rngLogMessage += formatBuf;
		rngLogMessage += "\n\tlocal.resetCount=";
		_itoa_s(localSimRandomNumberGenerator.getResetCount(), formatBuf, 10); rngLogMessage += formatBuf;
		rngLogMessage += ", remote.resetCount=";
		_itoa_s(pkRandom->getResetCount(), formatBuf, 10); rngLogMessage += formatBuf;
		rngLogMessage += "\n";

		if(logFile)
			logFile->DebugMsg(rngLogMessage.c_str());

		return false;
	}

	return true;
}
开发者ID:kawyua,项目名称:Community-Patch-DLL,代码行数:34,代码来源:CvDllContext.cpp

示例2: RandomNumberGeneratorSyncCheck


//.........这里部分代码省略.........
			}
			else if(remoteSeedIterator != remoteSeedHistory.end() && localSeedIterator == localSeedHistory.end())
			{
				rngLogMessage += "\nremote random number generator called more than local at call #";
				rngLogMessage += _itoa_s(callNumber, formatBuf, 10);
				rngLogMessage += "\n";
				if(callNumber < remoteSeedHistory.size())
				{
					rngLogMessage += "remote CallStack:\n";
					rngLogMessage += remoteCallStacks[callNumber];
				}
			}

			// find first different call
			std::vector<std::string>::const_iterator localCallStackIterator;
			std::vector<std::string>::const_iterator remoteCallStackIterator;
			for(localCallStackIterator = localCallStacks.begin(), remoteCallStackIterator = remoteCallStacks.begin(), callNumber = 0; localCallStackIterator != localCallStacks.end() && remoteCallStackIterator != remoteCallStacks.end(); ++localCallStackIterator, ++remoteCallStackIterator, ++callNumber)
			{
				if(*localCallStackIterator != *remoteCallStackIterator)
				{
					rngLogMessage += "\nFirst different callstack at call #";
					rngLogMessage += _itoa_s(callNumber, formatBuf, 10);
					rngLogMessage += "\n";
					rngLogMessage += "Local :\n";
					rngLogMessage += *localCallStackIterator;
					rngLogMessage += "Remote :\n";
					rngLogMessage += *remoteCallStackIterator;
					break;
				}
			}

			if(logFile)
			{
				logFile->DebugMsg(rngLogMessage.c_str());
			}

			CvAssertMsg(false, rngLogMessage.c_str());

			if(logFile)
			{
				rngLogMessage = "\nDebug dump:\n";


				// add full history
				rngLogMessage += "Seed History -\n";
				localSeedIterator = localSeedHistory.begin();
				remoteSeedIterator = remoteSeedHistory.begin();
				callNumber = 0;
				while(localSeedIterator != localSeedHistory.end() || remoteSeedIterator != remoteSeedHistory.end())
				{
					++callNumber;
					rngLogMessage += "\t Call #";
					rngLogMessage += _itoa_s(callNumber, formatBuf, 10);
					rngLogMessage += " LOCAL=";
					if(localSeedIterator != localSeedHistory.end())
					{
						rngLogMessage += _itoa_s(*localSeedIterator, formatBuf, 10);
						++localSeedIterator;
					}
					rngLogMessage += "\tREMOTE=";
					if(remoteSeedIterator != remoteSeedHistory.end())
					{
						rngLogMessage += _itoa_s(*remoteSeedIterator, formatBuf, 10);
						++remoteSeedIterator;
					}
					rngLogMessage += "\n";
开发者ID:Decker87,项目名称:civ5DllMod,代码行数:67,代码来源:CvDllContext.cpp


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