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


C++ Object::getType方法代码示例

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


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

示例1: getObjectType

void Functions::getObjectType(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (int32) kObjectTypeInvalid;

	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!object || ((uint32)object->getType() >= kObjectTypeMAX))
		return;

	ctx.getReturn() = (int32) object->getType();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:functions_object.cpp

示例2: removeObject

void ObjectContainer::removeObject(Witcher::Object &object) {
	lock();

	_objects[object.getType()].remove(&object);

	::Aurora::NWScript::ObjectContainer::removeObject(object);

	unlock();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:objectcontainer.cpp

示例3: addObject

void ObjectContainer::addObject(Witcher::Object &object) {
	lock();

	::Aurora::NWScript::ObjectContainer::addObject(object);

	_objects[object.getType()].push_back(&object);

	unlock();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:objectcontainer.cpp

示例4: getNearestObject

void Functions::getNearestObject(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Witcher::Object *target = Witcher::ObjectContainer::toObject(getParamObject(ctx, 1));
	if (!target)
		return;

	// Bitfield of type(s) to check for
	uint32 type = ctx.getParams()[0].getInt();
	// We want the nth nearest object
	size_t nth  = MAX<int32>(ctx.getParams()[2].getInt() - 1, 0);

	Aurora::NWScript::ObjectSearch *search = _game->getModule().findObjects();
	Aurora::NWScript::Object       *object = 0;

	std::list<Object *> objects;
	while ((object = search->next())) {
		// Needs to be a valid object, not the target, but in the target's area
		Witcher::Object *witcherObject = Witcher::ObjectContainer::toObject(object);
		if (!witcherObject || (witcherObject == target) || (witcherObject->getArea() != target->getArea()))
			continue;

		// Ignore invalid object types
		const uint32 objectType = (uint32) witcherObject->getType();
		if (objectType >= kObjectTypeMAX)
			continue;

		if (type & objectType)
			objects.push_back(witcherObject);
	}

	delete search;

	objects.sort(ObjectDistanceSort(*target));

	std::list<Object *>::iterator it = objects.begin();
	for (size_t n = 0; (n < nth) && (it != objects.end()); ++n)
		++it;

	if (it != objects.end())
		ctx.getReturn() = *it;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:42,代码来源:functions_object.cpp


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