Merge branch 'fixes'

feature/prepare-cross-merge
Ulukyn 5 years ago committed by kaetemi
parent 8df98ce44a
commit ea095ca4f3
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -45,7 +45,7 @@ extern bool GrpHistoryRecordLog;
/// This is a common parent for all grp classes (bot group classes) /// This is a common parent for all grp classes (bot group classes)
/// Group contains a container of Bots. /// Group contains a container of Bots.
class CSpawnGroup class CSpawnGroup
: public NLMISC::CDbgRefCount<CSpawnGroup> : public NLMISC::CDbgRefCount<CSpawnGroup>
, public CSpawnable<CPersistent<CSpawnGroup> > , public CSpawnable<CPersistent<CSpawnGroup> >
, public CProfileOwner , public CProfileOwner
@ -53,45 +53,45 @@ class CSpawnGroup
{ {
public: public:
CSpawnGroup(CPersistent<CSpawnGroup>& owner); CSpawnGroup(CPersistent<CSpawnGroup>& owner);
virtual ~CSpawnGroup(); virtual ~CSpawnGroup();
virtual void spawnBotOfGroup(); virtual void spawnBotOfGroup();
void aggroLost(TDataSetRow const& aggroBot) const { } void aggroLost(TDataSetRow const& aggroBot) const { }
void aggroGain(TDataSetRow const& aggroBot) const { } void aggroGain(TDataSetRow const& aggroBot) const { }
virtual void spawnBots() = 0; virtual void spawnBots() = 0;
virtual void despawnBots(bool immediately) = 0; virtual void despawnBots(bool immediately) = 0;
virtual void update() = 0; virtual void update() = 0;
// Update Rate feature. // Update Rate feature.
virtual int getUpdatePriority() const { return 0; } virtual int getUpdatePriority() const { return 0; }
virtual void recalcUpdatePriorityDelta() { } virtual void recalcUpdatePriorityDelta() { }
CGroup& getPersistent() const; CGroup& getPersistent() const;
CAliasCont<CBot> const& bots() const; CAliasCont<CBot> const& bots() const;
CAliasCont<CBot>& bots(); CAliasCont<CBot>& bots();
CBot* findLeader(); CBot* findLeader();
CProfilePtr& movingProfile() { return _MovingProfile; } CProfilePtr& movingProfile() { return _MovingProfile; }
CProfilePtr& activityProfile() { return _ActivityProfile; } CProfilePtr& activityProfile() { return _ActivityProfile; }
CProfilePtr const& activityProfile() const { return _ActivityProfile; } CProfilePtr const& activityProfile() const { return _ActivityProfile; }
CProfilePtr& fightProfile() { return _FightProfile; } CProfilePtr& fightProfile() { return _FightProfile; }
/// only for use by State Machine (or problems will occurs -> callStateChanged if same ) /// only for use by State Machine (or problems will occurs -> callStateChanged if same )
void setMoveProfileFromStateMachine(IAIProfileFactory* staticProfile); void setMoveProfileFromStateMachine(IAIProfileFactory* staticProfile);
/// only for use by State Machine (or problems will occurs -> callStateChanged if same ) /// only for use by State Machine (or problems will occurs -> callStateChanged if same )
void setActivityProfileFromStateMachine(IAIProfileFactory* staticProfile); void setActivityProfileFromStateMachine(IAIProfileFactory* staticProfile);
bool calcCenterPos(CAIVector& grp_pos, bool allowDeadBot = false); bool calcCenterPos(CAIVector& grp_pos, bool allowDeadBot = false);
// Respawn bot list // Respawn bot list
class CBotToSpawn class CBotToSpawn
{ {
@ -123,32 +123,32 @@ public:
CAITimer _despawnTimer; CAITimer _despawnTimer;
CAITimer _respawnTimer; CAITimer _respawnTimer;
}; };
void incSpawnedBot(CBot& spawnBot); void incSpawnedBot(CBot& spawnBot);
void decSpawnedBot(); void decSpawnedBot();
void addBotToDespawnAndRespawnTime(CBot* faunaBot, uint32 despawnTime, uint32 respawnTime); void addBotToDespawnAndRespawnTime(CBot* faunaBot, uint32 despawnTime, uint32 respawnTime);
void checkDespawn(); void checkDespawn();
void checkRespawn(); void checkRespawn();
uint32 nbSpawnedBot() const { return _NbSpawnedBot; } uint32 nbSpawnedBot() const { return _NbSpawnedBot; }
uint32 nbBotToRespawn() const { return (uint32)_BotsToRespawn.size(); } uint32 nbBotToRespawn() const { return (uint32)_BotsToRespawn.size(); }
uint32 nbBotToDespawn() const { return (uint32)_BotsToDespawn.size(); } uint32 nbBotToDespawn() const { return (uint32)_BotsToDespawn.size(); }
bool isGroupAlive(uint32 const nbMoreKilledBot = 0) const; bool isGroupAlive(uint32 const nbMoreKilledBot = 0) const;
CAIVector const& getCenterPos() const { return _CenterPos; } CAIVector const& getCenterPos() const { return _CenterPos; }
void setCenterPos(CAIVector const& pos) { _CenterPos = pos; } void setCenterPos(CAIVector const& pos) { _CenterPos = pos; }
std::vector<std::string> getMultiLineInfoString() const; std::vector<std::string> getMultiLineInfoString() const;
virtual NLMISC::CSmartPtr<CAIPlace const> buildFirstHitPlace(TDataSetRow const& aggroBot) const; virtual NLMISC::CSmartPtr<CAIPlace const> buildFirstHitPlace(TDataSetRow const& aggroBot) const;
void addAggroFor(TDataSetRow const& bot, float aggro, bool forceReturnAggro, NLMISC::CSmartPtr<CAIPlace const> place = NLMISC::CSmartPtr<CAIPlace const>(NULL)); void addAggroFor(TDataSetRow const& bot, float aggro, bool forceReturnAggro, NLMISC::CSmartPtr<CAIPlace const> place = NLMISC::CSmartPtr<CAIPlace const>(NULL));
void setAggroMinimumFor(TDataSetRow const& bot, float aggro, bool forceReturnAggro, NLMISC::CSmartPtr<CAIPlace const> place = NLMISC::CSmartPtr<CAIPlace const>(NULL)); void setAggroMinimumFor(TDataSetRow const& bot, float aggro, bool forceReturnAggro, NLMISC::CSmartPtr<CAIPlace const> place = NLMISC::CSmartPtr<CAIPlace const>(NULL));
bool haveAggro() const; bool haveAggro() const;
@ -160,7 +160,7 @@ public:
const std::string getUrl() const { return _Url; } const std::string getUrl() const { return _Url; }
void setUrl(const std::string &url) { _Url = url; } void setUrl(const std::string &url) { _Url = url; }
protected: protected:
CProfilePtr _PunctualHoldMovingProfile; CProfilePtr _PunctualHoldMovingProfile;
CProfilePtr _PunctualHoldActivityProfile; CProfilePtr _PunctualHoldActivityProfile;
@ -173,7 +173,7 @@ private:
std::vector<CBotToSpawn> _BotsToRespawn; std::vector<CBotToSpawn> _BotsToRespawn;
std::vector<CBotToSpawn> _BotsToDespawn; std::vector<CBotToSpawn> _BotsToDespawn;
CProfilePtr _MovingProfile; CProfilePtr _MovingProfile;
CProfilePtr _ActivityProfile; CProfilePtr _ActivityProfile;
CProfilePtr _FightProfile; CProfilePtr _FightProfile;
@ -198,25 +198,25 @@ class CGroup
{ {
public: public:
friend class CSpawnGroup; friend class CSpawnGroup;
CGroup(CManager* owner, RYAI_MAP_CRUNCH::TAStarFlag denyFlag, CAIAliasDescriptionNode* aliasTree = NULL); CGroup(CManager* owner, RYAI_MAP_CRUNCH::TAStarFlag denyFlag, CAIAliasDescriptionNode* aliasTree = NULL);
CGroup(CManager* owner, RYAI_MAP_CRUNCH::TAStarFlag denyFlag, uint32 alias, std::string const& name); CGroup(CManager* owner, RYAI_MAP_CRUNCH::TAStarFlag denyFlag, uint32 alias, std::string const& name);
virtual ~CGroup(); virtual ~CGroup();
void serviceEvent(CServiceEvent const& info); void serviceEvent(CServiceEvent const& info);
CBot* getLeader(); CBot* getLeader();
CBot* getSquadLeader(bool checkAliveStatus = true); CBot* getSquadLeader(bool checkAliveStatus = true);
void despawnBots(); void despawnBots();
virtual CDynGrpBase* getGrpDynBase() = 0; virtual CDynGrpBase* getGrpDynBase() = 0;
CAliasTreeOwner* aliasTreeOwner() { return this; } CAliasTreeOwner* aliasTreeOwner() { return this; }
bool _AutoDestroy; bool _AutoDestroy;
void autoDestroy(bool ad) { _AutoDestroy = ad; } void autoDestroy(bool ad) { _AutoDestroy = ad; }
/// @name CChild implementation /// @name CChild implementation
//@{ //@{
virtual std::string getIndexString() const; virtual std::string getIndexString() const;
@ -224,67 +224,67 @@ public:
virtual std::vector<std::string> getMultiLineInfoString() const; virtual std::vector<std::string> getMultiLineInfoString() const;
virtual std::string getFullName() const; virtual std::string getFullName() const;
//@} //@}
virtual void lastBotDespawned(); virtual void lastBotDespawned();
virtual void firstBotSpawned(); virtual void firstBotSpawned();
virtual CPersistentStateInstance* getPersistentStateInstance() = 0; virtual CPersistentStateInstance* getPersistentStateInstance() = 0;
RYAI_MAP_CRUNCH::TAStarFlag getAStarFlag() const { return _DenyFlags; } RYAI_MAP_CRUNCH::TAStarFlag getAStarFlag() const { return _DenyFlags; }
virtual CAIS::CCounter& getSpawnCounter() = 0; virtual CAIS::CCounter& getSpawnCounter() = 0;
virtual RYZOMID::TTypeId getRyzomType() = 0; virtual RYZOMID::TTypeId getRyzomType() = 0;
virtual void setEvent(uint eventId) = 0; virtual void setEvent(uint eventId) = 0;
virtual bool spawn(); virtual bool spawn();
virtual NLMISC::CSmartPtr<CSpawnGroup> createSpawnGroup() = 0; virtual NLMISC::CSmartPtr<CSpawnGroup> createSpawnGroup() = 0;
virtual void despawnGrp(); virtual void despawnGrp();
void despawnBots(bool immediately); void despawnBots(bool immediately);
CAliasCont<CBot> const& bots() const { return _Bots; } CAliasCont<CBot> const& bots() const { return _Bots; }
CAliasCont<CBot>& bots() { return _Bots; } CAliasCont<CBot>& bots() { return _Bots; }
void display(CStringWriter& stringWriter); void display(CStringWriter& stringWriter);
CBot* getBot(uint32 index); CBot* getBot(uint32 index);
// debugging stuff // debugging stuff
CDebugHistory* getDebugHistory() { return this; } CDebugHistory* getDebugHistory() { return this; }
CBot* getNextValidBotChild(CBot* child = NULL) { return _Bots.getNextValidChild(child); } CBot* getNextValidBotChild(CBot* child = NULL) { return _Bots.getNextValidChild(child); }
CManager& getManager() { return *getOwner(); } CManager& getManager() { return *getOwner(); }
void setEscortTeamId(uint16 teamId) { _EscortTeamId = teamId; } void setEscortTeamId(uint16 teamId) { _EscortTeamId = teamId; }
uint16 getEscortTeamId() const { return _EscortTeamId; } uint16 getEscortTeamId() const { return _EscortTeamId; }
void setEscortRange(float range) { _EscortRange = range; } void setEscortRange(float range) { _EscortRange = range; }
float getEscortRange() const { return _EscortRange; } float getEscortRange() const { return _EscortRange; }
virtual void setAutoSpawn(bool autoSpawn) { _AutoSpawn = autoSpawn; } virtual void setAutoSpawn(bool autoSpawn) { _AutoSpawn = autoSpawn; }
bool isAutoSpawn() const { return _AutoSpawn; } bool isAutoSpawn() const { return _AutoSpawn; }
CAIInstance* getAIInstance() const { return getOwner()->getAIInstance(); } CAIInstance* getAIInstance() const { return getOwner()->getAIInstance(); }
void setEventParams(const std::vector<std::string> &a) { _EventParams = a; } void setEventParams(const std::vector<std::string> &a) { _EventParams = a; }
std::string getEventParamString(uint32 i) { if (i >= _EventParams.size()) return ""; return _EventParams[i]; } std::string getEventParamString(uint32 i) { if (i >= _EventParams.size()) return ""; return _EventParams[i]; }
float getEventParamFloat(uint32 i) { if (i >= _EventParams.size()) return 0.0f; return (float)atof(_EventParams[i].c_str()); } float getEventParamFloat(uint32 i) { if (i >= _EventParams.size()) return 0.0f; return (float)atof(_EventParams[i].c_str()); }
float _AggroRange; uint32 _AggroRange;
uint32 _UpdateNbTicks; uint32 _UpdateNbTicks;
protected: protected:
CAliasCont<CBot> _Bots; CAliasCont<CBot> _Bots;
/// Team Id of the escort (if any). /// Team Id of the escort (if any).
uint16 _EscortTeamId; uint16 _EscortTeamId;
/// The range of the escort, ie the maximal distance of any escorter player that alow the group to be escorted /// The range of the escort, ie the maximal distance of any escorter player that alow the group to be escorted
float _EscortRange; uint8 _EscortRange;
/// The bots automaticaly spawn when the group is spawned. /// The bots automaticaly spawn when the group is spawned.
bool _AutoSpawn; bool _AutoSpawn;
RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags;
std::vector<std::string> _EventParams; std::vector<std::string> _EventParams;
@ -299,7 +299,7 @@ protected:
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
inline inline
CSpawnGroup::CSpawnGroup(CPersistent<CSpawnGroup>& owner) CSpawnGroup::CSpawnGroup(CPersistent<CSpawnGroup>& owner)
: CSpawnable<CPersistent<CSpawnGroup> >(owner) : CSpawnable<CPersistent<CSpawnGroup> >(owner)
, CProfileOwner() , CProfileOwner()
, _NbSpawnedBot(0) , _NbSpawnedBot(0)
@ -351,10 +351,10 @@ bool CGroup::spawn()
{ {
if (isSpawned()) if (isSpawned())
return true; return true;
if (!getSpawnCounter().remainToMax()) if (!getSpawnCounter().remainToMax())
return false; return false;
setSpawn(createSpawnGroup()); setSpawn(createSpawnGroup());
return true; return true;
} }
@ -373,7 +373,7 @@ inline
void CGroup::despawnBots(bool immediately) void CGroup::despawnBots(bool immediately)
{ {
if (!isSpawned()) if (!isSpawned())
return; return;
getSpawnObj()->despawnBots(immediately); getSpawnObj()->despawnBots(immediately);
} }

File diff suppressed because it is too large Load Diff

@ -55,7 +55,7 @@ IAiFactory<IFamilyProfile> *_ProfileTribe=&_singleProfileTribe;
//CPropertyId act_nz_outpost_def("activity_npc_outpost_def"); //CPropertyId act_nz_outpost_def("activity_npc_outpost_def");
//CPropertyId act_nz_outpost_atk("activity_npc_outpost_atk"); //CPropertyId act_nz_outpost_atk("activity_npc_outpost_atk");
//CPropertyId act_nz_kami_wander("activity_npc_kami_wander"); //CPropertyId act_nz_kami_wander("activity_npc_kami_wander");
//CPropertyId act_nz_escort("activity_npc_escort"); //CPropertyId act_nz_escort("activity_npc_escort");
//CPropertyId act_nz_convoy("activity_npc_convoy"); //CPropertyId act_nz_convoy("activity_npc_convoy");
//CPropertyId act_nz_contact("activity_npc_contact"); //CPropertyId act_nz_contact("activity_npc_contact");
//CPropertyId act_nz_fight("activity_npc_fight"); //CPropertyId act_nz_fight("activity_npc_fight");
@ -71,7 +71,7 @@ IAiFactory<IFamilyProfile> *_ProfileTribe=&_singleProfileTribe;
//CPropertyId act_fz_rest_kitin_invasion("act_fz_rest_kitin_invasion"); //CPropertyId act_fz_rest_kitin_invasion("act_fz_rest_kitin_invasion");
//CPropertyId act_fz_food_degen("act_fz_food_degen"); //CPropertyId act_fz_food_degen("act_fz_food_degen");
//CPropertyId act_fz_plant("act_fz_plant"); //CPropertyId act_fz_plant("act_fz_plant");
//CPropertyId act_fz_rest_kitin("act_fz_rest_kitin"); //CPropertyId act_fz_rest_kitin("act_fz_rest_kitin");
//CPropertyId act_fz_rest_degen("act_fz_rest_degen"); //CPropertyId act_fz_rest_degen("act_fz_rest_degen");
// Todo: // Todo:
@ -96,15 +96,15 @@ void COutpostInfo::checkDespawnGroupList ()
while (_DespawnList.size()>0) while (_DespawnList.size()>0)
{ {
CGroupNpc *grpNpc=_DespawnList.back(); CGroupNpc *grpNpc=_DespawnList.back();
_DespawnList.pop_back(); _DespawnList.pop_back();
{ {
TGroupList::iterator it=_FightGroup.begin(); TGroupList::iterator it=_FightGroup.begin();
const TGroupList::iterator itEnd=_FightGroup.end(); const TGroupList::iterator itEnd=_FightGroup.end();
for (;(it!=itEnd) && ((*it).ptr()!=grpNpc);++it); for (;(it!=itEnd) && ((*it).ptr()!=grpNpc);++it);
if (it!=itEnd) if (it!=itEnd)
{ {
(*it)->despawnGrp(); (*it)->despawnGrp();
@ -119,14 +119,14 @@ void COutpostInfo::checkDespawnGroupList ()
const TGroupList::iterator itEnd=_ContactGroups.end(); const TGroupList::iterator itEnd=_ContactGroups.end();
for (;(it!=itEnd) && ((*it).ptr()!=grpNpc);++it); for (;(it!=itEnd) && ((*it).ptr()!=grpNpc);++it);
if (it!=itEnd) if (it!=itEnd)
{ {
(*it)->despawnGrp(); (*it)->despawnGrp();
_ContactGroups.erase(it); _ContactGroups.erase(it);
continue; continue;
} }
} }
#ifdef NL_DEBUG #ifdef NL_DEBUG
nlassert(true==false); // unknown group. nlassert(true==false); // unknown group.
@ -206,7 +206,7 @@ void COutpostInfo::fightGroups(bool exist)
// CGroupNpc *const grp = _FamilyProfileTribe->createNpcGroup(spawnZone,gd); // CGroupNpc *const grp = _FamilyProfileTribe->createNpcGroup(spawnZone,gd);
// if (!grp) // if (!grp)
// continue; // continue;
// //
// grp->setDiscardable (false); // grp->setDiscardable (false);
// // this group will run ! // // this group will run !
// grp->mergeProfileParameter (CProfileParameters::TProfileParameter("running", "", 0)); // grp->mergeProfileParameter (CProfileParameters::TProfileParameter("running", "", 0));
@ -224,7 +224,7 @@ void COutpostInfo::fightGroups(bool exist)
// return; // return;
// //
// for (TGroupList::iterator it=_FightGroup.begin(), itEnd=_FightGroup.end();it!=itEnd;++it) // for (TGroupList::iterator it=_FightGroup.begin(), itEnd=_FightGroup.end();it!=itEnd;++it)
// { // {
// NLMISC::CDbgPtr<CGroupNpc> &dbgPtr=*it; // NLMISC::CDbgPtr<CGroupNpc> &dbgPtr=*it;
//#ifdef NL_DEBUG //#ifdef NL_DEBUG
// nlassert(!dbgPtr.isNULL()); // nlassert(!dbgPtr.isNULL());
@ -273,11 +273,11 @@ void COutpostInfo::contactGroups(bool exist) // contact groups ..
// const CGroupDesc *gd = _FamilyBehavior->getOwner()->getOwner()->getProportionalGroupDesc(_FamilyBehavior, act_nz_contact+act_nz_contact_outpost, act_nz_escort+act_nz_convoy); // const CGroupDesc *gd = _FamilyBehavior->getOwner()->getOwner()->getProportionalGroupDesc(_FamilyBehavior, act_nz_contact+act_nz_contact_outpost, act_nz_escort+act_nz_convoy);
// if (!gd) // if (!gd)
// continue; // continue;
// //
// CGroupNpc *const grp=_FamilyProfileTribe->createNpcGroup(_FamilyProfileTribe->getCampZone(),gd); // CGroupNpc *const grp=_FamilyProfileTribe->createNpcGroup(_FamilyProfileTribe->getCampZone(),gd);
// if (!grp) // if (!grp)
// continue; // continue;
// //
// grp->getSpawnObj()->activityProfile().setAIProfile(new CGrpProfileDynContact(grp->getSpawnObj(), _FamilyProfileTribe, this)); // grp->getSpawnObj()->activityProfile().setAIProfile(new CGrpProfileDynContact(grp->getSpawnObj(), _FamilyProfileTribe, this));
// _ContactGroups.push_back(grp); // _ContactGroups.push_back(grp);
// //
@ -290,7 +290,7 @@ void COutpostInfo::contactGroups(bool exist) // contact groups ..
// return; // return;
// //
// for (TGroupList::iterator it=_ContactGroups.begin(), itEnd=_ContactGroups.end();it!=itEnd;++it) // for (TGroupList::iterator it=_ContactGroups.begin(), itEnd=_ContactGroups.end();it!=itEnd;++it)
// { // {
// NLMISC::CDbgPtr<CGroupNpc> &dbgPtr=*it; // NLMISC::CDbgPtr<CGroupNpc> &dbgPtr=*it;
// CGrpProfileDynFight *dynFight=safe_cast<CGrpProfileDynFight*>(dbgPtr->getSpawnObj()->activityProfile().getAIProfile()); // CGrpProfileDynFight *dynFight=safe_cast<CGrpProfileDynFight*>(dbgPtr->getSpawnObj()->activityProfile().getAIProfile());
// dynFight->gotoZone(_FamilyProfileTribe->getCampZone(),CPropertySet()); // dynFight->gotoZone(_FamilyProfileTribe->getCampZone(),CPropertySet());
@ -356,7 +356,7 @@ void CFamilyProfileTribe::outpostAdd(NLMISC::TStringId outpostName)
_FamilyBehavior->getName().c_str(), _FamilyBehavior->getName().c_str(),
_FamilyBehavior->getOwner()->getAliasFullName().c_str()); _FamilyBehavior->getOwner()->getAliasFullName().c_str());
CSmartPtr<COutpostInfo> outPost=COutpostInfo::createOutpost(_FamilyBehavior,this,outpostName); CSmartPtr<COutpostInfo> outPost=COutpostInfo::createOutpost(_FamilyBehavior,this,outpostName);
if (!outPost) if (!outPost)
{ {
@ -402,7 +402,7 @@ void CFamilyProfileTribe::spawnGroup()
{ {
H_AUTO(FamilySpawnTribe) H_AUTO(FamilySpawnTribe)
static CPropertyId act_nz_spawn("activity_spawn"); static CPropertyId act_nz_spawn("activity_spawn");
if (getCampZone().isNull()) if (getCampZone().isNull())
return; return;
@ -411,11 +411,11 @@ void CFamilyProfileTribe::spawnGroup()
if (!spawn) if (!spawn)
return; return;
static CPropertyId act_nz_escort("activity_escort"); static CPropertyId act_nz_escort("activity_escort");
static CPropertyId act_nz_contact("activity_contact"); static CPropertyId act_nz_contact("activity_contact");
static CPropertyId act_nz_fight_boss("act_nz_fight_boss"); static CPropertyId act_nz_fight_boss("act_nz_fight_boss");
// CCellZone &cellZone=_FamilyBehavior->getOwner(); // CCellZone &cellZone=_FamilyBehavior->getOwner();
const CGroupDesc<CGroupFamily> *const gd = _FamilyBehavior->grpFamily()->getProportionalGroupDesc(_FamilyBehavior, CPropertySet(), act_nz_contact+act_nz_fight_boss+act_nz_escort); const CGroupDesc<CGroupFamily> *const gd = _FamilyBehavior->grpFamily()->getProportionalGroupDesc(_FamilyBehavior, CPropertySet(), act_nz_contact+act_nz_fight_boss+act_nz_escort);
@ -473,7 +473,7 @@ void CGrpProfileDynContact::endProfile()
// there's a coherence problem about the activity. // there's a coherence problem about the activity.
void CGrpProfileDynContact::updateProfile(uint ticksSinceLastUpdate) void CGrpProfileDynContact::updateProfile(uint ticksSinceLastUpdate)
{ {
// this is a contact group, special treatment // this is a contact group, special treatment
switch (_Grp->movingProfile().getAIProfileType()) switch (_Grp->movingProfile().getAIProfileType())
{ {
@ -495,7 +495,7 @@ void CGrpProfileDynContact::updateProfile(uint ticksSinceLastUpdate)
{ {
static CPropertyId act_nz_outpost("activity_outpost"); static CPropertyId act_nz_outpost("activity_outpost");
// time to go work childrens! // time to go work childrens!
const CNpcZone *dest = _FamilyProfile->getFamilyBehavior()->getOwner()->lookupNpcZone(/*_FamilyProfile->getFamilyBehavior()->getFamily(),*/ act_nz_outpost, _FamilyProfile->getFamilyBehavior()->grpFamily()->getSubstitutionId()); const CNpcZone *dest = _FamilyProfile->getFamilyBehavior()->getOwner()->lookupNpcZone(/*_FamilyProfile->getFamilyBehavior()->getFamily(),*/ act_nz_outpost, _FamilyProfile->getFamilyBehavior()->grpFamily()->getSubstitutionId());
if (dest) if (dest)
{ {
@ -512,7 +512,7 @@ void CGrpProfileDynContact::updateProfile(uint ticksSinceLastUpdate)
// if arrived. // if arrived.
if (!profile->destinationReach()) if (!profile->destinationReach())
break; break;
if (!_OutPostInfo->_ContactGroupExist) if (!_OutPostInfo->_ContactGroupExist)
{ {
_OutPostInfo->addToDespawnGroupList(_Grp); _OutPostInfo->addToDespawnGroupList(_Grp);
@ -583,26 +583,26 @@ void CGrpProfileDynHarvest::checkTargetsAround ()
if (std::find(aggroList.begin(), aggroList.end(), AISHEETS::CSheets::getInstance()->playerGroupIndex())==aggroList.end()) if (std::find(aggroList.begin(), aggroList.end(), AISHEETS::CSheets::getInstance()->playerGroupIndex())==aggroList.end())
return; return;
} }
CAIVision<CPersistentOfPhysical> Vision; CAIVision<CPersistentOfPhysical> Vision;
breakable breakable
{ {
CAIVector centerPos; CAIVector centerPos;
if (!_Grp->calcCenterPos(centerPos)) // true if there's some bots in the group. if (!_Grp->calcCenterPos(centerPos)) // true if there's some bots in the group.
break; break;
const uint32 playerRadius= uint(30); // _AggroRange); const uint32 playerRadius=30; // _AggroRange);
const uint32 botRadius=uint(0); // _AggroRange); const uint32 botRadius=0; // _AggroRange);
const uint32 minRadius=playerRadius>botRadius?botRadius:playerRadius; const uint32 minRadius=playerRadius>botRadius?botRadius:playerRadius;
Vision.updateBotsAndPlayers(_Grp->getPersistent().getAIInstance(), centerPos, playerRadius, botRadius); Vision.updateBotsAndPlayers(_Grp->getPersistent().getAIInstance(), centerPos, playerRadius, botRadius);
} }
{ {
const std::vector<NLMISC::CDbgPtr<CPersistentOfPhysical> > &players = Vision.players(); const std::vector<NLMISC::CDbgPtr<CPersistentOfPhysical> > &players = Vision.players();
std::vector<NLMISC::CDbgPtr<CPersistentOfPhysical> >::const_iterator first(players.begin()), last(players.end()); std::vector<NLMISC::CDbgPtr<CPersistentOfPhysical> >::const_iterator first(players.begin()), last(players.end());
for (; first != last; ++first) for (; first != last; ++first)
{ {
@ -617,7 +617,7 @@ void CGrpProfileDynHarvest::checkTargetsAround ()
if ( rootCell if ( rootCell
&& rootCell->getFlag()!=0 ) // Safe Zone ? && rootCell->getFlag()!=0 ) // Safe Zone ?
continue; continue;
_Grp->setAggroMinimumFor(ep->dataSetRow(), 0.5f, false); _Grp->setAggroMinimumFor(ep->dataSetRow(), 0.5f, false);
} }
} }
@ -659,9 +659,9 @@ void CGrpProfileDynHarvest::updateProfile(uint ticksSinceLastUpdate)
// Moving -> Wandering(Harvesting)|Camping // Moving -> Wandering(Harvesting)|Camping
case MOVE_DYN_FOLLOW_PATH: case MOVE_DYN_FOLLOW_PATH:
{ {
CGrpProfileDynFollowPath const* const fp = safe_cast<CGrpProfileDynFollowPath*>(movingProfile.getAIProfile()); CGrpProfileDynFollowPath const* const fp = safe_cast<CGrpProfileDynFollowPath*>(movingProfile.getAIProfile());
if (!fp->destinationReach()) if (!fp->destinationReach())
break; break;
@ -694,7 +694,7 @@ void CGrpProfileDynHarvest::updateProfile(uint ticksSinceLastUpdate)
// send the group to a harvest point // send the group to a harvest point
const CNpcZone *dest=NULL; const CNpcZone *dest=NULL;
while ( !dest while ( !dest
|| dest==profile->currentZone()) || dest==profile->currentZone())
{ {
@ -715,7 +715,7 @@ void CGrpProfileDynHarvest::updateProfile(uint ticksSinceLastUpdate)
#endif #endif
break; break;
} }
checkTargetsAround (); checkTargetsAround ();
CGrpProfileNormal::updateProfile(ticksSinceLastUpdate); CGrpProfileNormal::updateProfile(ticksSinceLastUpdate);
} }
@ -735,7 +735,7 @@ void CGrpProfileDynFight::beginProfile()
static CPropertyId act_nz_rest("activity_rest"); static CPropertyId act_nz_rest("activity_rest");
static CPropertyId act_nz_harvest("activity_harvest"); static CPropertyId act_nz_harvest("activity_harvest");
static CPropertyId act_nz_outpost("activity_outpost"); static CPropertyId act_nz_outpost("activity_outpost");
const CNpcZone *const dest = _FamilyProfile->getFamilyBehavior()->getOwner()->lookupNpcZone(/*_FamilyProfile->getFamilyBehavior()->getFamily(),*/ act_nz_harvest, _FamilyProfile->getFamilyBehavior()->grpFamily()->getSubstitutionId()); const CNpcZone *const dest = _FamilyProfile->getFamilyBehavior()->getOwner()->lookupNpcZone(/*_FamilyProfile->getFamilyBehavior()->getFamily(),*/ act_nz_harvest, _FamilyProfile->getFamilyBehavior()->grpFamily()->getSubstitutionId());
_Grp->movingProfile().setAIProfile(new CGrpProfileDynFollowPath(_Grp, _CurrentZone, dest, act_nz_outpost + act_nz_rest + act_nz_harvest)); _Grp->movingProfile().setAIProfile(new CGrpProfileDynFollowPath(_Grp, _CurrentZone, dest, act_nz_outpost + act_nz_rest + act_nz_harvest));
} }
@ -752,7 +752,7 @@ void CGrpProfileDynFight::updateProfile(uint ticksSinceLastUpdate)
{ {
static CPropertyId act_nz_outpost("activity_outpost"); static CPropertyId act_nz_outpost("activity_outpost");
CProfilePtr &movingProfile=_Grp->movingProfile(); CProfilePtr &movingProfile=_Grp->movingProfile();
// this is a contact group, special treatment // this is a contact group, special treatment
switch (movingProfile.getAIProfileType()) switch (movingProfile.getAIProfileType())
{ {
@ -772,14 +772,14 @@ void CGrpProfileDynFight::updateProfile(uint ticksSinceLastUpdate)
// send the group to an harvest site. // send the group to an harvest site.
movingProfile.setAIProfile(new CGrpProfileDynFollowPath(_Grp, profile->currentZone(), dest, CPropertySet())); movingProfile.setAIProfile(new CGrpProfileDynFollowPath(_Grp, profile->currentZone(), dest, CPropertySet()));
break; break;
} }
break; break;
// Moving -> Wandering(Fighting)|Camping // Moving -> Wandering(Fighting)|Camping
case MOVE_DYN_FOLLOW_PATH: case MOVE_DYN_FOLLOW_PATH:
{ {
CGrpProfileDynFollowPath const* const fp = safe_cast<CGrpProfileDynFollowPath*>(movingProfile.getAIProfile()); CGrpProfileDynFollowPath const* const fp = safe_cast<CGrpProfileDynFollowPath*>(movingProfile.getAIProfile());
_CurrentZone=fp->currentZone(); _CurrentZone=fp->currentZone();
if (!fp->destinationReach()) if (!fp->destinationReach())

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save