当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectSet::find方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:gatgui,项目名称:gto,代码行数:35,代码来源:main.cpp

示例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;
    }
}
开发者ID:jason83,项目名称:mmoserver,代码行数:48,代码来源:City.cpp

示例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++;
		}
	}
}
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:101,代码来源:CampRegion.cpp


注:本文中的ObjectSet::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。