本文整理汇总了C++中UnitObj::SetTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitObj::SetTeam方法的具体用法?C++ UnitObj::SetTeam怎么用?C++ UnitObj::SetTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitObj
的用法示例。
在下文中一共展示了UnitObj::SetTeam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Undo
//
// Undo
//
// Undo operation
//
void Objects::Undo()
{
// Process each object
for (NList<Data>::Iterator i(&dataList); *i; i++)
{
Data *d = *i;
switch (op)
{
// Delete objects that were created
case OP_CREATE:
if (d->object.Alive())
{
GameObjCtrl::MarkForDeletion(d->object);
}
break;
// Create objects that were deleted
case OP_DELETE:
{
MapObj *m = MapObjCtrl::ObjectNewOnMap(d->type, d->matrix, 0, d->zipped);
// Restore zipping
if (d->zipped)
{
m->ToggleFootPrint(TRUE);
}
// Is this a unit
UnitObj *u = Promote::Object<UnitObjType, UnitObj>(m);
// Restore correct team
if (u && d->team)
{
u->SetTeam(d->team);
}
// Save the old id
U32 oldId = d->object.DirectId();
// Now replace all references to the old object with the new object
for (NList<Base>::Iterator items(&GetHistoryList()); *items; items++)
{
Objects *item = Promote<Objects>(*items);
if (item)
{
for (NList<Data>::Iterator data(&item->dataList); *data; data++)
{
if ((*data)->object.DirectId() == oldId)
{
(*data)->object = m;
}
}
}
}
break;
}
// Move objects back to original location
case OP_MOVE:
if (d->object.Alive())
{
d->object->SetSimCurrent(d->matrix);
// Toggle claiming if necessary
UnitObj *unitObj = Promote::Object<UnitObjType, UnitObj>(d->object);
if (unitObj && unitObj->CanEverMove())
{
unitObj->GetDriver()->RemoveFromMapHook();
unitObj->GetDriver()->AddToMapHook();
}
}
break;
// Restore zipped state
case OP_ZIP:
if (d->object.Alive())
{
d->object->ToggleFootPrint(d->zipped);
}
break;
}
}
}