本文整理汇总了C++中ObjectSet::find方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectSet::find方法的具体用法?C++ ObjectSet::find怎么用?C++ ObjectSet::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectSet
的用法示例。
在下文中一共展示了ObjectSet::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterData
void filterData(const std::string& filterExpr, Reader& reader)
{
Gto::Reader::Properties& properties = reader.properties();
Gto::Reader::Objects& objects = reader.objects();
for (size_t i=0; i < properties.size(); i++)
{
Gto::Reader::PropertyInfo& p = properties[i];
const Gto::Reader::ComponentInfo* c = p.component;
const Gto::Reader::ObjectInfo* o = c->object;
string name;
name = reader.stringFromId(o->name);
name += ".";
name += reader.stringFromId(c->name);
name += ".";
name += reader.stringFromId(p.name);
if (!fnmatch(filterExpr.c_str(), name.c_str(), 0))
{
filteredProperties.insert(&p);
filteredObjects.insert(o);
}
}
for (size_t i=0; i < objects.size(); i++)
{
Gto::Reader::ObjectInfo* p = &objects[i];
if (filteredObjects.find(p) != filteredObjects.end())
{
reader.accessObject(*p);
}
}
}
示例2: update
void City::update()
{
if(!mSubZoneId)
{
mQTRegion = mSI->getQTRegion(mPosition.x,mPosition.z);
mSubZoneId = (uint32)mQTRegion->getId();
mQueryRect = Anh_Math::Rectangle(mPosition.x - mWidth,mPosition.z - mHeight,mWidth * 2,mHeight * 2);
}
Object* object;
ObjectSet objList;
mSI->getObjectsInRange(this,&objList,ObjType_Player,mWidth);
if(mQTRegion)
{
mQTRegion->mTree->getObjectsInRange(this,&objList,ObjType_Player,&mQueryRect);
}
ObjectSet::iterator objIt = objList.begin();
while(objIt != objList.end())
{
object = (*objIt);
if(!(checkKnownObjects(object)))
{
onObjectEnter(object);
}
++objIt;
}
ObjectSet oldKnownObjects = mKnownObjects;
ObjectSet::iterator objSetIt = oldKnownObjects.begin();
while(objSetIt != oldKnownObjects.end())
{
object = (*objSetIt);
if(objList.find(object) == objList.end())
{
onObjectLeave(object);
}
++objSetIt;
}
}
示例3: update
//.........这里部分代码省略.........
applyHAMHealing(object);
mXp++;
}
if(!(checkKnownObjects(object)))
{
onObjectEnter(object);
std::list<campLink*>::iterator i;
bool alreadyExists = false;
for(i = links.begin(); i != links.end(); i++)
{
if((*i)->objectID == object->getId())
{
alreadyExists = true;
}
}
if(!alreadyExists)
{
//gLogger->logMsg("CREATING A NEW LINK!");
campLink* temp = new campLink;
temp->objectID = object->getId();
temp->lastSeenTime = gWorldManager->GetCurrentGlobalTick();
temp->tickCount = 0;
links.push_back(temp);
}
}
else
{
//gLogger->logMsg("HANDLING TICK!");
//Find the right link
std::list<campLink*>::iterator i;
for(i = links.begin(); i != links.end(); i++)
{
if((*i)->objectID == object->getId())
{
(*i)->lastSeenTime = gWorldManager->GetCurrentGlobalTick();
if((*i)->tickCount == 15)
{
applyWoundHealing(object);
(*i)->tickCount = 0;
}
else
(*i)->tickCount++;
break;
}
}
/*
//This code causes the Zone Server to print relational position and rotation info
//to allow the adding of items without much effort.
int8 text[256];
sprintf(text,"Position: mX=%f mY=%f mZ=%f\nDirection: mX=%f mY=%f mZ=%f mW=%f", (object->mPosition.x - this->mPosition.x), (object->mPosition.y - this->mPosition.y), (object->mPosition.z - this->mPosition.z), object->mDirection.x,object->mDirection.y,object->mDirection.z,object->mDirection.w);
gLogger->logMsg(text, BACKGROUND_RED);
*/
}
++objIt;
}
PlayerObjectSet oldKnownObjects = mKnownPlayers;
PlayerObjectSet::iterator objSetIt = oldKnownObjects.begin();
while(objSetIt != oldKnownObjects.end())
{
object = dynamic_cast<Object*>(*objSetIt);
if(objList.find(object) == objList.end())
{
onObjectLeave(object);
}
++objSetIt;
}
//prune the list
std::list<campLink*>::iterator i = links.begin();
while(i != links.end())
{
if(gWorldManager->GetCurrentGlobalTick() - (*i)->lastSeenTime >= 30000)
{
//gLogger->logMsg("ERASING AN ENTRY!");
delete (*i);
i = links.erase(i);
}
else
{
i++;
}
}
}