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


C++ CFeature::Update方法代码示例

本文整理汇总了C++中CFeature::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ CFeature::Update方法的具体用法?C++ CFeature::Update怎么用?C++ CFeature::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFeature的用法示例。


在下文中一共展示了CFeature::Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Update

void CFeatureHandler::Update()
{
	SCOPED_TIMER("Feature::Update");

	if ((gs->frameNum & 31) == 0) {
		// let all areareclaimers choose a target with a different id
		bool dontClear = false;
		for (std::list<int>::iterator it = toBeFreedIDs.begin(); it != toBeFreedIDs.end(); ++it) {
			if (CBuilderCAI::IsFeatureBeingReclaimed(*it)) {
				// postpone recycling
				dontClear = true;
				break;
			}
		}
		if (!dontClear)
			freeIDs.splice(freeIDs.end(), toBeFreedIDs, toBeFreedIDs.begin(), toBeFreedIDs.end());
	}

	if(!toBeRemoved.empty()) {

		GML_RECMUTEX_LOCK(feat); // Update
		GML_RECMUTEX_LOCK(quad); // Update

		while (!toBeRemoved.empty()) {
			CFeatureSet::iterator it = activeFeatures.find(toBeRemoved.back());
			toBeRemoved.pop_back();
			if (it != activeFeatures.end()) {
				CFeature* feature = *it;
				toBeFreedIDs.push_back(feature->id);
				activeFeatures.erase(feature);

				if (feature->drawQuad >= 0) {
					DrawQuad* dq = &drawQuads[feature->drawQuad];
					dq->features.erase(feature);
				}

				if (feature->inUpdateQue) {
					updateFeatures.erase(feature);
				}
				fadeFeatures.erase(feature);
				fadeFeaturesS3O.erase(feature);

				delete feature;
			}
		}
	}

	CFeatureSet::iterator fi = updateFeatures.begin();
	while (fi != updateFeatures.end()) {
		CFeature* feature = *fi;
		++fi;

		if (!feature->Update()) {
			// remove it
			feature->inUpdateQue = false;
			updateFeatures.erase(feature);
		}
	}
}
开发者ID:SocietalEclipse,项目名称:spring-Societal,代码行数:59,代码来源:FeatureHandler.cpp

示例2: Update

void CFeatureHandler::Update()
{
	ASSERT_SYNCED_MODE;
START_TIME_PROFILE
	while (!toBeRemoved.empty()) {
		CFeature* feature = features[toBeRemoved.back()];
		toBeRemoved.pop_back();
		if (feature) {
			freeIDs.push_back(feature->id);
			features[feature->id] = 0;

			if (feature->drawQuad >= 0) {
				DrawQuad* dq = &drawQuads[feature->drawQuad];
				dq->features.erase(feature);
			}

			if (feature->inUpdateQue) {
				updateFeatures.erase(feature->id);
			}

			delete feature;
		}
	}

	SPRING_HASH_SET<int>::iterator fi=updateFeatures.begin();
	while(fi!= updateFeatures.end()){
		CFeature* feature = features[*fi];

		const bool remove = !feature->Update();
		if (remove) {
			feature->inUpdateQue = false;
			updateFeatures.erase(fi++);
		} else {
			++fi;
		}
	}
END_TIME_PROFILE("Feature::Update");
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:38,代码来源:FeatureHandler.cpp

示例3: Update

void CFeatureHandler::Update()
{
	SCOPED_TIMER("FeatureHandler::Update");

	if ((gs->frameNum & 31) == 0) {
		// let all areareclaimers choose a target with a different id
		bool dontClear = false;
		for (list<int>::iterator it = toBeFreedIDs.begin(); it != toBeFreedIDs.end(); ++it) {
			if (CBuilderCAI::IsFeatureBeingReclaimed(*it)) {
				// postpone recycling
				dontClear = true;
				break;
			}
		}
		if (!dontClear)
			freeIDs.splice(freeIDs.end(), toBeFreedIDs, toBeFreedIDs.begin(), toBeFreedIDs.end());
	}

	{
		GML_STDMUTEX_LOCK(rfeat); // Update

		if(!toBeRemoved.empty()) {

			GML_RECMUTEX_LOCK(obj); // Update

			eventHandler.DeleteSyncedObjects();

			GML_RECMUTEX_LOCK(feat); // Update

			eventHandler.DeleteSyncedFeatures();

			GML_RECMUTEX_LOCK(quad); // Update

			while (!toBeRemoved.empty()) {
				CFeature* feature = GetFeature(toBeRemoved.back());
				toBeRemoved.pop_back();
				if (feature) {
					int delID = feature->id;
					toBeFreedIDs.push_back(delID);
					activeFeatures.erase(feature);
					features[delID] = 0;

					if (feature->inUpdateQue) {
						updateFeatures.erase(feature);
					}
					CSolidObject::SetDeletingRefID(delID + uh->MaxUnits());
					delete feature;
					CSolidObject::SetDeletingRefID(-1);
				}
			}
		}

		eventHandler.UpdateFeatures();
	}

	CFeatureSet::iterator fi = updateFeatures.begin();
	while (fi != updateFeatures.end()) {
		CFeature* feature = *fi;
		++fi;

		if (!feature->Update()) {
			// remove it
			feature->inUpdateQue = false;
			updateFeatures.erase(feature);
		}
	}
}
开发者ID:Finkky,项目名称:spring,代码行数:67,代码来源:FeatureHandler.cpp


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