本文整理汇总了C++中UnitObj::HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitObj::HasProperty方法的具体用法?C++ UnitObj::HasProperty怎么用?C++ UnitObj::HasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitObj
的用法示例。
在下文中一共展示了UnitObj::HasProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssignConstructors
//
// Assign constructors to this base
//
void Base::AssignConstructors(const char *tagName)
{
processTokens = TRUE;
// Was a tag specified ?
if (tagName)
{
// Resolve the tag
TagObj *tag = TagObj::FindTag(tagName);
if (tag)
{
// Iterate the units in the tag
for (MapObjList::Iterator i(&tag->list); *i; i++)
{
// Is it alive
if (!(*i)->Alive())
{
continue;
}
// Is this a unit ?
UnitObj *unit = Promote::Object<UnitObjType, UnitObj>(**i);
if (!unit)
{
continue;
}
// Is it on our team ?
if (unit->GetTeam() != GetObject().GetTeam())
{
continue;
}
// Is it a constructor ?
if (!unit->HasProperty(0xDCDE71CD)) // "Ability::Construction"
{
continue;
}
// LOG_AI(("Assigning constructor [%d] '%s' to base '%s'", unit->Id(), unit->UnitType()->GetName(), GetName()))
// Add this constructor to the list of idle constructors
constructorsIdle.Append(unit);
}
}
else
{
ERR_CONFIG(("Could not find tag '%s' when assign constructors to base '%s'", tagName, GetName()))
}
}
else
{
// Iterate all of the units on this team
for (NList<UnitObj>::Iterator u(&GetObject().GetTeam()->GetUnitObjects()); *u; u++)
示例2: Execute
//
// Execute
//
U32 SelfDestruct::Execute(const U8 *, Player &player)
{
// Tell each object to SelfDestruct
for (UnitObjList::Iterator i(&player.GetSelectedList()); *i; i++)
{
// Get the unit
UnitObj *unit = **i;
// Ensure it can self destruct
if (unit->HasProperty(0x54D4152A) && !unit->UnderConstruction()) // "Ability::SelfDestruct"
{
unit->SelfDestruct(TRUE, unit->GetTeam());
}
}
return (sizeof (Data));
}