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


C++ SortedVector::drop方法代码示例

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


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

示例1: togglePermission

int StructurePermissionList::togglePermission(const String& listName, const String& playerName, bool caseSensitive) {
	Locker locker(&lock);

	if(playerName == ownerName)
		return CANTCHANGEOWNER;

	if (!permissionLists.contains(listName))
		return LISTNOTFOUND;

	SortedVector<String>* list = &permissionLists.get(listName);

	String name = "";

	if (caseSensitive)
		name = playerName;
	else
		name = playerName.toLowerCase();

	//If they exist, remove them.
	if (list->contains(name)) {
		list->drop(name);
		return REVOKED;
	}

	list->put(name);
	return GRANTED;
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:27,代码来源:StructurePermissionList.cpp

示例2: revokeAllPermissions

int StructurePermissionList::revokeAllPermissions(const String& playerName, bool caseSensitive) {
	Locker locker(&lock);

	if(playerName == ownerName)
		return CANTCHANGEOWNER;

	for (int i = 0; i < permissionLists.size(); ++i) {
		SortedVector<String>* list = &permissionLists.get(i);

		if (caseSensitive)
			list->drop(playerName);
		else
			list->drop(playerName.toLowerCase());
	}

	return REVOKED;
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:17,代码来源:StructurePermissionList.cpp

示例3: revokePermission

int StructurePermissionList::revokePermission(const String& listName, const String& playerName, bool caseSensitive) {
	Locker locker(&lock);

	if(playerName == ownerName)
		return CANTCHANGEOWNER;

	if (!permissionLists.contains(listName))
		return LISTNOTFOUND;

	SortedVector<String>* list = &permissionLists.get(listName);

	if (caseSensitive)
		list->drop(playerName);
	else
		list->drop(playerName.toLowerCase());

	return REVOKED;
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:18,代码来源:StructurePermissionList.cpp

示例4: revokeAllPermissions

int StructurePermissionList::revokeAllPermissions(const uint64 objectID) {
	Locker locker(&lock);

	if(objectID == ownerID)
		return CANTCHANGEOWNER;

	for (int i = 0; i < idPermissionLists.size(); ++i) {
		SortedVector<uint64>* list = &idPermissionLists.get(i);

		list->drop(objectID);
	}

	return REVOKED;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:14,代码来源:StructurePermissionList.cpp

示例5: revokePermission

int StructurePermissionList::revokePermission(const String& listName, const uint64 objectID) {
	Locker locker(&lock);

	if(objectID == ownerID)
		return CANTCHANGEOWNER;

	if (!idPermissionLists.contains(listName))
		return LISTNOTFOUND;

	SortedVector<uint64>* list = &idPermissionLists.get(listName);

	list->drop(objectID);

	return REVOKED;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:15,代码来源:StructurePermissionList.cpp

示例6: togglePermission

int StructurePermissionList::togglePermission(const String& listName, const uint64 objectID) {
	Locker locker(&lock);

	if(objectID == ownerID)
		return CANTCHANGEOWNER;

	if (!idPermissionLists.contains(listName))
		return LISTNOTFOUND;

	SortedVector<uint64>* list = &idPermissionLists.get(listName);

	//If they exist, remove them.
	if (list->contains(objectID)) {
		list->drop(objectID);
		return REVOKED;
	}

	list->put(objectID);
	return GRANTED;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:20,代码来源:StructurePermissionList.cpp

示例7: sendTo

void StructurePermissionList::sendTo(CreatureObject* creature, const String& listName) {
	ZoneServer* zoneServer = creature->getZoneServer();

	ReadLocker locker(&lock);

	if (!idPermissionLists.contains(listName)) {
		return;
	}

	PermissionListCreateMessage* listMsg = new PermissionListCreateMessage(listName);

	SortedVector<uint64>* list = &idPermissionLists.get(listName);
	Vector<uint64> invalidIDs;

	for (int i = 0; i < list->size(); ++i) {
		Reference<SceneObject*> object = zoneServer->getObject(list->get(i));

		if (object != NULL && object->isPlayerCreature()) {
			CreatureObject* player = object.castTo<CreatureObject*>();
			String name = player->getFirstName();
			listMsg->addName(name);
		} else if (object != NULL && object->isGuildObject()) {
			GuildObject* guild = object.castTo<GuildObject*>();
			String name = "guild:" + guild->getGuildAbbrev();
			listMsg->addName(name);
		} else {
			invalidIDs.add(list->get(i));
		}
	}

	for (int i = 0; i < invalidIDs.size(); i++) {
		list->drop(invalidIDs.get(i));
	}

	listMsg->generateMessage();
	creature->sendMessage(listMsg);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:37,代码来源:StructurePermissionList.cpp

示例8: surrenderSkill

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


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