|
|
@ -42,7 +42,7 @@ DEFINE_ACTION(ContextGlobal,SQD_TMPL)
|
|
|
|
nlassertex(currentInstance != NULL, ("No AIInstance created !"));
|
|
|
|
nlassertex(currentInstance != NULL, ("No AIInstance created !"));
|
|
|
|
CWorkPtr::aiInstance(currentInstance);
|
|
|
|
CWorkPtr::aiInstance(currentInstance);
|
|
|
|
CAIInstance *aii = CWorkPtr::aiInstance();
|
|
|
|
CAIInstance *aii = CWorkPtr::aiInstance();
|
|
|
|
|
|
|
|
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
string filename;
|
|
|
|
string filename;
|
|
|
|
if (!getArgs(args, name(), aliasTree, filename))
|
|
|
|
if (!getArgs(args, name(), aliasTree, filename))
|
|
|
@ -100,11 +100,11 @@ DEFINE_ACTION(ContextOutpostGroupDesc,IDTREE_F)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CAliasTreeOwner* childOwner = NULL;
|
|
|
|
CAliasTreeOwner* childOwner = NULL;
|
|
|
|
IAliasCont* cont = NULL;
|
|
|
|
IAliasCont* cont = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
// we try to get a valid IAliasCont for this type
|
|
|
|
// we try to get a valid IAliasCont for this type
|
|
|
|
if ( ! owner->getCont( childOwner, cont, AITYPES::AITypeSquadTemplateMember ) )
|
|
|
|
if ( ! owner->getCont( childOwner, cont, AITYPES::AITypeSquadTemplateMember ) )
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
// create a bot desc object (with alias 0)
|
|
|
|
// create a bot desc object (with alias 0)
|
|
|
|
CAliasTreeOwner* child = NULL;
|
|
|
|
CAliasTreeOwner* child = NULL;
|
|
|
|
CSmartPtr<CAIAliasDescriptionNode> fakeNode = new CAIAliasDescriptionNode( /*NLMISC::toString( "tm%u", j )*/botSheets[j], 0, AITYPES::AITypeSquadTemplateMember, NULL );
|
|
|
|
CSmartPtr<CAIAliasDescriptionNode> fakeNode = new CAIAliasDescriptionNode( /*NLMISC::toString( "tm%u", j )*/botSheets[j], 0, AITYPES::AITypeSquadTemplateMember, NULL );
|
|
|
@ -129,23 +129,23 @@ DEFINE_ACTION(ContextGlobal,OUTPOST)
|
|
|
|
nlassertex(currentInstance != NULL, ("No AIInstance created !"));
|
|
|
|
nlassertex(currentInstance != NULL, ("No AIInstance created !"));
|
|
|
|
CWorkPtr::aiInstance(currentInstance);
|
|
|
|
CWorkPtr::aiInstance(currentInstance);
|
|
|
|
CAIInstance *aii = CWorkPtr::aiInstance();
|
|
|
|
CAIInstance *aii = CWorkPtr::aiInstance();
|
|
|
|
|
|
|
|
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
string contName, mapName, filename, familyName;
|
|
|
|
string contName, mapName, filename, familyName;
|
|
|
|
if (!getArgs(args, name(), aliasTree, contName, filename, familyName))
|
|
|
|
if (!getArgs(args, name(), aliasTree, contName, filename, familyName))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!CWorkPtr::continent())
|
|
|
|
if (!CWorkPtr::continent())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// see whether the region is already created
|
|
|
|
// see whether the region is already created
|
|
|
|
COutpost *outpost = CWorkPtr::continent()->outposts().getChildByAlias(aliasTree->getAlias());
|
|
|
|
COutpost *outpost = CWorkPtr::continent()->outposts().getChildByAlias(aliasTree->getAlias());
|
|
|
|
|
|
|
|
|
|
|
|
// not found so create it
|
|
|
|
// not found so create it
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
outpost = new COutpost(CWorkPtr::continent(), aliasTree->getAlias(), aliasTree->getName(), filename);
|
|
|
|
outpost = new COutpost(CWorkPtr::continent(), aliasTree->getAlias(), aliasTree->getName(), filename);
|
|
|
|
|
|
|
|
|
|
|
|
CWorkPtr::continent()->outposts().addAliasChild(outpost);
|
|
|
|
CWorkPtr::continent()->outposts().addAliasChild(outpost);
|
|
|
|
CWorkPtr::outpost(outpost);
|
|
|
|
CWorkPtr::outpost(outpost);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,10 +153,10 @@ DEFINE_ACTION(ContextGlobal,OUTPOST)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
outpost->registerForFile(filename);
|
|
|
|
outpost->registerForFile(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// set the owner tribe
|
|
|
|
// set the owner tribe
|
|
|
|
CWorkPtr::outpost()->setTribe(familyName);
|
|
|
|
CWorkPtr::outpost()->setTribe(familyName);
|
|
|
|
|
|
|
|
|
|
|
|
CContextStack::setContext(ContextOutpost);
|
|
|
|
CContextStack::setContext(ContextOutpost);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -210,15 +210,15 @@ DEFINE_ACTION(ContextOutpost,IDTREE)
|
|
|
|
if (!getArgs(args, name(),aliasTree))
|
|
|
|
if (!getArgs(args, name(),aliasTree))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// have the manager update it's structure from the id tree
|
|
|
|
// have the manager update it's structure from the id tree
|
|
|
|
nlinfo("ACTION IDTREE: Applying new tree to outpost[%u]: '%s'%s in continent '%s'",
|
|
|
|
nlinfo("ACTION IDTREE: Applying new tree to outpost[%u]: '%s'%s in continent '%s'",
|
|
|
|
CWorkPtr::outpost()->getChildIndex(),
|
|
|
|
CWorkPtr::outpost()->getChildIndex(),
|
|
|
|
CWorkPtr::outpost()->getName().c_str(),
|
|
|
|
CWorkPtr::outpost()->getName().c_str(),
|
|
|
|
CWorkPtr::outpost()->getAliasString().c_str(),
|
|
|
|
CWorkPtr::outpost()->getAliasString().c_str(),
|
|
|
|
CWorkPtr::outpost()->getOwner()->getName().c_str()
|
|
|
|
CWorkPtr::outpost()->getOwner()->getName().c_str()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (aliasTree && CWorkPtr::outpost())
|
|
|
|
if (aliasTree && CWorkPtr::outpost())
|
|
|
|
CWorkPtr::outpost()->updateAliasTree(*aliasTree);
|
|
|
|
CWorkPtr::outpost()->updateAliasTree(*aliasTree);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -228,7 +228,7 @@ DEFINE_ACTION(ContextOutpost,OUTPOGEO)
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector <CAIVector> points;
|
|
|
|
std::vector <CAIVector> points;
|
|
|
|
for (uint i=0; i<(args.size()-1); i+=2)
|
|
|
|
for (uint i=0; i<(args.size()-1); i+=2)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -248,19 +248,19 @@ DEFINE_ACTION(ContextOutpost,SPWNZONE)
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
float x, y, r;
|
|
|
|
float x, y, r;
|
|
|
|
uint32 verticalPos;
|
|
|
|
uint32 verticalPos;
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
if (!getArgs(args, name(), aliasTree, x, y, r, verticalPos))
|
|
|
|
if (!getArgs(args, name(), aliasTree, x, y, r, verticalPos))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// see whether the region is already loaded
|
|
|
|
// see whether the region is already loaded
|
|
|
|
COutpostSpawnZone* spawnZone = outpost->spawnZones().getChildByAlias(aliasTree->getAlias());
|
|
|
|
COutpostSpawnZone* spawnZone = outpost->spawnZones().getChildByAlias(aliasTree->getAlias());
|
|
|
|
if (!spawnZone)
|
|
|
|
if (!spawnZone)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
spawnZone->setPosAndRadius((AITYPES::TVerticalPos)verticalPos, CAIPos(x, y, 0, 0.f), uint32(r*1000));
|
|
|
|
spawnZone->setPosAndRadius((AITYPES::TVerticalPos)verticalPos, CAIPos(x, y, 0, 0.f), uint32(r*1000));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -271,19 +271,19 @@ DEFINE_ACTION(ContextOutpost,BUILDING)
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
float x, y, theta;
|
|
|
|
float x, y, theta;
|
|
|
|
uint32 verticalPos;
|
|
|
|
uint32 verticalPos;
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
if (!getArgs(args, name(), aliasTree, x, y, theta, verticalPos))
|
|
|
|
if (!getArgs(args, name(), aliasTree, x, y, theta, verticalPos))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// see whether the region is already loaded
|
|
|
|
// see whether the region is already loaded
|
|
|
|
COutpostSpawnZone* spawnZone = outpost->spawnZones().getChildByAlias(aliasTree->getAlias());
|
|
|
|
COutpostSpawnZone* spawnZone = outpost->spawnZones().getChildByAlias(aliasTree->getAlias());
|
|
|
|
if (!spawnZone)
|
|
|
|
if (!spawnZone)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
spawnZone->setPosAndRadius((AITYPES::TVerticalPos)verticalPos, CAIPos(x, y, 0, 0.f), uint32(r*1000));
|
|
|
|
spawnZone->setPosAndRadius((AITYPES::TVerticalPos)verticalPos, CAIPos(x, y, 0, 0.f), uint32(r*1000));
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/****************************************************************************/
|
|
|
|
/****************************************************************************/
|
|
|
@ -291,15 +291,15 @@ DEFINE_ACTION(ContextOutpost,BUILDING)
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
CGroup* grp = outpost->getBuildingGroup();
|
|
|
|
CGroup* grp = outpost->getBuildingGroup();
|
|
|
|
if (!grp)
|
|
|
|
if (!grp)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
uint32 alias;
|
|
|
|
uint32 alias;
|
|
|
|
if (!getArgs(args, name(), alias))
|
|
|
|
if (!getArgs(args, name(), alias))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// LOG("Outpost Building: group: %s, bot: %u", grp->getFullName().c_str(), alias);
|
|
|
|
// LOG("Outpost Building: group: %s, bot: %u", grp->getFullName().c_str(), alias);
|
|
|
|
|
|
|
|
|
|
|
|
// set workptr::bot to this bot
|
|
|
|
// set workptr::bot to this bot
|
|
|
|
CWorkPtr::bot(grp->bots().getChildByAlias(alias)); //lookupBotInGrpNpc(alias));
|
|
|
|
CWorkPtr::bot(grp->bots().getChildByAlias(alias)); //lookupBotInGrpNpc(alias));
|
|
|
|
if (!CWorkPtr::botNpc())
|
|
|
|
if (!CWorkPtr::botNpc())
|
|
|
@ -380,15 +380,15 @@ DEFINE_ACTION(ContextOutpost,CHGPARM)
|
|
|
|
COutpost *outpost = CWorkPtr::outpost();
|
|
|
|
COutpost *outpost = CWorkPtr::outpost();
|
|
|
|
if (!outpost)
|
|
|
|
if (!outpost)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
if (!getArgs(args, name(), aliasTree))
|
|
|
|
if (!getArgs(args, name(), aliasTree))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
COutpostSquadFamily* squadFamily = outpost->squadFamilies().getChildByAlias(aliasTree->getAlias());
|
|
|
|
COutpostSquadFamily* squadFamily = outpost->squadFamilies().getChildByAlias(aliasTree->getAlias());
|
|
|
|
if (!squadFamily)
|
|
|
|
if (!squadFamily)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
CWorkPtr::outpostSquadFamily(squadFamily);
|
|
|
|
CWorkPtr::outpostSquadFamily(squadFamily);
|
|
|
|
CContextStack::setContext(ContextOutpostSquadFamily);
|
|
|
|
CContextStack::setContext(ContextOutpostSquadFamily);
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
@ -402,7 +402,7 @@ static void DoMgrAction(
|
|
|
|
// CAIInstance* aiInstance = currentInstance;
|
|
|
|
// CAIInstance* aiInstance = currentInstance;
|
|
|
|
// CWorkPtr::aiInstance(aiInstance); // set the current AIInstance.
|
|
|
|
// CWorkPtr::aiInstance(aiInstance); // set the current AIInstance.
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
COutpost* outpost = CWorkPtr::outpost();
|
|
|
|
|
|
|
|
|
|
|
|
// get hold of the manager's slot id - note that managers are identified by slot and not by alias!
|
|
|
|
// get hold of the manager's slot id - note that managers are identified by slot and not by alias!
|
|
|
|
uint32 alias;
|
|
|
|
uint32 alias;
|
|
|
|
std::string name, mapName, filename;
|
|
|
|
std::string name, mapName, filename;
|
|
|
@ -417,25 +417,25 @@ static void DoMgrAction(
|
|
|
|
if (!getArgs(args, "MANAGER", alias, name, mapName, filename))
|
|
|
|
if (!getArgs(args, "MANAGER", alias, name, mapName, filename))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// see whether the manager is already loaded
|
|
|
|
// see whether the manager is already loaded
|
|
|
|
COutpostManager* mgr = static_cast<COutpostManager*>(outpost->managers().getChildByAlias(alias));
|
|
|
|
COutpostManager* mgr = static_cast<COutpostManager*>(outpost->managers().getChildByAlias(alias));
|
|
|
|
|
|
|
|
|
|
|
|
// not found so look for a free slot
|
|
|
|
// not found so look for a free slot
|
|
|
|
nlassert(mgr);
|
|
|
|
nlassert(mgr);
|
|
|
|
// outpost->newMgr(type, alias, name, mapName, filename);
|
|
|
|
// outpost->newMgr(type, alias, name, mapName, filename);
|
|
|
|
mgr->registerForFile(filename);
|
|
|
|
mgr->registerForFile(filename);
|
|
|
|
mgr->setAutoSpawn(!manualSpawn);
|
|
|
|
mgr->setAutoSpawn(!manualSpawn);
|
|
|
|
|
|
|
|
|
|
|
|
mgr = outpost->managers().getChildByAlias(alias);
|
|
|
|
mgr = outpost->managers().getChildByAlias(alias);
|
|
|
|
|
|
|
|
|
|
|
|
// setup the working manager pointer and exit
|
|
|
|
// setup the working manager pointer and exit
|
|
|
|
CWorkPtr::mgr(mgr);
|
|
|
|
CWorkPtr::mgr(mgr);
|
|
|
|
if (mgr)
|
|
|
|
if (mgr)
|
|
|
|
CWorkPtr::eventReactionContainer(mgr->getStateMachine());
|
|
|
|
CWorkPtr::eventReactionContainer(mgr->getStateMachine());
|
|
|
|
else
|
|
|
|
else
|
|
|
|
CWorkPtr::eventReactionContainer(NULL);
|
|
|
|
CWorkPtr::eventReactionContainer(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
// push the manager context onto the context stack
|
|
|
|
// push the manager context onto the context stack
|
|
|
|
CContextStack::setContext(context);
|
|
|
|
CContextStack::setContext(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -456,24 +456,24 @@ DEFINE_ACTION(ContextOutpostSquadFamily,IDTREE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// set the id tree for the region (results in creation or update of region's object tree)
|
|
|
|
// set the id tree for the region (results in creation or update of region's object tree)
|
|
|
|
// args: aliasTree
|
|
|
|
// args: aliasTree
|
|
|
|
|
|
|
|
|
|
|
|
if (!CWorkPtr::outpostSquadFamily())
|
|
|
|
if (!CWorkPtr::outpostSquadFamily())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
CAIAliasDescriptionNode *aliasTree;
|
|
|
|
if (!getArgs(args, name(),aliasTree))
|
|
|
|
if (!getArgs(args, name(),aliasTree))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// have the manager update it's structure from the id tree
|
|
|
|
// have the manager update it's structure from the id tree
|
|
|
|
nlinfo("ACTION IDTREE: Applying new tree to outpost[%u]: '%s'%s in continent '%s'",
|
|
|
|
nlinfo("ACTION IDTREE: Applying new tree to outpost[%u]: '%s'%s in continent '%s'",
|
|
|
|
CWorkPtr::outpostSquadFamily()->getChildIndex(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getChildIndex(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getName().c_str(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getName().c_str(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getAliasString().c_str(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getAliasString().c_str(),
|
|
|
|
CWorkPtr::outpostSquadFamily()->getOwner()->getName().c_str()
|
|
|
|
CWorkPtr::outpostSquadFamily()->getOwner()->getName().c_str()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (aliasTree && CWorkPtr::outpostSquadFamily())
|
|
|
|
if (aliasTree && CWorkPtr::outpostSquadFamily())
|
|
|
|
CWorkPtr::outpostSquadFamily()->updateAliasTree(*aliasTree);
|
|
|
|
CWorkPtr::outpostSquadFamily()->updateAliasTree(*aliasTree);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -484,30 +484,35 @@ DEFINE_ACTION(ContextSquadTemplateVariant,GRPTMPL)
|
|
|
|
COutpostSquadFamily* const squadFamily = aii->getSquadFamily();
|
|
|
|
COutpostSquadFamily* const squadFamily = aii->getSquadFamily();
|
|
|
|
if (!squadFamily)
|
|
|
|
if (!squadFamily)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
string grpFamily; // Ignored
|
|
|
|
string grpFamily; // Ignored
|
|
|
|
uint32 botCount;
|
|
|
|
uint32 botCount;
|
|
|
|
bool countMultipliedBySheet;
|
|
|
|
bool countMultipliedBySheet;
|
|
|
|
bool multiLevel;
|
|
|
|
bool multiLevel;
|
|
|
|
|
|
|
|
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
if (!getArgs(args, name(), aliasTree, grpFamily, botCount, countMultipliedBySheet, multiLevel))
|
|
|
|
if (!getArgs(args, name(), aliasTree, grpFamily, botCount, countMultipliedBySheet, multiLevel))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
IAliasCont *aliasCont = squadFamily->getAliasCont( AITYPES::AITypeGroupTemplate );
|
|
|
|
IAliasCont *aliasCont = squadFamily->getAliasCont( AITYPES::AITypeGroupTemplate );
|
|
|
|
CAliasTreeOwner *child = squadFamily->createChild( aliasCont, aliasTree );
|
|
|
|
CAliasTreeOwner *child = squadFamily->createChild( aliasCont, aliasTree );
|
|
|
|
CGroupDesc<COutpostSquadFamily> *groupDesc = (dynamic_cast<CGroupDesc<COutpostSquadFamily>*>(child));
|
|
|
|
CGroupDesc<COutpostSquadFamily> *groupDesc = (dynamic_cast<CGroupDesc<COutpostSquadFamily>*>(child));
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
aii->registerSquadVariant( CWorkPtr::squadVariantName(), groupDesc );
|
|
|
|
FOREACH(itAIInstance, CCont<CAIInstance>, CAIS::instance().AIList())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CAIInstance* aiinstance = *itAIInstance;
|
|
|
|
|
|
|
|
aiinstance->registerSquadVariant( CWorkPtr::squadVariantName(), groupDesc );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CWorkPtr::groupDesc( groupDesc );
|
|
|
|
CWorkPtr::groupDesc( groupDesc );
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->setBaseBotCount(botCount);
|
|
|
|
groupDesc->setBaseBotCount(botCount);
|
|
|
|
groupDesc->setCountMultiplierFlag(countMultipliedBySheet);
|
|
|
|
groupDesc->setCountMultiplierFlag(countMultipliedBySheet);
|
|
|
|
groupDesc->setMultiLevel(multiLevel);
|
|
|
|
groupDesc->setMultiLevel(multiLevel);
|
|
|
|
|
|
|
|
|
|
|
|
CContextStack::setContext(ContextOutpostGroupDesc);
|
|
|
|
CContextStack::setContext(ContextOutpostGroupDesc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -527,12 +532,12 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_SHEE,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
string lookSheet;
|
|
|
|
string lookSheet;
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), lookSheet))
|
|
|
|
if (!getArgs(args,name(), lookSheet))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!groupDesc->setSheet(lookSheet))
|
|
|
|
if (!groupDesc->setSheet(lookSheet))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
groupDesc->getOwner()->groupDescs().removeChildByIndex(groupDesc->getChildIndex());
|
|
|
|
groupDesc->getOwner()->groupDescs().removeChildByIndex(groupDesc->getChildIndex());
|
|
|
@ -548,12 +553,12 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_LVLD,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
sint32 levelDelta;
|
|
|
|
sint32 levelDelta;
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), levelDelta))
|
|
|
|
if (!getArgs(args,name(), levelDelta))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->setLevelDelta(levelDelta);
|
|
|
|
groupDesc->setLevelDelta(levelDelta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -564,12 +569,12 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_SEAS,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
bool seasons[4];
|
|
|
|
bool seasons[4];
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), seasons[0], seasons[1], seasons[2], seasons[3]))
|
|
|
|
if (!getArgs(args,name(), seasons[0], seasons[1], seasons[2], seasons[3]))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->setSeasonFlags(seasons);
|
|
|
|
groupDesc->setSeasonFlags(seasons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -580,11 +585,11 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_ACT,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
uint32 spawnType;
|
|
|
|
uint32 spawnType;
|
|
|
|
if (!getArgs(args, name(), spawnType))
|
|
|
|
if (!getArgs(args, name(), spawnType))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->setSpawnType((AITYPES::TSpawnType)spawnType);
|
|
|
|
groupDesc->setSpawnType((AITYPES::TSpawnType)spawnType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -594,8 +599,8 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_APRM,FamilyT)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string property;
|
|
|
|
string property;
|
|
|
@ -611,12 +616,12 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_NRG,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
uint32 weight[4];
|
|
|
|
uint32 weight[4];
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), weight[0], weight[1], weight[2], weight[3]))
|
|
|
|
if (!getArgs(args,name(), weight[0], weight[1], weight[2], weight[3]))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->setWeightLevels(weight);
|
|
|
|
groupDesc->setWeightLevels(weight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -627,9 +632,9 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_EQUI,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
groupDesc->botEquipment().clear();
|
|
|
|
groupDesc->botEquipment().clear();
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string equip;
|
|
|
|
string equip;
|
|
|
@ -670,23 +675,23 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,BOTTMPL,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
string lookSheet;
|
|
|
|
string lookSheet;
|
|
|
|
bool multiLevel;
|
|
|
|
bool multiLevel;
|
|
|
|
|
|
|
|
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
// read the alias tree from the argument list
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
CAIAliasDescriptionNode* aliasTree;
|
|
|
|
if (!getArgs(args, name(), aliasTree, lookSheet, multiLevel))
|
|
|
|
if (!getArgs(args, name(), aliasTree, lookSheet, multiLevel))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// see whether the region is already loaded
|
|
|
|
// see whether the region is already loaded
|
|
|
|
CBotDesc<FamilyT>* botDesc = groupDesc->botDescs().getChildByAlias(aliasTree->getAlias());
|
|
|
|
CBotDesc<FamilyT>* botDesc = groupDesc->botDescs().getChildByAlias(aliasTree->getAlias());
|
|
|
|
if (!botDesc)
|
|
|
|
if (!botDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
botDesc->setMultiLevel(multiLevel);
|
|
|
|
botDesc->setMultiLevel(multiLevel);
|
|
|
|
botDesc->setSheet(lookSheet);
|
|
|
|
botDesc->setSheet(lookSheet);
|
|
|
|
|
|
|
|
|
|
|
|
CWorkPtr::botDesc(botDesc);
|
|
|
|
CWorkPtr::botDesc(botDesc);
|
|
|
|
CContextStack::setContext(ContextOutpostBotDesc);
|
|
|
|
CContextStack::setContext(ContextOutpostBotDesc);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -698,7 +703,7 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostBotDesc,BT_EQUI,FamilyT)
|
|
|
|
CBotDesc<FamilyT>* botDesc = static_cast<CBotDesc<FamilyT>*>(CWorkPtr::botDesc());
|
|
|
|
CBotDesc<FamilyT>* botDesc = static_cast<CBotDesc<FamilyT>*>(CWorkPtr::botDesc());
|
|
|
|
if (!botDesc)
|
|
|
|
if (!botDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
for (size_t i=0; i<args.size(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string equip;
|
|
|
|
string equip;
|
|
|
@ -714,12 +719,12 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostBotDesc,BT_LVLD,FamilyT)
|
|
|
|
CBotDesc<FamilyT>* botDesc = static_cast<CBotDesc<FamilyT>*>(CWorkPtr::botDesc());
|
|
|
|
CBotDesc<FamilyT>* botDesc = static_cast<CBotDesc<FamilyT>*>(CWorkPtr::botDesc());
|
|
|
|
if (!botDesc)
|
|
|
|
if (!botDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
sint32 levelDelta;
|
|
|
|
sint32 levelDelta;
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), levelDelta))
|
|
|
|
if (!getArgs(args,name(), levelDelta))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
botDesc->setLevelDelta(levelDelta);
|
|
|
|
botDesc->setLevelDelta(levelDelta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -731,9 +736,9 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_GNRJ,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
uint32 energyValue;
|
|
|
|
uint32 energyValue;
|
|
|
|
|
|
|
|
|
|
|
|
if (!getArgs(args,name(), energyValue))
|
|
|
|
if (!getArgs(args,name(), energyValue))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -747,34 +752,34 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,POPVER,FamilyT)
|
|
|
|
|
|
|
|
|
|
|
|
if(!CWorkPtr::groupDesc())
|
|
|
|
if(!CWorkPtr::groupDesc())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
const uint32 fixedArgsCount = 0;
|
|
|
|
const uint32 fixedArgsCount = 0;
|
|
|
|
if (args.size()<fixedArgsCount+2 || ((args.size()-fixedArgsCount)&1)==1)
|
|
|
|
if (args.size()<fixedArgsCount+2 || ((args.size()-fixedArgsCount)&1)==1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("POPVER action FAILED due to bad number of arguments (%d)", args.size());
|
|
|
|
nlwarning("POPVER action FAILED due to bad number of arguments (%d)", args.size());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get hold of the parameters and check their validity
|
|
|
|
// get hold of the parameters and check their validity
|
|
|
|
for (size_t i=fixedArgsCount; i+1<args.size(); i+=2)
|
|
|
|
for (size_t i=fixedArgsCount; i+1<args.size(); i+=2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string sheet;
|
|
|
|
std::string sheet;
|
|
|
|
uint32 count;
|
|
|
|
uint32 count;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !args[i].get(sheet)
|
|
|
|
if ( !args[i].get(sheet)
|
|
|
|
|| !args[i+1].get(count))
|
|
|
|
|| !args[i+1].get(count))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("POPVER Add Record FAILED due to bad arguments");
|
|
|
|
nlwarning("POPVER Add Record FAILED due to bad arguments");
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSheetId sheetId(sheet);
|
|
|
|
CSheetId sheetId(sheet);
|
|
|
|
if (sheetId==CSheetId::Unknown)
|
|
|
|
if (sheetId==CSheetId::Unknown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("POPVER Add Record Invalid sheet: %s", sheet.c_str());
|
|
|
|
nlwarning("POPVER Add Record Invalid sheet: %s", sheet.c_str());
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AISHEETS::ICreatureCPtr sheetPtr = AISHEETS::CSheets::getInstance()->lookup(sheetId);
|
|
|
|
AISHEETS::ICreatureCPtr sheetPtr = AISHEETS::CSheets::getInstance()->lookup(sheetId);
|
|
|
|
if (!sheetPtr)
|
|
|
|
if (!sheetPtr)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -794,7 +799,7 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_END,FamilyT)
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
CGroupDesc<FamilyT>* groupDesc = static_cast<CGroupDesc<FamilyT>*>(CWorkPtr::groupDesc());
|
|
|
|
if (!groupDesc)
|
|
|
|
if (!groupDesc)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!groupDesc->isMultiLevel())
|
|
|
|
if (!groupDesc->isMultiLevel())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 totalEnergyValue = groupDesc->calcTotalEnergyValue();
|
|
|
|
uint32 totalEnergyValue = groupDesc->calcTotalEnergyValue();
|
|
|
|