本文整理汇总了C++中UnitArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitArray::size方法的具体用法?C++ UnitArray::size怎么用?C++ UnitArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitArray
的用法示例。
在下文中一共展示了UnitArray::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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);
}
}
}
}
示例3: 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);
}
}
示例4:
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;
}
示例5: 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;
};