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


C++ Targets::GetTarget方法代码示例

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


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

示例1: GetActorFromObject

Scriptable* GetActorFromObject(Scriptable* Sender, Object* oC, int ga_flags)
{
	Scriptable *aC = NULL;

	if (!oC) {
		return NULL;
	}
	Targets *tgts = GetAllObjects(Sender->GetCurrentArea(), Sender, oC, ga_flags);
	if (tgts) {
		//now this could return other than actor objects
		aC = tgts->GetTarget(0,-1);
		delete tgts;
		/*if (!aC && (ga_flags&GA_GLOBAL) )
		{
			tgts = GetAllObjectsNearby(Sender, oC, ga_flags);
			if (tgts) {
				//now this could return other than actor objects
				aC = tgts->GetTarget(0,-1);
				delete tgts;
			}
		}*/
		return aC;
	}

	if (oC->objectName[0]) {
		// if you ActionOverride a global actor, they might not have a map :(
		// TODO: don't allow this to happen?
		if (Sender->GetCurrentArea()) {
			aC = GetActorObject(Sender->GetCurrentArea()->GetTileMap(), oC->objectName );
			if (aC) {
				return aC;
			}
		}
		Game *game = core->GetGame();

		//global actors are always found by scripting name!
		aC = game->FindPC(oC->objectName);
		if (aC) {
			return aC;
		}
		aC = game->FindNPC(oC->objectName);
		if (aC) {
			return aC;
		}

		/*if (ga_flags&GA_GLOBAL) {
			size_t mc = game->GetLoadedMapCount();
			while(mc--) {
				Map *map = game->GetMap(mc);
				if (map==Sender->GetCurrentArea()) continue;
				aC = GetActorObject(map->GetTileMap(), oC->objectName);
				if (aC) {
					return aC;
				}
			}
		}*/
	}
	return NULL;
}
开发者ID:NickDaly,项目名称:GemRB-FixConfig-Branch,代码行数:59,代码来源:Matching.cpp

示例2: GetActorFromObject

Scriptable* GetActorFromObject(Scriptable* Sender, Object* oC, int ga_flags)
{
	Scriptable *aC = NULL;

	Game *game = core->GetGame();
	Targets *tgts = GetAllObjects(Sender->GetCurrentArea(), Sender, oC, ga_flags);
	if (tgts) {
		//now this could return other than actor objects
		aC = tgts->GetTarget(0,-1);
		delete tgts;
		if (aC || !oC || oC->objectFields[0]!=-1) {
			return aC;
		}

		//global actors are always found by object ID!
		return game->GetGlobalActorByGlobalID(oC->objectFields[1]);
	}

	if (!oC) {
		return NULL;
	}

	if (oC->objectName[0]) {
		// if you ActionOverride a global actor, they might not have a map :(
		// TODO: don't allow this to happen?
		if (Sender->GetCurrentArea()) {
			aC = GetActorObject(Sender->GetCurrentArea()->GetTileMap(), oC->objectName );
			if (aC) {
				return aC;
			}
		}

		//global actors are always found by scripting name!
		aC = game->FindPC(oC->objectName);
		if (aC) {
			return aC;
		}
		aC = game->FindNPC(oC->objectName);
		if (aC) {
			return aC;
		}
	}
	return NULL;
}
开发者ID:AlanWasTaken,项目名称:gemrb,代码行数:44,代码来源:Matching.cpp


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