本文整理汇总了C++中LOGSTRING函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGSTRING函数的具体用法?C++ LOGSTRING怎么用?C++ LOGSTRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGSTRING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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!" );
}
}
示例2: 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
}
示例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);
}
}
}
}
示例4: 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;
}
}
示例5: 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;
}
}
}
示例6: 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;
}
}
}
示例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;
}
示例8: 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
}
示例9: 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
}
示例10: 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);
}
}
}
示例11: 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;
}
}
示例12: LOGSTRING
// ----------------------------------------------------------------------------
// CSamplerPluginLoader::LoadRlibraryL
// ----------------------------------------------------------------------------
//
void CSamplerPluginLoader::LoadRlibraryL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray)
{
LOGSTRING("CSamplerPluginLoader rlibrary loading");
// Load dll
iPluginArray = aPluginArray;
RLibrary aLib;
TInt ret = aLib.Load(_L("PIProfilerGenerals.dll"),_L("c:\\sys\\bin"));
LOGSTRING2("RLibrary load returns %d", ret);
User::LeaveIfError(ret);
const TInt KNewLOrdinal = 2;
TLibraryFunction NewL =aLib.Lookup(KNewLOrdinal);
if(!NewL)
{
RDebug::Printf("library.lookup returns null");
}
else
{
LOGSTRING2("library.lookup returns 0x%x", NewL);
//CGeneralsPlugin* mydll=(CGeneralsPlugin*)NewL();
CSamplerPluginInterface* mydll=(CSamplerPluginInterface*)NewL();
//Generals plugin loaded, samplers enabled.
CleanupStack::PushL( mydll );
//InsertPluginInOrderL( mydll, aPluginArray);
CleanupStack::Pop(mydll);
// call engine to finalize the startup
//TRAPD(result, iObserver->HandleSamplerControllerReadyL(););
NotifyProgress();
//Begin CActive asynchronous loop.
CompleteOwnRequest();
}
LOGSTRING("RLibrary and plugins loaded");
}
示例13: 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);
}
示例14: LOGSTRING
// --------------------------------------------------------------------------
// CNSmlDmAOAdapter::DDFVersionL
// Returns ddf version nr
// --------------------------------------------------------------------------
void CNSmlDmAOAdapter::DDFVersionL( CBufBase& aDDFVersion )
{
LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL: Start" );
aDDFVersion.InsertL( 0, KNSmlDmAOAdapterDDFVersion );
LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL:End" );
}
示例15: 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;
}