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


C++ DM_LOG函数代码示例

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


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

示例1: DM_LOG

bool CMissionManager::DoCopyFile(const fs::path& source, const fs::path& dest, bool overwrite)
{
	if (overwrite)
	{
		try
		{
			// According to docs, remove() doesn't throw if file doesn't exist
			fs::remove(dest);
			DM_LOG(LC_MAINMENU, LT_INFO)LOGSTRING("Destination file %s already exists, has been removed before copying.\r", dest.string().c_str());
		}
		catch (fs::filesystem_error& e)
		{
			// Don't care about removal error
			DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("Caught exception while removing destination file %s: %s\r", dest.string().c_str(), e.what());
		}
	}

	// Copy the source file to the destination
	try
	{
		fs::copy_file(source, dest);
		DM_LOG(LC_MAINMENU, LT_INFO)LOGSTRING("File successfully copied to %s.\r", dest.string().c_str());

		return true;
	}
	catch (fs::filesystem_error& e)
	{
		DM_LOG(LC_MAINMENU, LT_ERROR)LOGSTRING("Exception while coyping file from %s to %s: %s\r", 
			source.string().c_str(), dest.string().c_str(), e.what());

		return false;
	}
}
开发者ID:jaredmitch,项目名称:executable,代码行数:33,代码来源:MissionManager.cpp

示例2: DM_LOG

void DifficultyManager::LoadDefaultDifficultySettings() {
	DM_LOG( LC_DIFFICULTY, LT_INFO )LOGSTRING( "Trying to load default difficulty settings from entityDefs.\r" );
	// Construct the entityDef name (e.g. atdm:difficulty_settings_default)
	idStr defName( DEFAULT_DIFFICULTY_ENTITYDEF );
	const idDict *difficultyDict = gameLocal.FindEntityDefDict( defName, true ); // grayman #3391 - don't create a default 'difficultyDict'
	// We want 'false' here, but FindEntityDefDict()
	// will print its own warning, so let's not
	// clutter the console with a redundant message
	if( difficultyDict != NULL ) {
		DM_LOG( LC_DIFFICULTY, LT_DEBUG )LOGSTRING( "Found difficulty settings: %s.\r", defName.c_str() );
		// greebo: Try to lookup the entityDef for each difficulty level and load the settings
		for( int i = 0; i < DIFFICULTY_COUNT; i++ ) {
			// Let the setting structure know which level it is referring to
			_globalSettings[i].SetLevel( i );
			// And load the settings
			_globalSettings[i].LoadFromEntityDef( *difficultyDict );
			// Load the CVAR settings too
			_cvarSettings[i].SetLevel( i );
			_cvarSettings[i].LoadFromEntityDef( *difficultyDict );
		}
	} else {
		for( int i = 0; i < DIFFICULTY_COUNT; i++ ) {
			_globalSettings[i].Clear();
			_cvarSettings[i].Clear();
		}
		gameLocal.Warning( "DifficultyManager: Could not find default difficulty entityDef!" );
	}
}
开发者ID:revelator,项目名称:The-Darkmod-Experimental,代码行数:28,代码来源:DifficultyManager.cpp

示例3: DM_LOG

