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


C++ VectorMapEntry类代码示例

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


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

示例1: locker

void ThreatMap::removeAll(bool forceRemoveAll) {
	Locker locker(&lockMutex);

	removeObservers();

	for (int i = size() - 1; i >= 0; i--) {
		VectorMapEntry<ManagedReference<CreatureObject*> , ThreatMapEntry> *entry = &elementAt(i);

		ManagedReference<CreatureObject*> key = entry->getKey();
		ThreatMapEntry *value = &entry->getValue();

		ManagedReference<TangibleObject*> selfStrong = self.get();

		// these checks will determine if we should store the damage from the dropped aggressor
		Zone* keyZone = (key != NULL ? key->getZone() : NULL);
		Zone* selfZone = (selfStrong != NULL ? selfStrong->getZone() : NULL);

		uint32 keyPlanetCRC = (keyZone != NULL ? keyZone->getPlanetCRC() : 0);
		uint32 selfPlanetCRC = (selfZone != NULL ? selfZone->getPlanetCRC() : 0);

		if (key == NULL || selfStrong == NULL || key->isDead() || !key->isOnline() || keyPlanetCRC != selfPlanetCRC || forceRemoveAll) {
			remove(i);

			if (threatMapObserver != NULL)
				key->dropObserver(ObserverEventType::HEALINGPERFORMED, threatMapObserver);
		} else {
			value->setNonAggroDamage(value->getTotalDamage());
			value->addHeal(-value->getHeal()); // don't need to store healing
			value->clearAggro();
		}
	}

	currentThreat = NULL;
	threatMatrix.clear();
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:35,代码来源:ThreatMap.cpp

示例2: while

void SchematicMap::buildSchematicGroups() {

	while(iffGroupMap.size() > 0) {
		VectorMapEntry<uint32, String> entry = iffGroupMap.remove(0);
		String groupName = entry.getValue();

		DraftSchematic* schematic = schematicCrcMap.get(entry.getKey());

		if(schematic != NULL) {
			Locker locker(schematic);

			schematic->setGroupName(groupName);

			DraftSchematicGroup* group = groupMap.get(groupName);

			if (group == NULL) {
				group = new DraftSchematicGroup();
				groupMap.put(groupName, group);
			}

			if(!group->contains(schematic))
				group->add(schematic);
		}
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:25,代码来源:SchematicMap.cpp

示例3: addSkillMods

void CraftingSessionImplementation::addSkillMods() {
	ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get();
	ManagedReference<TangibleObject*> prototype = this->prototype.get();

	ManagedReference<DraftSchematic*> draftSchematic = manufactureSchematic->getDraftSchematic();

	VectorMap<String, int>* skillMods = draftSchematic->getDraftSchematicTemplate()->getSkillMods();

	for (int i = 0; i < skillMods->size(); i++) {
		VectorMapEntry<String, int> mod = skillMods->elementAt(i);
		prototype->addSkillMod(SkillModManager::WEARABLE, mod.getKey(), mod.getValue(), false);
	}
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:13,代码来源:CraftingSessionImplementation.cpp

示例4: removeTemplateSkillMods

void TangibleObjectImplementation::removeTemplateSkillMods(TangibleObject* targetObject) {
	SharedTangibleObjectTemplate* tano = dynamic_cast<SharedTangibleObjectTemplate*>(templateObject.get());

	if (tano == NULL)
		return;

	VectorMap<String, int>* mods = tano->getSkillMods();

	for (int i = 0; i < mods->size(); ++i) {
		VectorMapEntry<String, int> entry = mods->elementAt(i);

		targetObject->removeSkillMod(SkillModManager::TEMPLATE, entry.getKey(), entry.getValue());
	}
}
开发者ID:Nifdoolb,项目名称:Server,代码行数:14,代码来源:TangibleObjectImplementation.cpp

示例5: surrenderAllSkills

void SkillManager::surrenderAllSkills(CreatureObject* creature, bool notifyClient) {
	ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();

	SkillList* skillList = creature->getSkillList();

	Vector<String> listOfNames;
	skillList->getStringList(listOfNames);
	SkillList copyOfList;

	copyOfList.loadFromNames(listOfNames);

	for (int i = 0; i < copyOfList.size(); i++) {
		Skill* skill = copyOfList.get(i);

		if (skill->getSkillPointsRequired() > 0) {
			creature->removeSkill(skill, notifyClient);

			//Remove skill modifiers
			VectorMap<String, int>* skillModifiers = skill->getSkillModifiers();

			for (int i = 0; i < skillModifiers->size(); ++i) {
				VectorMapEntry<String, int>* entry = &skillModifiers->elementAt(i);
				creature->removeSkillMod(SkillModManager::SKILLBOX, entry->getKey(), entry->getValue(), notifyClient);

			}

			SkillModManager::instance()->verifySkillBoxSkillMods(creature);

			if (ghost != NULL) {
				//Give the player the used skill points back.
				ghost->addSkillPoints(skill->getSkillPointsRequired());

				//Remove abilities
				Vector<String>* abilityNames = skill->getAbilities();
				removeAbilities(ghost, *abilityNames, notifyClient);

				//Remove draft schematic groups
				Vector<String>* schematicsGranted = skill->getSchematicsGranted();
				SchematicMap::instance()->removeSchematics(ghost, *schematicsGranted, notifyClient);

				/// update force
				ghost->setForcePowerMax(creature->getSkillMod("jedi_force_power_max"), true);
			}
		}
	}
}
开发者ID:Marott1,项目名称:Core3,代码行数:46,代码来源:SkillManager.cpp

示例6: removeAttributeModifiers

void BuffImplementation::removeAttributeModifiers() {
	if (creature.get() == NULL)
		return;

	int size = attributeModifiers.size();

	if (size <= 0)
		return;

	for (int i = 0; i < size; ++i) {
		VectorMapEntry<uint8, int>* entry = &attributeModifiers.elementAt(i);

		uint8 attribute = entry->getKey();
		int value = entry->getValue();

		if (value == 0)
			continue;

		try {

			int attributemax = creature.get()->getMaxHAM(attribute) - value;

			int currentVal = creature.get()->getHAM(attribute);

			creature.get()->setMaxHAM(attribute, attributemax);

			if (currentVal >= attributemax) {
				//creature.get()->inflictDamage(creature.get(), attribute, currentVal - attributemax, isSpiceBuff());

				if (attribute % 3 == 0) {
					creature.get()->inflictDamage(creature.get(), attribute, currentVal - attributemax, false);
				} // else setMaxHam sets secondaries to max
			}

		} catch (Exception& e) {
			error(e.getMessage());
			e.printStackTrace();
		}


		/*int attributeval = MIN(attributemax, creature.get()->getHAM(attribute) - value);

		creature.get()->setHAM(attribute, attributeval);*/
	}

}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:46,代码来源:BuffImplementation.cpp

示例7: addSkillMods

void CraftingSessionImplementation::addSkillMods() {
	ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get();
	ManagedReference<TangibleObject*> prototype = this->prototype.get();

	ManagedReference<DraftSchematic*> draftSchematic = manufactureSchematic->getDraftSchematic();

	VectorMap<String, int>* skillMods = draftSchematic->getDraftSchematicTemplate()->getSkillMods();

	for (int i = 0; i < skillMods->size(); i++) {
		VectorMapEntry<String, int> mod = skillMods->elementAt(i);

		if (prototype->isWearableObject()) {
			WearableObject* wearable = prototype.castTo<WearableObject*>();
			VectorMap<String, int>* wearableMods = wearable->getWearableSkillMods();

			if (wearableMods->contains(mod.getKey())) {
				int oldValue = wearableMods->get(mod.getKey());
				int newValue = mod.getValue() + oldValue;

				if (newValue > 25)
					newValue = 25;

				wearableMods->put(mod.getKey(), newValue);
				continue;
			}
		}

		prototype->addSkillMod(SkillModManager::WEARABLE, mod.getKey(), mod.getValue(), false);
	}
}
开发者ID:blacknightownzjoo,项目名称:SWGOOW,代码行数:30,代码来源:CraftingSessionImplementation.cpp

示例8: applySkillModifiers

void BuffImplementation::applySkillModifiers() {
	if (creature.get() == NULL)
		return;

	int size = skillModifiers.size();

	for (int i = 0; i < size; ++i) {
		VectorMapEntry<String, int>* entry = &skillModifiers.elementAt(i);

		String key = entry->getKey();
		int value = entry->getValue();

		creature.get()->addSkillMod(SkillModManager::BUFF, key, value, true);
	}

	// if there was a speed or acceleration mod change, this will take care of immediately setting them.
	// the checks for if they haven't changed are in these methods
	creature.get()->updateSpeedAndAccelerationMods();
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:19,代码来源:BuffImplementation.cpp

示例9: setDownerAttributes

void SpiceBuffImplementation::setDownerAttributes(CreatureObject* creature, Buff* buff) {
	for (int i = 0; i < attributeModifiers.size(); ++i) {
		VectorMapEntry<uint8, int>* entry = &attributeModifiers.elementAt(i);

		uint8 attribute = entry->getKey();
		int value = entry->getValue();

		if (value <= 0)
			continue;

		int attributemax = creature->getMaxHAM(attribute) - creature->getWounds(attribute);

		int projvalue = attributemax - value;

		if (projvalue < 1)
			value += projvalue - 1;

		buff->setAttributeModifier(attribute, -value);
	}
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:20,代码来源:SpiceBuffImplementation.cpp

示例10: applyAttributeModifiers

void BuffImplementation::applyAttributeModifiers() {
	if (creature.get() == NULL)
		return;

	int size = attributeModifiers.size();

	if (size <= 0)
		return;

	for (int i = 0; i < size; ++i) {
		VectorMapEntry<uint8, int>* entry = &attributeModifiers.elementAt(i);

		uint8 attribute = entry->getKey();
		int value = entry->getValue();

		if (value == 0)
			continue;

		try {
			int attributemax = creature.get()->getMaxHAM(attribute) + value;
			int attributeval = MAX(attributemax, creature.get()->getHAM(attribute) + value);

			creature.get()->setMaxHAM(attribute, attributemax);

			if (!creature.get()->isDead() && !creature.get()->isIncapacitated()) {
				if (fillAttributesOnBuff) {
					//creature.get()->setHAM(attribute, attributeval - creature.get()->getWounds(attribute));
					creature.get()->healDamage(creature.get(), attribute, attributeval, true);
				} else if (value >= 0)
					creature.get()->healDamage(creature.get(), attribute, value);
			}
		} catch (Exception& e) {
			error(e.getMessage());
			e.printStackTrace();
		}
	}

}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:38,代码来源:BuffImplementation.cpp

示例11: getVariable

void CustomizationVariables::getVariable(int idx, uint8& type, int16& value) {
	VectorMapEntry<uint8, int16> entry = SortedVector<VectorMapEntry<uint8, int16> >::get(idx);

	type = entry.getKey();
	value = entry.getValue();
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:6,代码来源:CustomizationVariables.cpp

示例12: locker

bool SkillManager::surrenderSkill(const String& skillName, CreatureObject* creature, bool notifyClient) {
	Skill* skill = skillMap.get(skillName.hashCode());

	if (skill == NULL)
		return false;

	Locker locker(creature);

	SkillList* skillList = creature->getSkillList();

	if(skillName == "force_title_jedi_novice" && getForceSensitiveSkillCount(creature, true) > 0) {
		return false;
	}

	if(skillName.beginsWith("force_sensitive_") &&
		getForceSensitiveSkillCount(creature, false) <= 24 &&
		creature->hasSkill("force_title_jedi_rank_01"))
		return false;

	for (int i = 0; i < skillList->size(); ++i) {
		Skill* checkSkill = skillList->get(i);

		if (checkSkill->isRequiredSkillOf(skill))
			return false;
	}

	if(creature->hasSkill("force_title_jedi_rank_03") && skillName.contains("force_discipline_") && !knightPrereqsMet(creature, skillName)) {
		return false;
	}

	//If they have already surrendered the skill, then return true.
	if (!creature->hasSkill(skill->getSkillName()))
		return true;

	creature->removeSkill(skill, notifyClient);

	//Remove skill modifiers
	VectorMap<String, int>* skillModifiers = skill->getSkillModifiers();

	ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();

	for (int i = 0; i < skillModifiers->size(); ++i) {
		VectorMapEntry<String, int>* entry = &skillModifiers->elementAt(i);
		creature->removeSkillMod(SkillModManager::SKILLBOX, entry->getKey(), entry->getValue(), notifyClient);

	}

	if (ghost != NULL) {
		//Give the player the used skill points back.
		ghost->addSkillPoints(skill->getSkillPointsRequired());

		//Remove abilities but only if the creature doesn't still have a skill that grants the
		//ability.  Some abilities are granted by multiple skills. For example Dazzle for dancers
		//and musicians.
		Vector<String>* skillAbilities = skill->getAbilities();
		if (skillAbilities->size() > 0) {
			SortedVector<String> abilitiesLost;
			for (int i = 0; i < skillAbilities->size(); i++) {
				abilitiesLost.put(skillAbilities->get(i));
			}
			for (int i = 0; i < skillList->size(); i++) {
				Skill* remainingSkill = skillList->get(i);
				Vector<String>* remainingAbilities = remainingSkill->getAbilities();
				for(int j = 0; j < remainingAbilities->size(); j++) {
					if (abilitiesLost.contains(remainingAbilities->get(j))) {
						abilitiesLost.drop(remainingAbilities->get(j));
						if (abilitiesLost.size() == 0) {
							break;
						}
					}
				}
			}
			if (abilitiesLost.size() > 0) {
				removeAbilities(ghost, abilitiesLost, notifyClient);
			}
		}

		//Remove draft schematic groups
		Vector<String>* schematicsGranted = skill->getSchematicsGranted();
		SchematicMap::instance()->removeSchematics(ghost, *schematicsGranted, notifyClient);

		//Update maximum experience.
		updateXpLimits(ghost);

		/// Update Force Power Max
		ghost->setForcePowerMax(creature->getSkillMod("jedi_force_power_max"), true);

		SkillList* list = creature->getSkillList();

		int totalSkillPointsWasted = 250;

		for (int i = 0; i < list->size(); ++i) {
			Skill* skill = list->get(i);

			totalSkillPointsWasted -= skill->getSkillPointsRequired();
		}

		if (ghost->getSkillPoints() != totalSkillPointsWasted) {
			creature->error("skill points mismatch calculated: " + String::valueOf(totalSkillPointsWasted) + " found: " + String::valueOf(ghost->getSkillPoints()));
			ghost->setSkillPoints(totalSkillPointsWasted);
//.........这里部分代码省略.........
开发者ID:Marott1,项目名称:Core3,代码行数:101,代码来源:SkillManager.cpp

示例13: getMapKeyAtIndex

String QuestVectorMapImplementation::getMapKeyAtIndex(int idx) {
	VectorMapEntry<String, String>* entry = &questMap.elementAt(idx);

	return entry->getKey();
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:5,代码来源:QuestVectorMapImplementation.cpp

示例14: switch

void ConsumableImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* player) {

	if (maxCondition > 0) {
		StringBuffer cond;
		cond << (maxCondition-(int)conditionDamage) << "/" << maxCondition;

		alm->insertAttribute("condition", cond);
	}

	alm->insertAttribute("volume", volume);

	if (!isAttributeEffect() && !isSpiceEffect()) {
		if (useCount > 0)
			alm->insertAttribute("counter_uses_remaining", useCount);
	} else {
		if (useCount > 0)
			alm->insertAttribute("quantity", useCount);
	}

	if (!craftersName.isEmpty()){
		alm->insertAttribute("crafter", craftersName);
	}

	if (!objectSerial.isEmpty()){
		alm->insertAttribute("serial_number", objectSerial);
	}

	switch (effectType) {
	case EFFECT_HEALING: {

		if (filling > 0) {
			if (isFood())
				alm->insertAttribute("stomach_food", filling);
			else if (isDrink())
				alm->insertAttribute("stomach_drink", filling);
		}

		for (int i = 0; i < modifiers.size(); ++i) {
			VectorMapEntry<String, float>* entry = &modifiers.elementAt(i);;
			alm->insertAttribute(entry->getKey() + "_heal", nutrition);
		}

		break;
	}
	case EFFECT_ATTRIBUTE: {

		if (filling > 0) {
			if (isFood())
				alm->insertAttribute("stomach_food", filling);
			else if (isDrink())
				alm->insertAttribute("stomach_drink", filling);
		}

		if (duration <= 0)
			return;

		StringBuffer durationstring;

		int minutes = (int) floor(duration / 60.0f);
		int seconds = duration % 60;

		if (minutes > 0)
			durationstring << minutes << "m ";

		durationstring << seconds << "s";

		int mods = modifiers.size();

		if (mods > 0) {
			alm->insertAttribute("attribmods", mods);

			for (int i = 0; i < mods; ++i) {
				VectorMapEntry<String, float>* entry = &modifiers.elementAt(i);
				StringBuffer nutritionstring;

				if (!isForagedFood())
					nutritionstring << ((nutrition > 0) ? "+" : "") << nutrition << " for " << durationstring.toString();
				else
					nutritionstring << ((entry->getValue() > 0) ? "+" : "") << entry->getValue() << ", " << durationstring.toString();

				alm->insertAttribute("attr_" + entry->getKey(), nutritionstring.toString());
			}
		}
		break;
	}
	case EFFECT_SPICE: {
		int mods = modifiers.size();

		if (mods > 0) {
			StringBuffer durationstring;
			durationstring << duration << "s";

			alm->insertAttribute("attribmods", mods);

			for (int i = 0; i < mods; ++i) {
				VectorMapEntry<String, float>* entry = &modifiers.elementAt(i);
				StringBuffer nutritionstring;
				nutritionstring << ((entry->getValue() > 0) ? "+" : "") << entry->getValue() << ", " << durationstring.toString();
				alm->insertAttribute("attr_" + entry->getKey(), nutritionstring.toString());
			}
//.........这里部分代码省略.........
开发者ID:Nifdoolb,项目名称:Core3,代码行数:101,代码来源:ConsumableImplementation.cpp

示例15: locker

void ImageDesignSessionImplementation::updateImageDesign(CreatureObject* updater, uint64 designer, uint64 targetPlayer, uint64 tent, int type, const ImageDesignData& data) {
	ManagedReference<CreatureObject*> strongReferenceTarget = targetCreature.get();
	ManagedReference<CreatureObject*> strongReferenceDesigner = designerCreature.get();

	if (strongReferenceTarget == NULL || strongReferenceDesigner == NULL)
		return;

	Locker locker(strongReferenceDesigner);
	Locker clocker(strongReferenceTarget, strongReferenceDesigner);

	imageDesignData = data;

	CreatureObject* targetObject = NULL;

	if (updater == strongReferenceDesigner)
		targetObject = strongReferenceTarget;
	else
		targetObject = strongReferenceDesigner;

	//ManagedReference<SceneObject*> obj = targetObject->getParentRecursively(SceneObjectType::SALONBUILDING);
	//tent = obj != NULL ? obj->getObjectID()

	ImageDesignChangeMessage* message = new ImageDesignChangeMessage(targetObject->getObjectID(), designer, targetPlayer, tent, type);

	imageDesignData.insertToMessage(message);

	bool commitChanges = false;

	if (imageDesignData.isAcceptedByDesigner()) {
		commitChanges = true;

		if (strongReferenceDesigner != strongReferenceTarget && !imageDesignData.isAcceptedByTarget()) {
			commitChanges = false;

			if (idTimeoutEvent == NULL)
				idTimeoutEvent = new ImageDesignTimeoutEvent(_this.get());

			if (!idTimeoutEvent->isScheduled())
				idTimeoutEvent->schedule(120000); //2 minutes
		} else {
			commitChanges = doPayment();
		}
	}

	//System::out << h << endl;
	if (commitChanges) {
		//TODO: set XP Values

		int xpGranted = 0; // Minimum Image Design XP granted (base amount).

		//if (imageDesignData.mi)

		String hairTemplate = imageDesignData.getHairTemplate();

		bool statMig = imageDesignData.isStatMigrationRequested();

		if (statMig && strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get()
				&& strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get() && strongReferenceDesigner != strongReferenceTarget) {

			ManagedReference<Facade*> facade = strongReferenceTarget->getActiveSession(SessionFacadeType::MIGRATESTATS);
			ManagedReference<MigrateStatsSession*> session = dynamic_cast<MigrateStatsSession*>(facade.get());

			if (session != NULL) {
				session->migrateStats();
				xpGranted = 2000;
			}
		}

		VectorMap<String, float>* bodyAttributes = imageDesignData.getBodyAttributesMap();
		VectorMap<String, uint32>* colorAttributes = imageDesignData.getColorAttributesMap();

		ImageDesignManager* imageDesignManager = ImageDesignManager::instance();

		hairObject = strongReferenceTarget->getSlottedObject("hair").castTo<TangibleObject*>();

		if (type == 1) {
			String oldCustomization;

			if (hairObject != NULL)
				hairObject->getCustomizationString(oldCustomization);

			hairObject = imageDesignManager->createHairObject(strongReferenceDesigner, strongReferenceTarget, imageDesignData.getHairTemplate(), imageDesignData.getHairCustomizationString());

			if (hairObject != NULL)
				hairObject->setCustomizationString(oldCustomization);

			if (xpGranted < 100)
				xpGranted = 100;
		}

		if (bodyAttributes->size() > 0) {
			if (xpGranted < 300)
				xpGranted = 300;
			for (int i = 0; i < bodyAttributes->size(); ++i) {
				VectorMapEntry<String, float>* entry = &bodyAttributes->elementAt(i);
				imageDesignManager->updateCustomization(strongReferenceDesigner, entry->getKey(), entry->getValue(), strongReferenceTarget);
			}
		}


//.........这里部分代码省略.........
开发者ID:SWGChoice,项目名称:Core3,代码行数:101,代码来源:ImageDesignSessionImplementation.cpp


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