本文整理汇总了C++中idDict类的典型用法代码示例。如果您正苦于以下问题:C++ idDict类的具体用法?C++ idDict怎么用?C++ idDict使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了idDict类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateTimer
void CStimResponseCollection::CreateTimer(const idDict& args, const CStimPtr& stim, int index)
{
CStimResponseTimer* timer = stim->GetTimer();
timer->m_Reload = args.GetInt(va("sr_timer_reload_%u", index) , "-1");
idStr str = args.GetString(va("sr_timer_type_%u", index), "");
timer->m_Type = (str == "RELOAD") ? CStimResponseTimer::SRTT_RELOAD : CStimResponseTimer::SRTT_SINGLESHOT;
args.GetString(va("sr_timer_time_%u", index), "0:0:0:0", str);
TimerValue val = CStimResponseTimer::ParseTimeString(str);
// if timer is actually set
if (val.Time.Hour || val.Time.Minute || val.Time.Second || val.Time.Millisecond)
{
// TODO: Return a bool here so that the outer function knows not to add this to m_Stim in the collection?
stim->AddTimerToGame();
timer->SetTimer(val.Time.Hour, val.Time.Minute, val.Time.Second, val.Time.Millisecond);
// timer starts on map startup by default, otherwise wait for start
if (!args.GetBool(va("sr_timer_waitforstart_%u", index), "0"))
{
timer->Start(static_cast<unsigned long>(sys->GetClockTicks()));
}
}
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:29,代码来源:StimResponseCollection.cpp
示例2: StripReactionPrefix
//
// stripReactionPrefix()
//
void hhReactionHandler::StripReactionPrefix(idDict &dict) {
const idKeyValue *kv = NULL;//dict.MatchPrefix("reaction");
idDict newDict;
for(int i=0;i<dict.GetNumKeyVals();i++) {
kv = dict.GetKeyVal(i);
idStr key;
key = kv->GetKey();
// Do we have a reaction token to strip out?
if(idStr::FindText(key.c_str(), "reaction") != -1) {
int endPrefix = idStr::FindChar(key.c_str(), '_');
if(endPrefix == -1) {
gameLocal.Error("reactionX_ prefix not found.");
}
idStr realKey(key);
realKey = key.Mid(endPrefix+1, key.Length() - endPrefix - 1);
key = realKey;
}
//dict.Delete(kv->GetKey().c_str());
newDict.Set(key.c_str(), kv->GetValue());
kv = dict.MatchPrefix("reaction", kv);
}
dict.Clear();
dict.Copy(newDict);
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:36,代码来源:ai_reaction.cpp
示例3: LoadState
/*
================
idAF::LoadState
================
*/
void idAF::LoadState( const idDict &args )
{
const idKeyValue *kv;
idStr name;
idAFBody *body;
idVec3 origin;
idAngles angles;
kv = args.MatchPrefix( "body ", NULL );
while( kv )
{
name = kv->GetKey();
name.Strip( "body " );
body = physicsObj.GetBody( name );
if( body )
{
sscanf( kv->GetValue(), "%f %f %f %f %f %f", &origin.x, &origin.y, &origin.z, &angles.pitch, &angles.yaw, &angles.roll );
body->SetWorldOrigin( origin );
body->SetWorldAxis( angles.ToMat3() );
}
else
{
gameLocal.DWarning( "Unknown body part %s in articulated figure %s", name.c_str(), this->name.c_str() );
}
kv = args.MatchPrefix( "body ", kv );
}
physicsObj.UpdateClipModels();
}
开发者ID:revelator,项目名称:MHDoom,代码行数:35,代码来源:AF.cpp
示例4: ParseSpawnargs
void CInventoryItem::ParseSpawnargs(const idDict& spawnArgs)
{
m_Persistent = spawnArgs.GetBool("inv_persistent", "0");
m_LightgemModifier = spawnArgs.GetInt("inv_lgmodifier", "0");
m_MovementModifier = spawnArgs.GetFloat("inv_movement_modifier", "1");
m_FrobDistanceCap = spawnArgs.GetFloat("inv_frob_distance_cap", "-1");
m_Icon = spawnArgs.GetString("inv_icon", "");
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:8,代码来源:InventoryItem.cpp
示例5: WriteDict
/*
================
idDemoFile::WriteDict
================
*/
void idDemoFile::WriteDict( const idDict &dict ) {
int i, c;
c = dict.GetNumKeyVals();
WriteInt( c );
for( i = 0; i < c; i++ ) {
WriteHashString( dict.GetKeyVal( i )->GetKey() );
WriteHashString( dict.GetKeyVal( i )->GetValue() );
}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:14,代码来源:DemoFile.cpp
示例6: MoveCVarsToDict
/*
============
idCVarSystemLocal::MoveCVarsToDict
============
*/
const idDict* idCVarSystemLocal::MoveCVarsToDict( int flags ) const {
moveCVarsToDict.Clear();
for( int i = 0; i < cvars.Num(); i++ ) {
idCVar *cvar = cvars[i];
if ( cvar->GetFlags() & flags ) {
moveCVarsToDict.Set( cvar->GetName(), cvar->GetString() );
}
}
return &moveCVarsToDict;
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:15,代码来源:CVarSystem.cpp
示例7: SetCVarsFromDict
/*
============
idCVarSystemLocal::SetCVarsFromDict
============
*/
void idCVarSystemLocal::SetCVarsFromDict( const idDict &dict ) {
idInternalCVar *internal;
for( int i = 0; i < dict.GetNumKeyVals(); i++ ) {
const idKeyValue *kv = dict.GetKeyVal( i );
internal = FindInternal( kv->GetKey() );
if ( internal ) {
internal->InternalServerSetString( kv->GetValue() );
}
}
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:16,代码来源:CVarSystem.cpp
示例8: ReadDict
/*
================
idDemoFile::ReadDict
================
*/
void idDemoFile::ReadDict( idDict &dict ) {
int i, c;
idStr key, val;
dict.Clear();
ReadInt( c );
for( i = 0; i < c; i++ ) {
key = ReadHashString();
val = ReadHashString();
dict.Set( key, val );
}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:16,代码来源:DemoFile.cpp
示例9: ParseFromDict
void Setting::ParseFromDict(const idDict& dict, int level, int index)
{
isValid = true; // in dubio pro reo
// Get the classname, target spawnarg and argument
className = dict.GetString(va(PATTERN_CLASS, level, index));
spawnArg = dict.GetString(va(PATTERN_CHANGE, level, index));
argument = dict.GetString(va(PATTERN_ARG, level, index));
// Parse the application type
appType = EAssign;
if (!argument.IsEmpty())
{
// Check for ignore argument
if (argument == APPTYPE_IGNORE)
{
appType = EIgnore;
argument.Empty(); // clear the argument
}
else if (argument.Find(' ') != -1)
{
// greebo: We have a space in the argument, hence it cannot be
// a mathematical operation. This usually applies to vector arguments
// like '-205 10 20', which can contain a leading minus sign.
}
// Check for special modifiers
else if (argument[0] == '+')
{
appType = EAdd;
// Remove the first character
argument = idStr(argument, 1, argument.Length());
}
else if (argument[0] == '*')
{
appType = EMultiply;
// Remove the first character
argument = idStr(argument, 1, argument.Length());
}
else if (argument[0] == '-')
{
appType = EAdd;
// Leave the "-" sign, it will be the sign of the parsed int
}
}
if (spawnArg.IsEmpty())
{
// Spawnarg must not be empty
isValid = false;
}
// classname can be empty (this is valid for entity-specific difficulties)
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:54,代码来源:DifficultySettings.cpp
示例10: Setup
END_CLASS
/*
================
sdVehicleJointAimer::Setup
================
*/
bool sdVehicleJointAimer::Setup( sdTransport* _vehicle, const angleClamp_t& yaw, const angleClamp_t& pitch, const idDict& ikParms ) {
joint = INVALID_JOINT;
if ( !sdVehicleIKSystem::Setup( _vehicle, yaw, pitch, ikParms ) ) {
return false;
}
yawSound = NULL;
if ( clampYaw.sound != NULL ) {
yawSound = vehicle->GetMotorSounds().Alloc();
yawSound->Start( clampYaw.sound );
}
pitchSound = NULL;
if ( clampPitch.sound != NULL ) {
pitchSound = vehicle->GetMotorSounds().Alloc();
pitchSound->Start( clampPitch.sound );
}
idAnimator* animator = vehicle->GetAnimator();
joint = animator->GetJointHandle( ikParms.GetString( "joint" ) );
if ( joint == INVALID_JOINT ) {
return false;
}
animator->GetJointTransform( joint, gameLocal.time, baseAxis );
angles = baseAxis.ToAngles();
const char* weapon2Name = ikParms.GetString( "weapon2" );
if ( *weapon2Name ) {
weapon2 = _vehicle->GetWeapon( weapon2Name );
if ( !weapon2 ) {
gameLocal.Warning( "sdVehicleIKSystem::Setup Invalid Weapon '%s'", weapon2Name );
return false;
}
} else {
weapon2 = NULL;
}
return true;
}
开发者ID:,项目名称:,代码行数:49,代码来源:
示例11: GetInheritanceChain
DifficultySettings::InheritanceChain DifficultySettings::GetInheritanceChain(const idDict& dict)
{
std::string className = dict.GetString("classname");
// stgatilov: Look the class name up in the chains cache
InheritanceChainsMap::iterator it = _inheritanceChains.find(className);
if (it != _inheritanceChains.end())
return it->second;
InheritanceChain inheritanceChain;
// Add the classname itself to the end of the list
inheritanceChain.push_back(className);
// greebo: Extract the inherit value from the raw declaration text,
// as the "inherit" key has been removed in the given "dict"
for (std::string inherit = GetInheritValue(className);
!inherit.empty();
inherit = GetInheritValue(inherit))
{
// Has parent, add to list
inheritanceChain.push_back(inherit);
}
// stgatilov: reverse the chain so that parents go first
std::reverse(inheritanceChain.begin(), inheritanceChain.end());
// stgatilov: save the chain in cache
_inheritanceChains[className] = inheritanceChain;
return inheritanceChain;
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:32,代码来源:DifficultySettings.cpp
示例12: ApplySettings
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
示例13: InitFromSpawnargs
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
示例14: SavePersistentData
/*
========================
idAchievementManager::SavePersistentData
========================
*/
void idAchievementManager::SavePersistentData( idDict& playerInfo )
{
for( int i = 0; i < ACHIEVEMENTS_NUM; ++i )
{
playerInfo.SetInt( va( "ach_%d", i ), counts[i] );
}
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:12,代码来源:Achievements.cpp
示例15: RestorePersistentData
/*
========================
idAchievementManager::RestorePersistentData
========================
*/
void idAchievementManager::RestorePersistentData( const idDict& spawnArgs )
{
for( int i = 0; i < ACHIEVEMENTS_NUM; ++i )
{
counts[i] = spawnArgs.GetInt( va( "ach_%d", i ), "0" );
}
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:12,代码来源:Achievements.cpp
示例16: CopyPrefixedSpawnArgs
/*
==============
idSpawner::CopyPrefixedSpawnArgs
==============
*/
void idSpawner::CopyPrefixedSpawnArgs( idEntity *src, const char *prefix, idDict &args ){
const idKeyValue *kv = src->spawnArgs.MatchPrefix( prefix, NULL );
while ( kv ) {
args.Set( kv->GetKey().c_str() + idStr::Length( prefix ), kv->GetValue() );
kv = src->spawnArgs.MatchPrefix( prefix, kv );
}
}
开发者ID:RobertBeckebans,项目名称:Sikkpin-Breadcrumps-src,代码行数:12,代码来源:Spawner.cpp
示例17: InhibitEntitySpawn
/*
============
sdGameRulesStopWatch::InhibitEntitySpawn
============
*/
bool sdGameRulesStopWatch::InhibitEntitySpawn( idDict &spawnArgs ) const {
if ( spawnArgs.GetBool( "noStopwatch" ) ) {
return true;
}
return false;
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例18: InhibitEntitySpawn
bool DifficultyManager::InhibitEntitySpawn( const idDict &target ) {
bool isAllowed( true );
// Construct the key ("diff_0_spawn")
idStr key = va( "diff_%d_nospawn", _difficulty );
// The entity is allowed to spawn by default, must be set to 1 by the mapper
isAllowed = !target.GetBool( key, "0" );
DM_LOG( LC_DIFFICULTY, LT_INFO )LOGSTRING( "Entity %s is allowed to spawn on difficulty %i: %s.\r", target.GetString( "name" ), _difficulty, isAllowed ? "YES" : "NO" );
// Tels: #3223: See if this entity should spawn this time
float random_remove = target.GetFloat( "random_remove", "1.1" );
float random_value = gameLocal.random.RandomFloat();
if( random_remove < random_value ) {
isAllowed = false;
DM_LOG( LC_ENTITY, LT_INFO )LOGSTRING( "Removing entity %s due to random_remove %f < %f.\r", target.GetString( "name" ), random_remove, random_value );
}
// Return false if the entity is allowed to spawn
return !isAllowed;
}
开发者ID:revelator,项目名称:The-Darkmod-Experimental,代码行数:17,代码来源:DifficultyManager.cpp
示例19: Init
/*
================
sdRequirementCheck_Ability::Check
================
*/
void sdRequirementCheck_Ability::Init( const idDict& parms ) {
const char* abilityValue = parms.GetString( "value" );
if ( !*abilityValue ) {
gameLocal.Error( "sdRequirementCheck_Ability::Init No 'value' key specified" );
}
abilityHandle = sdRequirementManager::GetInstance().RegisterAbility( abilityValue );
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例20: UpdateClientFromServerInfo
/*
============
sdGameRulesStopWatch::UpdateClientFromServerInfo
============
*/
void sdGameRulesStopWatch::UpdateClientFromServerInfo( const idDict& serverInfo, bool allowMedia ) {
sdGameRules::UpdateClientFromServerInfo( serverInfo, allowMedia );
idStr mapName = serverInfo.GetString( "si_map" );
if( mapName.IsEmpty() ) {
return;
}
mapName.StripFileExtension();
using namespace sdProperties;
// update status
if ( sdUserInterfaceScope* scope = gameLocal.globalProperties.GetSubScope( "campaignInfo" ) ) {
const idDict* metaData = gameLocal.mapMetaDataList->FindMetaData( mapName, &gameLocal.defaultMetaData );
if( allowMedia ) {
const sdDeclMapInfo* mapInfo = gameLocal.declMapInfoType.LocalFind( metaData->GetString( "mapinfo", "_default" ) );
// setup the backdrop
if ( sdProperty* property = scope->GetProperty( "backdrop", PT_STRING ) ) {
*property->value.stringValue = mapInfo->GetData().GetString( "mtr_backdrop", "guis/assets/black" );
}
const char* status = "current";
if( winningTeam != NULL ) {
status = winningTeam->GetLookupName();
}
SetupLoadScreenUI( *scope, status, true, 1, *metaData, mapInfo );
}
// setup the name
if ( sdProperty* property = scope->GetProperty( "name", PT_WSTRING ) ) {
*property->value.wstringValue = va( L"%hs", metaData->GetString( "pretty_name" ) );
}
if ( sdProperty* property = scope->GetProperty( "numMaps", PT_FLOAT ) ) {
*property->value.floatValue = 1.0f;
}
if ( sdProperty* property = scope->GetProperty( "currentMap", PT_FLOAT ) ) {
*property->value.floatValue = 1.0f;
}
idWStr text;
if( timeToBeat > 0 ) {
idWStr::hmsFormat_t format;
format.showZeroMinutes = true;
idWStrList args( 1 );
args.Append( idWStr::MS2HMS( timeToBeat, format ) );
text = common->LocalizeText( "guis/mainmenu/timetobeat", args );
}
// setup the status
if ( sdProperty* property = scope->GetProperty( "ruleStatus", PT_WSTRING ) ) {
*property->value.wstringValue = text;
}
}
}
开发者ID:,项目名称:,代码行数:63,代码来源:
注:本文中的idDict类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论