本文整理汇总了C++中UnitArray类的典型用法代码示例。如果您正苦于以下问题:C++ UnitArray类的具体用法?C++ UnitArray怎么用?C++ UnitArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UnitArray类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: XmlConvert
//-----------------------------------------------------------------------
int XmlConvert(InStm *pin, const strvector &css, const strvector &fonts, const strvector &mfonts,
XlitConv *xlitConv, OutPackStm *pout)
{
// perform pass 1 to determine fb2 document structure and to collect all cross-references inside the fb2 file
UnitArray units;
// The input file name is pin->UIFileName();
XMLDocument doc;
doc.LoadFile(pin->UIFileName().c_str());
XMLHandle hDoc(&doc);
XMLHandle fb = hDoc.FirstChildElement("FictionBook");
XMLHandle desc = fb.FirstChildElement("description");
XMLHandle titleInfo = desc.FirstChildElement("title-info");
XMLHandle genre = titleInfo.FirstChildElement("genre");
XMLHandle genreInfo = genre.FirstChild();
const char* txt = genreInfo.ToNode()->Value(); // "Ciencia-Ficción"
// Now build from the above the damn epub!
// Go directly to DoConvertionPass2 and substitute XML calls to make epub.
// CONVERTION PASS 1 (DETERMINE DOCUMENT STRUCTURE AND COLLECT ALL CROSS-REFERENCES INSIDE THE FB2 FILE)
Ptr<ConverterPass1> conv = new ConverterPass1(&units);
conv->XmlScan(hDoc);
//DoConvertionPass1(CreateScanner(pin), &units);
//pin->Rewind();
// sanity check
if (units.size() == 0)
InternalError(__FILE__, __LINE__, "I don't know why but it happened that there is no content in input file!");
// perform pass 2 to create epub document
//XmlConversionPass2(hDoc, css, fonts, mfonts, xlitConv, &units, pout);
//DoConvertionPass2(CreateScanner(pin), css, fonts, mfonts, xlitConv, &units, pout);
return 0;
}
开发者ID:gregko,项目名称:EbookConverter,代码行数:35,代码来源:XmlFb2toEpub.cpp
示例2: GetBestUnitTarget
Unit* AscentScriptCreatureAI::GetBestUnitTarget( TargetFilter pTargetFilter, float pMinRange, float pMaxRange )
{
//Build potential target list
UnitArray TargetArray;
if ( pTargetFilter & TargetFilter_Friendly )
{
for ( unordered_set< Object* >::iterator ObjectIter = _unit->GetInRangeSetBegin(); ObjectIter != _unit->GetInRangeSetEnd(); ++ObjectIter )
{
if ( IsValidUnitTarget( *ObjectIter, pTargetFilter, pMinRange, pMaxRange ) )
TargetArray.push_back( TO_UNIT( *ObjectIter ) );
};
if ( IsValidUnitTarget( _unit, pTargetFilter ) )
TargetArray.push_back( _unit ); //Also add self as possible friendly target
}
else
{
for ( unordered_set< Object* >::iterator ObjectIter = _unit->GetInRangeOppFactsSetBegin(); ObjectIter != _unit->GetInRangeOppFactsSetEnd(); ++ObjectIter )
{
if ( IsValidUnitTarget( *ObjectIter, pTargetFilter, pMinRange, pMaxRange ) )
TargetArray.push_back( TO_UNIT( *ObjectIter ) );
};
};
return ChooseBestTargetInArray( TargetArray, pTargetFilter );
};
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:26,代码来源:Base.cpp
示例3: GetBestPlayerTarget
Unit* ArcScriptCreatureAI::GetBestPlayerTarget(TargetFilter pFilter)
{
//Build potential target list
UnitArray TargetArray;
for( set<Player*>::iterator PlayerIter = _unit->GetInRangePlayerSetBegin(); PlayerIter != _unit->GetInRangePlayerSetEnd(); ++PlayerIter )
{
if( IsValidUnitTarget(*PlayerIter, pFilter) ) TargetArray.push_back(static_cast<Unit*>(*PlayerIter));
}
return ChooseBestTargetInArray(TargetArray, pFilter);
}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:11,代码来源:Base.cpp
示例4: ChooseBestTargetInArray
Unit *MoonScriptCreatureAI::GetBestPlayerTarget( TargetFilters pTargetFilter, float pMinRange, float pMaxRange)
{
//Build potential target list
UnitArray TargetArray;
for ( unordered_set< Player *>::iterator PlayerIter = _unit->GetInRangePlayerSetBegin(); PlayerIter != _unit->GetInRangePlayerSetEnd(); ++PlayerIter )
{
if ( IsValidUnitTarget( *PlayerIter, pTargetFilter, pMinRange, pMaxRange ) )
TargetArray.push_back( TO_UNIT( *PlayerIter ) );
};
return ChooseBestTargetInArray( TargetArray, pTargetFilter );
};
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:12,代码来源:Base.cpp
示例5: GetInRangePlayers
UnitArray GetInRangePlayers()
{
UnitArray TargetArray;
for (unordered_set<Player*>::iterator itr = _unit->GetInRangePlayerSetBegin(); itr != _unit->GetInRangePlayerSetEnd(); itr++)
{
if (IsValidUnitTarget(*itr, TargetFilter_None))
{
TargetArray.push_back(TO_UNIT(*itr));
}
}
return TargetArray;
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:13,代码来源:Raid_GruulsLair.cpp
示例6: GetInRangePlayers
UnitArray GetInRangePlayers()
{
UnitArray TargetArray;
for (set< Object* >::iterator itr = _unit->GetInRangePlayerSetBegin(); itr != _unit->GetInRangePlayerSetEnd(); ++itr)
{
if (IsValidUnitTarget(*itr, TargetFilter_None))
{
TargetArray.push_back(TO< Unit* >(*itr));
}
}
return TargetArray;
}
开发者ID:TheGhostGroup,项目名称:AscEmu,代码行数:13,代码来源:Raid_GruulsLair.cpp
示例7: SpellFunc_Gruul_Shatter
void SpellFunc_Gruul_Shatter(SpellDesc* pThis, ArcTicScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType)
{
GruulTheDragonkillerAI *pGruul = (pCreatureAI != NULL) ? (GruulTheDragonkillerAI*)pCreatureAI : NULL;
if (pGruul != NULL)
{
pGruul->CastSpell(pGruul->mShatter2); // Spell to script
UnitArray TargetArray = pGruul->GetInRangePlayers();
if (TargetArray.size() > 0)
{
for (size_t i = 0; i < TargetArray.size(); ++i)
{
Unit* pTarget = TargetArray[i];
pTarget->RemoveAura(GRUUL_THE_DRAGONKILLER_STONED);
}
}
}
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:17,代码来源:Raid_GruulsLair.cpp
示例8: SpellFunc_Gruul_Stoned
void SpellFunc_Gruul_Stoned(SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, Unit* pTarget, TargetType pType)
{
GruulTheDragonkillerAI* pGruul = (pCreatureAI != NULL) ? TO< GruulTheDragonkillerAI* >(pCreatureAI) : NULL;
if (pGruul != NULL)
{
UnitArray TargetArray = pGruul->GetInRangePlayers();
if (TargetArray.size() > 0)
{
for (size_t i = 0; i < TargetArray.size(); ++i)
{
Unit* pTarget = TargetArray[i];
pTarget->CastSpell(pTarget, GRUUL_THE_DRAGONKILLER_STONED, true);
}
}
pGruul->CastSpell(pGruul->mShatter);
}
}
开发者ID:TheGhostGroup,项目名称:AscEmu,代码行数:18,代码来源:Raid_GruulsLair.cpp
示例9: GetBestUnitTarget
Unit* ArcScriptCreatureAI::GetBestUnitTarget(TargetFilter pFilter)
{
//Build potential target list
UnitArray TargetArray;
if( pFilter & TargetFilter_Friendly )
{
for( std::set<Object*>::iterator ObjectIter = _unit->GetInRangeSetBegin(); ObjectIter != _unit->GetInRangeSetEnd(); ++ObjectIter )
{
if( IsValidUnitTarget(*ObjectIter, pFilter) ) TargetArray.push_back(static_cast<Unit*>(*ObjectIter));
}
if( IsValidUnitTarget(_unit, pFilter) ) TargetArray.push_back(_unit); //Also add self as possible friendly target
}
else
{
for( std::set<Object*>::iterator ObjectIter = _unit->GetInRangeOppFactsSetBegin(); ObjectIter != _unit->GetInRangeOppFactsSetEnd(); ++ObjectIter )
{
if( IsValidUnitTarget(*ObjectIter, pFilter) ) TargetArray.push_back(static_cast<Unit*>(*ObjectIter));
}
}
return ChooseBestTargetInArray(TargetArray, pFilter);
}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:22,代码来源:Base.cpp
示例10: TO_UNIT
Unit *MoonScriptCreatureAI::ForceCreatureFind( uint32 pCreatureId, float pX, float pY, float pZ )
{
Unit *UnitPtr = NULLUNIT;
MapMgr *Mgr = _unit->GetMapMgr();
if ( Mgr == NULL )
return UnitPtr;
UnitPtr = TO_UNIT(Mgr->GetObjectClosestToCoords(pCreatureId, pX, pY, pZ, 99999.0f, TYPEID_UNIT ));
if ( UnitPtr == NULL )
{
UnitArray Array;
for ( uint32 i = 0; i != Mgr->m_CreatureHighGuid; ++i )
{
UnitPtr = Mgr->m_CreatureStorage[ i ];
if ( UnitPtr != NULL )
{
if ( UnitPtr->GetEntry() == pCreatureId && UnitPtr != _unit )
Array.push_back( UnitPtr );
}
}
if ( Array.size() == 1 )
return Array[ 0 ];
UnitPtr = NULLUNIT;
float Distance, NearestDistance = 99999;
for ( UnitArray::iterator UnitIter = Array.begin(); UnitIter != Array.end(); ++UnitIter )
{
Distance = _unit->CalcDistance( pX, pY, pZ, ( *UnitIter )->GetPositionX(), ( *UnitIter )->GetPositionY(), ( *UnitIter )->GetPositionZ() );
if ( Distance < NearestDistance )
{
NearestDistance = Distance;
UnitPtr = ( *UnitIter );
}
}
}
return UnitPtr;
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:39,代码来源:Base.cpp
示例11: ForceCreatureFind
Unit* AscentScriptCreatureAI::ForceCreatureFind( uint32 pCreatureId, float pX, float pY, float pZ )
{
Unit* UnitPtr = NULL;
MapMgr* Mgr = _unit->GetMapMgr();
if ( Mgr == NULL )
return UnitPtr;
UnitPtr = Mgr->GetInterface()->GetCreatureNearestCoords( pX, pY, pZ, pCreatureId );
if ( UnitPtr == NULL )
{
UnitArray Array;
for ( uint32 i = 0; i != Mgr->m_CreatureHighGuid; ++i )
{
UnitPtr = Mgr->m_CreatureStorage[ i ];
if ( UnitPtr != NULL )
{
if ( UnitPtr->GetEntry() == pCreatureId && UnitPtr != _unit )
Array.push_back( UnitPtr );
};
};
if ( Array.size() == 1 )
return Array[ 0 ];
UnitPtr = NULL;
float Distance, NearestDistance = 99999;
for ( UnitArray::iterator UnitIter = Array.begin(); UnitIter != Array.end(); ++UnitIter )
{
Distance = _unit->CalcDistance( pX, pY, pZ, ( *UnitIter )->GetPositionX(), ( *UnitIter )->GetPositionY(), ( *UnitIter )->GetPositionZ() );
if ( Distance < NearestDistance )
{
NearestDistance = Distance;
UnitPtr = ( *UnitIter );
};
};
};
return UnitPtr;
};
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:39,代码来源:Base.cpp
注:本文中的UnitArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论