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


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

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


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

示例1: loadPerformanceLocations

void PlanetManagerImplementation::loadPerformanceLocations() {
	info("loading performance locations...", true);

	SortedVector<ManagedReference<SceneObject*> > planetaryLocs;
	planetaryLocs.setNoDuplicateInsertPlan();

	// get hotels
	planetaryLocs = zone->getPlanetaryObjectList("hotel");
	for (int j = 0; j < planetaryLocs.size(); j++) {
		SceneObject* obj = planetaryLocs.get(j);
		addPerformanceLocation(obj);
	}

	// get theaters
	planetaryLocs = zone->getPlanetaryObjectList("guild_theater");
	for (int j = 0; j < planetaryLocs.size(); j++) {
		SceneObject* obj = planetaryLocs.get(j);
		addPerformanceLocation(obj);
	}

	// get cantinas
	planetaryLocs.removeAll();
	planetaryLocs = zone->getPlanetaryObjectList("cantina");
	for (int j = 0; j < planetaryLocs.size(); j++) {
		SceneObject* obj = planetaryLocs.get(j);
		addPerformanceLocation(obj);
	}
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:28,代码来源:PlanetManagerImplementation.cpp

示例2: awardFactionStanding

void FactionManager::awardFactionStanding(CreatureObject* player, const String& factionName) {
	if (player == NULL)
		return;

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

	if (!factionMap.contains(factionName))
		return;

	float lose = floor((float)75); //TODO: Find the equation for this.
	float gain = floor((float)lose / 2); //you gain half of what you lose

	Faction faction = factionMap.get(factionName);
	SortedVector<String>* enemies = faction.getEnemies();
	SortedVector<String>* allies = faction.getAllies();

	ghost->decreaseFactionStanding(factionName, lose);

	//Lose faction standing to allies of the creature.
	for (int i = 0; i < allies->size(); ++i) {
		String ally = allies->get(i);
		ghost->decreaseFactionStanding(ally, lose);
	}

	//Gain faction standing to enemies of the creature.
	for (int i = 0; i < enemies->size(); ++i) {
		String enemy = enemies->get(i);
		ghost->increaseFactionStanding(enemy, gain);
	}
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:30,代码来源:FactionManager.cpp

示例3: toAudioPort

void AudioPort::toAudioPort(struct audio_port *port) const
{
    // TODO: update this function once audio_port structure reflects the new profile definition.
    // For compatibility reason: flatening the AudioProfile into audio_port structure.
    SortedVector<audio_format_t> flatenedFormats;
    SampleRateVector flatenedRates;
    ChannelsVector flatenedChannels;
    for (size_t profileIndex = 0; profileIndex < mProfiles.size(); profileIndex++) {
        if (mProfiles[profileIndex]->isValid()) {
            audio_format_t formatToExport = mProfiles[profileIndex]->getFormat();
            const SampleRateVector &ratesToExport = mProfiles[profileIndex]->getSampleRates();
            const ChannelsVector &channelsToExport = mProfiles[profileIndex]->getChannels();

            if (flatenedFormats.indexOf(formatToExport) < 0) {
                flatenedFormats.add(formatToExport);
            }
            for (size_t rateIndex = 0; rateIndex < ratesToExport.size(); rateIndex++) {
                uint32_t rate = ratesToExport[rateIndex];
                if (flatenedRates.indexOf(rate) < 0) {
                    flatenedRates.add(rate);
                }
            }
            for (size_t chanIndex = 0; chanIndex < channelsToExport.size(); chanIndex++) {
                audio_channel_mask_t channels = channelsToExport[chanIndex];
                if (flatenedChannels.indexOf(channels) < 0) {
                    flatenedChannels.add(channels);
                }
            }
            if (flatenedRates.size() > AUDIO_PORT_MAX_SAMPLING_RATES ||
                    flatenedChannels.size() > AUDIO_PORT_MAX_CHANNEL_MASKS ||
                    flatenedFormats.size() > AUDIO_PORT_MAX_FORMATS) {
                ALOGE("%s: bailing out: cannot export profiles to port config", __FUNCTION__);
                return;
            }
        }
    }
    port->role = mRole;
    port->type = mType;
    strlcpy(port->name, mName, AUDIO_PORT_MAX_NAME_LEN);
    port->num_sample_rates = flatenedRates.size();
    port->num_channel_masks = flatenedChannels.size();
    port->num_formats = flatenedFormats.size();
    for (size_t i = 0; i < flatenedRates.size(); i++) {
        port->sample_rates[i] = flatenedRates[i];
    }
    for (size_t i = 0; i < flatenedChannels.size(); i++) {
        port->channel_masks[i] = flatenedChannels[i];
    }
    for (size_t i = 0; i < flatenedFormats.size(); i++) {
        port->formats[i] = flatenedFormats[i];
    }

    ALOGV("AudioPort::toAudioPort() num gains %zu", mGains.size());

    uint32_t i;
    for (i = 0; i < mGains.size() && i < AUDIO_PORT_MAX_GAINS; i++) {
        port->gains[i] = mGains[i]->getGain();
    }
    port->num_gains = i;
}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:60,代码来源:AudioPort.cpp

示例4: broadcastDestroyPrivate

void SceneObjectImplementation::broadcastDestroyPrivate(SceneObject* object, SceneObject* selfObject) {
	ZoneServer* zoneServer = getZoneServer();

	if (zoneServer != NULL && zoneServer->isServerLoading())
		return;

	if (parent.get() != NULL) {
		ManagedReference<SceneObject*> grandParent = getRootParent().get();

		if (grandParent != NULL) {
			grandParent->broadcastDestroyPrivate(object, selfObject);

			return;
		} else {
			return;
		}
	}

	if (zone == NULL)
		return;

	SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
	int maxInRangeObjectCount = 0;

	if (closeobjects == NULL) {
		info("Null closeobjects vector in SceneObjectImplementation::broadcastDestroyPrivate", true);
		zone->getInRangeObjects(getPositionX(), getPositionY(), 256, &closeSceneObjects, true);

		maxInRangeObjectCount = closeSceneObjects.size();
	} else {

		CloseObjectsVector* vec = (CloseObjectsVector*) closeobjects;
		closeSceneObjects.removeAll(vec->size(), 10);

		vec->safeCopyTo(closeSceneObjects);

		maxInRangeObjectCount = closeSceneObjects.size();

	}

	for (int i = 0; i < maxInRangeObjectCount; ++i) {
		SceneObject* scno = static_cast<SceneObject*>(closeSceneObjects.get(i).get());

		ManagedReference<ZoneClientSession*> client = scno->getClient();

		if (scno->isVehicleObject() || client != NULL || scno->isMount()) {
			object->sendDestroyTo(scno);
		}
	}
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:50,代码来源:SceneObjectImplementation.cpp

示例5: isBuildingPermittedAt

bool PlanetManagerImplementation::isBuildingPermittedAt(float x, float y, SceneObject* object, float margin) {
	SortedVector<ManagedReference<ActiveArea* > > activeAreas;

	Vector3 targetPos(x, y, zone->getHeight(x, y));

	zone->getInRangeActiveAreas(x, y, &activeAreas, true);

	for (int i = 0; i < activeAreas.size(); ++i) {
		ActiveArea* area = activeAreas.get(i);

		if (area->isNoBuildArea()) {
			return false;
		}
	}

	if (isInObjectsNoBuildZone(x, y, margin)) {
		return false;
	}

	if (isInWater(targetPos.getX(), targetPos.getY())) {
		return false;
	}

	if (isInRangeWithPoi(targetPos.getX(), targetPos.getY(), 150))
		return false;

	return true;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:28,代码来源:PlanetManagerImplementation.cpp

示例6: isInObjectsNoBuildZone

bool PlanetManagerImplementation::isInObjectsNoBuildZone(float x, float y, float extraMargin) {
	SortedVector<ManagedReference<QuadTreeEntry* > > closeObjects;

	Vector3 targetPos(x, y, zone->getHeight(x, y));

	zone->getInRangeObjects(x, y, 512, &closeObjects, true);

	for (int i = 0; i < closeObjects.size(); ++i) {
		SceneObject* obj = cast<SceneObject*>(closeObjects.get(i).get());

		SharedObjectTemplate* objectTemplate = obj->getObjectTemplate();

		if (objectTemplate != NULL) {
			float radius = objectTemplate->getNoBuildRadius();

			// Only check objects with an actual NoBuildRadius
			if (radius > 0) {
				// Add margin to check
				radius += extraMargin;

				Vector3 objWorldPos = obj->getWorldPosition();

				if (objWorldPos.squaredDistanceTo(targetPos) < radius * radius) {
					return true;
				}
			}
		}
	}

	return false;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:31,代码来源:PlanetManagerImplementation.cpp

示例7: broadcastMessage

void InstallationObjectImplementation::broadcastMessage(BasePacket* message, bool sendSelf) {
	Zone* zone = getZone();

	if (zone == NULL)
		return;

	Locker zoneLocker(zone);

	SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
	zone->getInRangeObjects(getPositionX(), getPositionY(), 512, &closeSceneObjects, false);

	for (int i = 0; i < closeSceneObjects.size(); ++i) {
		ManagedReference<SceneObject*> scno = cast<SceneObject*>( closeSceneObjects.get(i).get());

		if (!sendSelf && scno == _this.get())
			continue;

		if(!scno->isPlayerCreature())
			continue;

		CreatureObject* creo = cast<CreatureObject*>( scno.get());

		if(isOnAdminList(creo))
			scno->sendMessage(message->clone());
	}

	delete message;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:28,代码来源:InstallationObjectImplementation.cpp

示例8: inRangeObjects

int SceneObjectImplementation::inRangeObjects(unsigned int gameObjectType, float range) {
	if (getZone() == NULL)
		return 0;

	int numberOfObjects = 0;

	Locker zoneLocker(getZone());

	SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
	int maxInRangeObjectCount = 0;

	if (closeobjects == NULL) {
		info("Null closeobjects vector in SceneObjectImplementation::inRangeObjects", true);
		zone->getInRangeObjects(getPositionX(), getPositionY(), range, &closeSceneObjects, true);

		maxInRangeObjectCount = closeSceneObjects.size();
	} else
		maxInRangeObjectCount = closeobjects->size();

	for (int i = 0; i < maxInRangeObjectCount; ++i) {
		SceneObject* scno;

		if (closeobjects != NULL)
			scno = cast<SceneObject*>( closeobjects->get(i).get());
		else
			scno = cast<SceneObject*>(closeSceneObjects.get(i).get());

		if (scno->isInRange(_this.get(), range) && scno->getGameObjectType() == gameObjectType)
			++numberOfObjects;
	}

	return numberOfObjects;
}
开发者ID:blacknightownzjoo,项目名称:SWGOOW,代码行数:33,代码来源:SceneObjectImplementation.cpp

示例9: targetPos

Reference<SceneObject*> PlanetManagerImplementation::findObjectTooCloseToDecoration(float x, float y, float margin) {
	SortedVector<ManagedReference<QuadTreeEntry* > > closeObjects;

	Vector3 targetPos(x, y,0);

	zone->getInRangeObjects(x, y, 256, &closeObjects, true);

	for (int i = 0; i < closeObjects.size(); ++i) {

		ManagedReference<SceneObject*> obj = cast<SceneObject*>(closeObjects.get(i).get());

		if(obj == NULL || obj->isCreatureObject() || obj->getObjectTemplate() == NULL)
			continue;

		Vector3 objVec(obj->getPositionX(), obj->getPositionY(),0);

		int squaredDistance = (obj->getObjectTemplate()->getNoBuildRadius() + margin) * (obj->getObjectTemplate()->getNoBuildRadius() + margin);

		if(objVec.squaredDistanceTo(targetPos) < squaredDistance){
			return obj;
		}

		if(obj->isStructureObject() && StructureManager::instance()->isInStructureFootprint(cast<StructureObject*>(obj.get()), x, y, margin) ){
				return obj;
		}
	}

	return NULL;

}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:30,代码来源:PlanetManagerImplementation.cpp

示例10: notifyInsertToZone

void JukeboxImplementation::notifyInsertToZone(Zone* zone) {
	ManagedReference<Jukebox*> jbox = _this.getReferenceUnsafeStaticCast();

	Locker _lock(jbox);

	createChildObjects();

	ManagedReference<JukeboxObserver*> observer = new JukeboxObserver(jbox);

	jbox->registerObserver(ObserverEventType::PARENTCHANGED, observer);

	ManagedReference<SceneObject*> obj = jbox->getRootParent().get();

	if (obj == NULL || !obj->isStructureObject())
		setRadius(100);
	else
		setRadius(30);

	SortedVector<ManagedReference<SceneObject*> >* children = jbox->getChildObjects();

	for (int i = 0; i < children->size(); ++i) {
		ManagedReference<SceneObject*> child = children->get(i);

		if (child != NULL && child->isActiveArea()) {
			ManagedReference<ActiveArea*> area = cast<ActiveArea*>(child.get());
			area->registerObserver(ObserverEventType::ENTEREDAREA, observer);
			area->registerObserver(ObserverEventType::EXITEDAREA, observer);
		}
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:30,代码来源:JukeboxImplementation.cpp

示例11: fillObjectMenuResponse

void LairMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) const {

	if (!sceneObject->isTangibleObject())
		return;

	TangibleObject* tano = cast<TangibleObject*>(sceneObject);
	if(tano == NULL)
		return;

	ManagedReference<LairObserver*> lairObserver = NULL;
	SortedVector<ManagedReference<Observer*> > observers = tano->getObservers(ObserverEventType::OBJECTDESTRUCTION);

	for (int i = 0; i < observers.size(); i++) {
		lairObserver = cast<LairObserver*>(observers.get(i).get());

		if (lairObserver != NULL)
			break;
	}

	if(player->hasSkill("outdoors_scout_novice") && player->getDistanceTo(sceneObject) < 8 && lairObserver && lairObserver->getMobType() != LairTemplate::NPC) {
		menuResponse->addRadialMenuItem(50, 3, "@lair_n:search_lair"); //Search Lair
	}

	TangibleObjectMenuComponent::fillObjectMenuResponse(sceneObject, menuResponse, player);

}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:26,代码来源:LairMenuComponent.cpp

示例12: getInRangeParkingGarage

SceneObject* StructureManager::getInRangeParkingGarage(SceneObject* obj, int range) {
	ManagedReference<Zone*> zone = obj->getZone();

	if (zone == NULL)
		return NULL;

	SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
	CloseObjectsVector* closeObjectsVector = (CloseObjectsVector*) obj->getCloseObjects();

	if (closeObjectsVector == NULL) {
		zone->getInRangeObjects(obj->getPositionX(), obj->getPositionY(), 128, &closeSceneObjects, true);
	} else {
		closeObjectsVector->safeCopyTo(closeSceneObjects);
	}

	for (int i = 0; i < closeSceneObjects.size(); ++i) {
		SceneObject* scno = cast<SceneObject*>(closeSceneObjects.get(i).get());

		if (scno == obj)
			continue;

		if (scno->isGarage() && scno->isInRange(obj, range))
			return scno;
	}

	return NULL;
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:27,代码来源:StructureManager.cpp

示例13: isBuildingPermittedAt

bool PlanetManagerImplementation::isBuildingPermittedAt(float x, float y, SceneObject* object, float margin) {
	SortedVector<ActiveArea*> activeAreas;

	Vector3 targetPos(x, y, 0);

	if (!zone->isWithinBoundaries(targetPos))
		return false;

	//targetPos.setZ(zone->getHeight(x, y)); not needed

	zone->getInRangeActiveAreas(x, y, &activeAreas, true);

	for (int i = 0; i < activeAreas.size(); ++i) {
		ActiveArea* area = activeAreas.get(i);

		if (area->isNoBuildArea()) {
			return false;
		}
	}

	if (isInObjectsNoBuildZone(x, y, margin)) {
		return false;
	}

	if (isInWater(x, y)) {
		return false;
	}

	if (isInRangeWithPoi(x, y, 150))
		return false;

	return true;
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:33,代码来源:PlanetManagerImplementation.cpp

示例14: isSpawningPermittedAt

bool PlanetManagerImplementation::isSpawningPermittedAt(float x, float y, float margin) {
	SortedVector<ActiveArea*> activeAreas;

	Vector3 targetPos(x, y, zone->getHeight(x, y));

	if (!zone->isWithinBoundaries(targetPos))
		return false;

	zone->getInRangeActiveAreas(x, y, &activeAreas, true);
	zone->getInRangeActiveAreas(x, y, margin + 64.f, &activeAreas, true);

	for (int i = 0; i < activeAreas.size(); ++i) {
		ActiveArea* area = activeAreas.get(i);

		if (area->isRegion() || area->isMunicipalZone() || area->isNoSpawnArea()) {
			return false;
		}
	}

	if (isInObjectsNoBuildZone(x, y, margin)) {
		return false;
	}

	if (isInWater(x, y)) {
		return false;
	}

	if (isInRangeWithPoi(x, y, 150))
		return false;

	if (terrainManager->getHighestHeightDifference(x - 10, y - 10, x + 10, y + 10) > 15.0)
		return false;

	return true;
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:35,代码来源:PlanetManagerImplementation.cpp

示例15: isCampingPermittedAt

bool PlanetManagerImplementation::isCampingPermittedAt(float x, float y, float margin) {
	SortedVector<ManagedReference<ActiveArea* > > activeAreas;

	Vector3 targetPos(x, y, zone->getHeight(x, y));

	zone->getInRangeActiveAreas(x, y, &activeAreas, true);

	for (int i = 0; i < activeAreas.size(); ++i) {
		ActiveArea* area = activeAreas.get(i);

		// Skip areas explicitly marked as camping allowed
		if (area->isCampingPermitted()) {
			continue;
		}

		// Honor no-build after checking for areas that camping is explicitly allowed
		if (area->isNoBuildArea()) {
				return false;
		}
	}

	if (isInWater(x, y)) {
		return false;
	}

	if (isInRangeWithPoi(x, y, 150))
		return false;

	return true;
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:30,代码来源:PlanetManagerImplementation.cpp


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