void DifficultySettings::ApplySettings(idDict& target)
{
	std::string eclass = target.GetString("classname");

	if (eclass.empty()) {
		return; // no classname, no rules
	}

	// greebo: First, get the list of entity-specific difficulty settings from the dictionary
	// Everything processed here will be ignored in the second run (where the default settings are applied)
	idList<Setting> entSettings = Setting::ParseSettingsFromDict(target, _level);
	DM_LOG(LC_DIFFICULTY, LT_DEBUG)LOGSTRING("Found %d difficulty settings on the entity %s.\r", entSettings.Num(), target.GetString("name"));

	// Apply the settings one by one
	for (int i = 0; i < entSettings.Num(); i++)
	{
		DM_LOG(LC_DIFFICULTY, LT_DEBUG)LOGSTRING("Applying entity-specific setting: %s => %s.\r", entSettings[i].spawnArg.c_str(), entSettings[i].argument.c_str());
		entSettings[i].Apply(target);
	}

	// Second step: apply global settings

	// Get the inheritancechain for the given target dict
	const InheritanceChain &inheritanceChain = GetInheritanceChain(target);

	// Go through the inheritance chain front to back and apply the settings
	for (InheritanceChain::const_iterator c = inheritanceChain.begin(); c != inheritanceChain.end(); ++c)
	{
		std::string className = *c;

		// Process the list of default settings that apply to this entity class,
		// but ignore all keys that have been addressed by the entity-specific settings.
		for (SettingsMap::iterator i = _settings.find(className);
			 i != _settings.upper_bound(className) && i != _settings.end();
			 ++i)
		{
			Setting& setting = i->second;
			bool settingApplicable = true;

			// Check if the spawnarg has been processed in the entity-specific settings
			for (int k = 0; k < entSettings.Num(); k++)
			{
				if (entSettings[k].spawnArg == setting.spawnArg)
				{
					// This target spawnarg has already been processed in the first run, skip it
					DM_LOG(LC_DIFFICULTY, LT_DEBUG)LOGSTRING("Ignoring global setting: %s => %s.\r", setting.spawnArg.c_str(), setting.argument.c_str());
					settingApplicable = false;
					break;
				}
			}

			if (settingApplicable)
			{
				// We have green light, apply the setting
				DM_LOG(LC_DIFFICULTY, LT_DEBUG)LOGSTRING("Applying global setting: %s => %s.\r", setting.spawnArg.c_str(), setting.argument.c_str());
				setting.Apply(target);
			}
		}
	}
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:60,代码来源:DifficultySettings.cpp

示例4: DM_LOG

bool MeleeCombatTask::Perform(Subsystem& subsystem)
{
	DM_LOG(LC_AI, LT_INFO)LOGSTRING("Melee Combat Task performing.\r");

	idAI* ownerEnt = _owner.GetEntity();
	assert(ownerEnt != NULL);

	idActor* enemy = _enemy.GetEntity();
	if ( ( enemy == NULL ) || enemy->IsKnockedOut() || ( enemy->health <= 0 ) )
	{
		DM_LOG(LC_AI, LT_DEBUG)LOGSTRING("No enemy, terminating task!\r");
		return true; // terminate me
	}

	// Perform the task according to the current action
	EMeleeActState actState = ownerEnt->m_MeleeStatus.m_ActionState;

	switch (actState)
	{
	case MELEEACTION_READY:
		PerformReady(ownerEnt);
		break;
	case MELEEACTION_ATTACK:
		PerformAttack(ownerEnt);
		break;
	case MELEEACTION_PARRY:
		PerformParry(ownerEnt);
		break;
	default:
		PerformReady(ownerEnt);
	};
	
	return false; // not finished yet
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:34,代码来源:MeleeCombatTask.cpp

示例5: DM_LOG

void CStimResponseCollection::InitFromSpawnargs(const idDict& args, idEntity* owner)
{
	if (owner == NULL)
	{
		DM_LOG(LC_STIM_RESPONSE, LT_ERROR)LOGSTRING("Owner set to NULL is not allowed!\r");
		return;
	}

	idStr name;

	for (int i = 1; /* in-loop break */; ++i)
	{
		idStr name = va("sr_class_%u", i);
		DM_LOG(LC_STIM_RESPONSE, LT_DEBUG)LOGSTRING("Looking for %s\r", name.c_str());

		idStr str;
		if (!args.GetString(name, "X", str))
		{
			break;
		}

		char sr_class = str[0];

		if (ParseSpawnArg(args, owner, sr_class, i) == false)
		{
			break;
		}
	}
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:29,代码来源:StimResponseCollection.cpp

示例6: DM_LOG

bool CStimResponse::CheckChance() {
	if( m_Chance < 1.0f ) {
		// Chance timer still active?
		if( m_NextChanceTime > gameLocal.GetTime() ) {
			DM_LOG( LC_STIM_RESPONSE, LT_DEBUG )LOGSTRING( "CStimResponse::checkChance: Timeout still active.\r" );
			// Next chance time is still in the future, return false
			return false;
		}
		// The stim only fires if the (hopefully uniformly distributed)
		// random variable is within the interval (0, m_Chance]
		if( gameLocal.random.RandomFloat() <= m_Chance ) {
			// Reset the next chance time
			m_NextChanceTime = -1;
			return true;
		} else {
			DM_LOG( LC_STIM_RESPONSE, LT_DEBUG )LOGSTRING( "CStimResponse::checkChance: Chance test failed.\r" );
			// Test failed, should we use a timeout?
			if( m_ChanceTimer > 0 ) {
				// Save the earliest time of the next response chance
				m_NextChanceTime = gameLocal.GetTime() + m_ChanceTimer;
			}
			return false;
		}
	} else {
		// 100% chance => return true
		return true;
	}
}
开发者ID:revelator,项目名称:The-Darkmod-Experimental,代码行数:28,代码来源:StimResponse.cpp

示例7: DM_LOG

bool PathWaitTask::Perform(Subsystem& subsystem)
{
	DM_LOG(LC_AI, LT_INFO)LOGSTRING("PathWaitTask performing.\r");

	idPathCorner* path = _path.GetEntity();
	idAI* owner = _owner.GetEntity();

	// This task may not be performed with empty entity pointers
	assert(path != NULL && owner != NULL);

	if (gameLocal.time >= _endtime)
	{
		// Trigger path targets, now that we're done waiting
		// grayman #3670 - need to keep the owner->Activate() calls to not break
		// existing maps, but the intent was path->Activate().
		owner->ActivateTargets(owner);
		path->ActivateTargets(owner);

		// NextPath();

		// Wait is done, fall back to PatrolTask
		DM_LOG(LC_AI, LT_INFO)LOGSTRING("Wait is done.\r");

		return true; // finish this task
	}
	return false;
}
开发者ID:jaredmitch,项目名称:executable,代码行数:27,代码来源:PathWaitTask.cpp

示例8: GetConversation

void ConversationSystem::ProcessConversations() {
	// Remove the dying conversations first
	for( int i = 0; i < _dyingConversations.Num(); i++ ) {
		// Remove the dying index from the active conversations list
		_activeConversations.Remove( _dyingConversations[i] );
	}
	_dyingConversations.Clear();
	// What remains is a list of active conversations
	for( int i = 0; i < _activeConversations.Num(); i++ ) {
		ConversationPtr conv = GetConversation( _activeConversations[i] );
		assert( conv != NULL );
		// Let the conversation do its job
		if( !conv->Process() ) {
			// Job returned false, terminate this conversation
			DM_LOG( LC_CONVERSATION, LT_DEBUG )LOGSTRING( "Terminating conversation %s due to error.\r", conv->GetName().c_str() );
			EndConversation( _activeConversations[i] );
			continue;
		}
		// Check if the conversation is done
		if( conv->IsDone() ) {
			// Job returned false, terminate this conversation
			DM_LOG( LC_CONVERSATION, LT_INFO )LOGSTRING( "Conversation %s finished normally.\r", conv->GetName().c_str() );
			EndConversation( _activeConversations[i] );
			continue;
		}
	}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:27,代码来源:ConversationSystem.cpp

示例9: DM_LOG

void CFrobLock::Event_TriggerUnlockTargets()
{
	bool updateFrobability = spawnArgs.GetBool("update_target_frobability", "0");

	for (const idKeyValue* kv = spawnArgs.MatchPrefix("unlock_target"); kv != NULL; kv = spawnArgs.MatchPrefix("unlock_target", kv))
	{
		// Find the entity
		idEntity* unlockTarget = gameLocal.FindEntity(kv->GetValue());

		if (unlockTarget == NULL) 
		{
			DM_LOG(LC_LOCKPICK, LT_DEBUG)LOGSTRING("Could not find unlock target %s (this: %s)\r", kv->GetValue().c_str(), name.c_str());
			continue;
		}

		DM_LOG(LC_LOCKPICK, LT_INFO)LOGSTRING("Activating unlock target %s\r", kv->GetValue().c_str());
		unlockTarget->Activate(this);

		if (updateFrobability)
		{
			DM_LOG(LC_LOCKPICK, LT_INFO)LOGSTRING("Enabling unlock target frobability: %s\r", unlockTarget->name.c_str());
			unlockTarget->SetFrobable(true);
		}
	}
}
开发者ID:nbohr1more,项目名称:TheDarkMod_SVN_Unofficial-1,代码行数:25,代码来源:FrobLock.cpp

示例10: WriteCurrentFmFile

void CMissionManager::UninstallMod()
{
	// To uninstall the current FM, just clear the FM name in currentfm.txt	
	WriteCurrentFmFile("");

#if 0
	// Path to the darkmod directory
	fs::path darkmodPath = GetDarkmodPath();

	// Path to file that holds the current FM name
	fs::path currentFMPath(darkmodPath / cv_tdm_fm_current_file.GetString());

	DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("Trying to clear current FM name in %s\r", currentFMPath.file_string().c_str());

	if (DoRemoveFile(currentFMPath))
	{
		DM_LOG(LC_MAINMENU, LT_INFO)LOGSTRING("Current FM file removed: %s.\r", currentFMPath.string().c_str());
	}
	else
	{
		// Log removal error
		DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("Caught exception while removing current FM file %s.\r", currentFMPath.string().c_str());
	}
#endif
}
开发者ID:jaredmitch,项目名称:executable,代码行数:25,代码来源:MissionManager.cpp

示例11: DM_LOG

bool MoveToCoverTask::Perform(Subsystem& subsystem)
{
	DM_LOG(LC_AI, LT_INFO)LOGSTRING("Move to Cover Task performing.\r");

	idAI* owner = _owner.GetEntity();

	// This task may not be performed with empty entity pointer
	assert(owner != NULL);

	if (owner->AI_DEST_UNREACHABLE)
	{
		//TODO
		DM_LOG(LC_AI, LT_INFO)LOGSTRING("Destination unreachable.\r");
		return true;
	}

	if (owner->AI_MOVE_DONE)
	{
		// Move is done, 
		DM_LOG(LC_AI, LT_INFO)LOGSTRING("Move is done.\r");
		owner->TurnToward(owner->lastVisibleEnemyPos);

		// finish this task

		return true;
	}

	return false; // not finished yet
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:29,代码来源:MoveToCoverTask.cpp

示例12: DM_LOG

void CResponseEffect::runScript(idEntity* owner, idEntity* stimEntity, float magnitude) {
	if (!_scriptFunctionValid)
	{
		if (owner == NULL)
		{
			DM_LOG(LC_STIM_RESPONSE, LT_ERROR)LOGSTRING("Cannot restore scriptfunction, owner is NULL: %s\r", _scriptName.c_str());
			return;
		}

		_scriptFunctionValid = true;

		if (_localScript) {
			// Local scriptfunction
			_scriptFunction = owner->scriptObject.GetFunction(_scriptName.c_str());
		}
		else {
			// Global Method
			_scriptFunction = gameLocal.program.FindFunction(_scriptName.c_str());
		}
	}

	if ( _scriptFunction == NULL )
	{
		return;
	}

	DM_LOG(LC_STIM_RESPONSE, LT_DEBUG)LOGSTRING("Running ResponseEffect Script %s, effectPostfix = %s...\r", _scriptFunction->Name(), _effectPostfix.c_str());

	idThread *pThread = new idThread(_scriptFunction);
	int n = pThread->GetThreadNum();
	pThread->CallFunctionArgs(_scriptFunction, true, "eesff", owner, stimEntity, _effectPostfix.c_str(), magnitude, n);
	pThread->DelayedStart(0);
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:33,代码来源:ResponseEffect.cpp

示例13: GetModInfo

CMissionManager::InstallResult CMissionManager::InstallMod(const idStr& name)
{
	CModInfoPtr info = GetModInfo(name); // result is always non-NULL

	const idStr& modName = info->modName;

	// Ensure that the target folder exists
	fs::path targetFolder = g_Global.GetModPath(modName.c_str());

	if (!fs::create_directory(targetFolder))
	{
		// Directory exists, not a problem, but log this
		DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("FM targetFolder already exists: %s\r", targetFolder.string().c_str());
	}

#if 0
	// Path to the darkmod directory
	fs::path darkmodPath = GetDarkmodPath();

	// greebo: We don't copy PK4s around anymore, they remain in the fms/ subfolders

	// Copy all PK4s from the FM folder (and all subdirectories)
	idFileList* pk4Files = fileSystem->ListFilesTree(info->pathToFMPackage, ".pk4", false);

	for (int i = 0; i < pk4Files->GetNumFiles(); ++i)
	{
		// Source file (full OS path)
		fs::path pk4fileOsPath = GetDarkmodPath() / pk4Files->GetFile(i);

		// Target location
		fs::path targetFile = targetFolder / pk4fileOsPath.leaf();

		DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("Copying file %s to %s\r", pk4fileOsPath.string().c_str(), targetFile.string().c_str());

		// Use boost::filesystem instead of id's (comments state that copying large files can be problematic)
		//fileeSystem->CopyFile(pk4fileOsPath, targetFile.string().c_str());

		// Copy the PK4 file and make sure any target file with the same name is removed beforehand
		if (!DoCopyFile(pk4fileOsPath, targetFile, true))
		{
			// Failed copying
			return COPY_FAILURE;
		}
	}

	fileSystem->FreeFileList(pk4Files);
#endif

	// Save the name to currentfm.txt
	WriteCurrentFmFile(modName);

    // taaaki: now that fms are loaded directly from <basepath>/darkmod/fms/ 
    //         we don't need to copy config files around (i.e. just use the 
    //         one in <basepath>/darkmod/ (same with config.spec)

	return INSTALLED_OK;
}
开发者ID:jaredmitch,项目名称:executable,代码行数:57,代码来源:MissionManager.cpp

示例14: grayman

CInventoryItemPtr CInventory::ValidateWeapon(idEntity* ent, const bool gotFromShop) // grayman (#2376)
{
	// Sanity check
	if (ent == NULL) return CInventoryItemPtr();

	idStr weaponName = ent->spawnArgs.GetString("inv_weapon_name");

	if (weaponName.IsEmpty())
	{
		// Not a weapon item
		return CInventoryItemPtr();
	}

	// Entity has a weapon name set, check for match in our inventory

	// Find the weapon category
	CInventoryCategoryPtr weaponCategory = GetCategory(TDM_PLAYER_WEAPON_CATEGORY);

	if (weaponCategory == NULL)
	{
		DM_LOG(LC_INVENTORY, LT_ERROR)LOGSTRING("Could not find weapon category in inventory.\r");
		return CInventoryItemPtr();
	}
	
	// Look for the weapon with the given name
	for (int i = 0; i < weaponCategory->GetNumItems(); i++)
	{
		CInventoryWeaponItemPtr weaponItem = 
			boost::dynamic_pointer_cast<CInventoryWeaponItem>(weaponCategory->GetItem(i));

		// Is this the right weapon? (must be a melee weapon, allowed empty)
		if (weaponItem != NULL && weaponItem->IsAllowedEmpty() && weaponItem->GetWeaponName() == weaponName)
		{
			DM_LOG(LC_INVENTORY, LT_DEBUG)LOGSTRING("Entity %s is matching the melee weapon %s.\r", ent->name.c_str(), weaponName.c_str());

			// Enable this weapon

			if (!gotFromShop) // grayman (#2376)
			{
				weaponItem->SetEnabled(true);
			}

			if (!ent->spawnArgs.GetBool("inv_map_start", "0") && !ent->spawnArgs.GetBool("inv_no_pickup_message", "0"))
			{
				NotifyOwnerAboutPickup( common->Translate( ent->spawnArgs.GetString("inv_name") ), weaponItem);
			}
			
			// We're done
			return weaponItem;
		}
	}

	DM_LOG(LC_INVENTORY, LT_DEBUG)LOGSTRING("Couldn't find a match for weapon name: %s.\r", weaponName.c_str());

	return CInventoryItemPtr();
}
开发者ID:jaredmitch,项目名称:executable,代码行数:56,代码来源:Inventory.cpp

示例15: DM_LOG

void CDownloadMenu::StartDownload( idUserInterface *gui ) {
	// Add a new download for each selected mission
	const DownloadableModList &mods = gameLocal.m_MissionManager->GetDownloadableMods();
	for( int i = 0; i < _selectedMods.Num(); ++i ) {
		int missionIndex = _selectedMods[i];
		if( missionIndex > mods.Num() ) {
			continue;
		}
		const DownloadableMod &mod = *mods[missionIndex];
		// The filename is deduced from the mod name found on the website
		idStr targetPath = g_Global.GetDarkmodPath().c_str();
		targetPath += "/";
		targetPath += cv_tdm_fm_path.GetString();
		// Final path to the FM file
		idStr missionPath = targetPath + mod.modName + ".pk4";
		DM_LOG( LC_MAINMENU, LT_INFO )LOGSTRING( "Will download the mission PK4 to %s (modName %s).", missionPath.c_str(), mod.modName.c_str() );
		// log all the URLs
		for( int u = 0; u < mod.missionUrls.Num(); u++ ) {
			DM_LOG( LC_MAINMENU, LT_INFO )LOGSTRING( " URL: '%s'", mod.missionUrls[u].c_str() );
		}
		CDownloadPtr download( new CDownload( mod.missionUrls, missionPath, true ) );
		// gnartsch: In case only the language pack needs to be downloaded, do not add the mission itself to the download list.
		//           In that case we did not add any urls for the mission itself anyway.
		int id = -1;
		if( mod.missionUrls.Num() > 0 ) {
			// Check for valid PK4 files after download
			id = gameLocal.m_DownloadManager->AddDownload( download );
		}
		int l10nId = -1;
		// Check if there is a Localisation pack available
		if( mod.l10nPackUrls.Num() > 0 ) {
			DM_LOG( LC_MAINMENU, LT_INFO )LOGSTRING( "There are l10n pack URLs listed for this FM." );
			for( int u = 0; u < mod.l10nPackUrls.Num(); u++ ) {
				DM_LOG( LC_MAINMENU, LT_INFO )LOGSTRING( " l10n pack URL: '%s'", mod.l10nPackUrls[u].c_str() );
			}
			idStr l10nPackPath = targetPath + mod.modName + "_l10n.pk4";
			DM_LOG( LC_MAINMENU, LT_INFO )LOGSTRING( "Will download the l10n pack to %s.", l10nPackPath.c_str() );
			CDownloadPtr l10nDownload( new CDownload( mod.l10nPackUrls, l10nPackPath, true ) );
			l10nId = gameLocal.m_DownloadManager->AddDownload( l10nDownload );
			// Relate these two downloads, so that they might be handled as pair
			// gnartsch: In case only the language pack needs to be downloaded, we can ignore the mission itself
			if( id > 0 ) {
				download->SetRelatedDownloadId( l10nId );
			} else {
				id = l10nId;
				l10nId = -1;
			}
		}
		// Store these IDs for later reference
		_downloads[missionIndex] = MissionDownload( id, l10nId );
	}
	// Let the download manager start its downloads
	gameLocal.m_DownloadManager->ProcessDownloads();
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:54,代码来源:DownloadMenu.cpp


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