本文整理汇总了C++中Sector::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ Sector::Name方法的具体用法?C++ Sector::Name怎么用?C++ Sector::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sector
的用法示例。
在下文中一共展示了Sector::Name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
/**
The update function of ActionAdopt calls the setSector method of
the entity that contains this action on the provided target sector.
This should produce the behavior of orphaning the entity and moving it
into a new sector
@param curState the current worldstate to reference during update
*/
void ActionAdopt::Update(const WorldState& curState)
{
//Double check to ensure that our target sector isn't the one
//that our containing entity already exists in
std::string targetName = Find("Target")->Get<std::string>();
Sector* curSector = curState.GetSector();
if (targetName == curSector->Name())
{
return;
}
//Grab the entity that contains us
Entity* curEntity = curState.GetEntity();
//Grab the world
World* curWorld = curState.GetWorld();
//Set up the sector
Datum* targetDatum = curWorld->Sectors()->Find(targetName);
if (targetDatum == nullptr || targetDatum->GetType() != Datum::TABLE)
{
throw std::exception("Sector could not be found");
}
else
{
Sector* targetSector = targetDatum->Get<Scope*>()->As<Sector>();
if (targetSector == nullptr)
{
throw std::exception("Malformed sector");
}
else
{
curEntity->SetSector(targetSector);
return;
}
}
}