本文整理汇总了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);
}
}
}
示例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");
}
示例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);
}
}
}