mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix Crashs Formation Arrow (#708)
* Fix crash in formations * Crash fix: Arrow formation * Crash fix: Arrow formation looking for member information in different maps/instances. * Loop fix: arrow formation * Crash fix: Arrow formation when group isn't all in 1 place. * Fix Build
This commit is contained in:
@@ -22,10 +22,9 @@ WorldLocation ArrowFormation::GetLocationInternal()
|
||||
float offset = 0.f;
|
||||
|
||||
Player* master = botAI->GetMaster();
|
||||
if (!master)
|
||||
{
|
||||
if (!botAI->IsSafe(master))
|
||||
return Formation::NullLocation;
|
||||
}
|
||||
|
||||
float orientation = master->GetOrientation();
|
||||
MultiLineUnitPlacer placer(orientation);
|
||||
|
||||
@@ -44,6 +43,9 @@ WorldLocation ArrowFormation::GetLocationInternal()
|
||||
healers.PlaceUnits(&placer);
|
||||
healers.Move(-cos(orientation) * offset, -sin(orientation) * offset);
|
||||
|
||||
if (!masterUnit || !botUnit)
|
||||
return Formation::NullLocation;
|
||||
|
||||
float x = master->GetPositionX() - masterUnit->GetX() + botUnit->GetX();
|
||||
float y = master->GetPositionY() - masterUnit->GetY() + botUnit->GetY();
|
||||
float z = master->GetPositionZ() + master->GetHoverHeight();
|
||||
@@ -89,14 +91,15 @@ void ArrowFormation::FillSlotsExceptMaster()
|
||||
while (gref)
|
||||
{
|
||||
Player* member = gref->GetSource();
|
||||
|
||||
if (member == bot)
|
||||
FindSlot(member)->AddLast(botUnit = new FormationUnit(index, false));
|
||||
else if (member != botAI->GetMaster())
|
||||
FindSlot(member)->AddLast(new FormationUnit(index, false));
|
||||
|
||||
if (botAI->IsSafe(member))
|
||||
{
|
||||
if (member == bot)
|
||||
FindSlot(member)->AddLast(botUnit = new FormationUnit(index, false));
|
||||
else if (member != botAI->GetMaster())
|
||||
FindSlot(member)->AddLast(new FormationUnit(index, false));
|
||||
++index;
|
||||
}
|
||||
gref = gref->next();
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +437,7 @@ float Formation::GetFollowAngle()
|
||||
{
|
||||
if (Player* member = ref->GetSource())
|
||||
{
|
||||
if (!member || member == bot || !member->IsAlive() || bot->GetMapId() != member->GetMapId()) continue;
|
||||
if (member != master && !botAI->IsTank(member) && !botAI->IsHeal(member))
|
||||
{
|
||||
roster.insert(roster.begin() + roster.size() / 2, member);
|
||||
@@ -448,6 +449,7 @@ float Formation::GetFollowAngle()
|
||||
{
|
||||
if (Player* member = ref->GetSource())
|
||||
{
|
||||
if (!member || member == bot || !member->IsAlive() || bot->GetMapId() != member->GetMapId()) continue;
|
||||
if (member != master && botAI->IsHeal(member))
|
||||
{
|
||||
roster.insert(roster.begin() + roster.size() / 2, member);
|
||||
@@ -460,6 +462,7 @@ float Formation::GetFollowAngle()
|
||||
{
|
||||
if (Player* member = ref->GetSource())
|
||||
{
|
||||
if (!member || member == bot || !member->IsAlive() || bot->GetMapId() != member->GetMapId()) continue;
|
||||
if (member != master && botAI->IsTank(member))
|
||||
{
|
||||
if (left)
|
||||
|
||||
Reference in New Issue
Block a user