• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ elementAt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中elementAt函数的典型用法代码示例。如果您正苦于以下问题:C++ elementAt函数的具体用法?C++ elementAt怎么用?C++ elementAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: locker

CreatureObject* ThreatMap::getHighestDamagePlayer() {
	Locker locker(&lockMutex);

	uint32 maxDamage = 0;
	VectorMap<uint64,uint32> damageMap;
	CreatureObject* player = NULL;

	for (int i = 0; i < size(); ++i) {
		ThreatMapEntry* entry = &elementAt(i).getValue();

		uint32 totalDamage = 0;

		for (int j = 0; j < entry->size(); ++j) {
			uint32 damage = entry->elementAt(j).getValue();

			totalDamage += damage;
		}

		CreatureObject* creature = elementAt(i).getKey();

		if (creature->isPlayerCreature()) {
			if(!damageMap.contains(creature->getObjectID())){
				damageMap.put(creature->getObjectID(),totalDamage);
			} else {
				damageMap.get(creature->getObjectID()) += totalDamage;
			}

			if (damageMap.get(creature->getObjectID()) > maxDamage) {
				maxDamage = damageMap.get(creature->getObjectID());
				player = cast<CreatureObject*>(creature);
			}
		} else if (creature->isPet()) {
			CreatureObject* owner = creature->getLinkedCreature().get();

			if (owner != NULL && owner->isPlayerCreature()) {
				if(!damageMap.contains(owner->getObjectID())){
					damageMap.put(owner->getObjectID(),totalDamage);
				} else {
					damageMap.get(owner->getObjectID()) += totalDamage;
				}

				if (damageMap.get(owner->getObjectID()) > maxDamage) {
					maxDamage = damageMap.get(owner->getObjectID());
					player = cast<CreatureObject*>(owner);
				}
			}
		}
	}

	return player;
}
开发者ID:dogg-jr,项目名称:GR-Core,代码行数:51,代码来源:ThreatMap.cpp


示例2: while

Groundfloor::StringVectorRange *Groundfloor::StringVector::translatePosToChunkedIndex( unsigned long iPos ) {
   Groundfloor::StringVectorRange *range = new Groundfloor::StringVectorRange();

   unsigned int cChunkLen = 0;
   unsigned int iCurChunk = 0;
   unsigned long iLenTodo = iPos;

   while ( iLenTodo != 0 ) {
      Groundfloor::String *sChunk = static_cast<Groundfloor::String *>( elementAt(iCurChunk) );
      if ( sChunk != NULL ) {
         cChunkLen = sChunk->getLength();

         if ( cChunkLen > iLenTodo ) {
            range->start_ind = iCurChunk;
            range->start_pos = iLenTodo;

            break;
         }

         iLenTodo -= cChunkLen;
         iCurChunk++;
      } else {
         break;
      }
   }

   return range;
}
开发者ID:partouf,项目名称:Crosscables,代码行数:28,代码来源:StringVector.cpp


示例3: getIndex

 virtual int getIndex(const XMLCh* const qName ) const
 {
     for(XMLSize_t i=0;i<size();i++)
         if(XMLString::equals(elementAt(i)->qName,qName))
             return (int)i;
     return -1;
 }
开发者ID:Kailashkatheth1,项目名称:quimeraengine,代码行数:7,代码来源:SAX2FilterHandlers.cpp


示例4: locker

void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
	Locker locker(&lockMutex);

	ManagedReference<TangibleObject*> strongSelf = self.get();
	if (strongSelf == NULL || strongSelf.get() == target)
		return;

	int idx = find(target);
	String xpToAward = "";

	if (xp == "") {
		WeaponObject* weapon = target->getWeapon();
		xpToAward = weapon->getXpType();
	} else
		xpToAward = xp;

	if (idx == -1) {
		ThreatMapEntry entry;
		entry.addDamage(xpToAward, damage);
		entry.addAggro(1);

		put(target, entry);
		registerObserver(target);

	} else {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->addDamage(xpToAward, damage);
		entry->addAggro(1);
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:30,代码来源:ThreatMap.cpp


示例5: size

void* UStack::pop(void) {
    int32_t n = size() - 1;
    void* result = 0;
    if (n >= 0) {
        result = elementAt(n);
        removeElementAt(n);
    }
    return result;
}
开发者ID:00zhengfu00,项目名称:third_party,代码行数:9,代码来源:ustack.cpp


示例6: locker

void DamageOverTimeList::clear(CreatureObject* creature) {
	Locker locker(&guard);

	dot = false;

	for (int i = 0; i < size(); ++i) {
		uint64 type = elementAt(i).getKey();

		Vector<DamageOverTime>* vector = &elementAt(i).getValue();

		for (int j = 0; j < vector->size(); ++j) {
			DamageOverTime* dot = &vector->elementAt(j);

			creature->clearState(dot->getType());
		}
	}

	removeAll();
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:19,代码来源:DamageOverTimeList.cpp


示例7: elementAt

void Groundfloor::StringVector::endMinusOne( Groundfloor::StringVectorRange *range ) {
   if ( range->end_pos == 0 ) {
      range->end_ind--;

      Groundfloor::String *sChunk = static_cast<Groundfloor::String *>( elementAt(range->end_ind) );
      range->end_pos = sChunk->getLength() - 1;
   } else {
      range->end_pos--;
   }
}
开发者ID:partouf,项目名称:Crosscables,代码行数:10,代码来源:StringVector.cpp


示例8: valueAt

bool Xml::valueAt(QDomElement parent, QString path, QString &value) {
    value.clear();

    QDomElement element;

    if(elementAt(parent, path, element)) {
        value = element.text().trimmed();
        return true;
    }

    return false;
}
开发者ID:falbrechtskirchinger,项目名称:yadu,代码行数:12,代码来源:xml.cpp


示例9: find

void ThreatMapEntry::addDamage(String xp, uint32 damage) {
	int idx = find(xp);

	if (idx == -1) {
		put(xp, damage);

	} else {
		uint32* dmg = &elementAt(idx).getValue();

		*dmg = *dmg + damage;
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:12,代码来源:ThreatMap.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ element_add函数代码示例发布时间:2022-05-30
下一篇:
C++ element函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap