本文整理汇总了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;
}
示例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;
}