diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-10-18 20:17:37 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-10-18 20:17:37 +0200 |
commit | fb802362147699a61f38e2f077a94b8803a97c32 (patch) | |
tree | 32f82ed28cce84713b83db6e66159cde57f232db | |
parent | Merge remote-tracking branch 'upstream/miami' into miami (diff) | |
download | re3-fb802362147699a61f38e2f077a94b8803a97c32.tar re3-fb802362147699a61f38e2f077a94b8803a97c32.tar.gz re3-fb802362147699a61f38e2f077a94b8803a97c32.tar.bz2 re3-fb802362147699a61f38e2f077a94b8803a97c32.tar.lz re3-fb802362147699a61f38e2f077a94b8803a97c32.tar.xz re3-fb802362147699a61f38e2f077a94b8803a97c32.tar.zst re3-fb802362147699a61f38e2f077a94b8803a97c32.zip |
-rw-r--r-- | src/peds/PedAttractor.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/peds/PedAttractor.cpp b/src/peds/PedAttractor.cpp index cebe31b0..ee3833da 100644 --- a/src/peds/PedAttractor.cpp +++ b/src/peds/PedAttractor.cpp @@ -379,12 +379,16 @@ bool CPedAttractor::BroadcastDeparture(CPed* pPed) if (pPed->GetPedState() == PED_IDLE || pPed->GetPedState() == PED_NONE) pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); } - else if (qid == 0) - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(vecQueueDir.x, vecQueueDir.y)); - else if (qid == vWaitingQueue.size() - 1) - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); - else - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.z)); + else { + pPed->SetObjective(OBJECTIVE_NONE); + if (qid == 0) + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(vecQueueDir.x, vecQueueDir.y)); + else if (qid == vWaitingQueue.size() - 1) + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); + else + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.z)); + UpdatePedStateOnDeparture(pPed); + } vWaitingQueue.erase(vWaitingQueue.cbegin() + qid); for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) { CPed* pPed = *pPedIt; @@ -416,12 +420,16 @@ bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed) if (pPed->GetPedState() == PED_IDLE || pPed->GetPedState() == PED_NONE) pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); } - else if (qid == 0) - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(vecQueueDir.x, vecQueueDir.y)); - else if (qid == vWaitingQueue.size() - 1) - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); - else - pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.z)); + else { + pPed->SetObjective(OBJECTIVE_NONE); + if (qid == 0) + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(vecQueueDir.x, vecQueueDir.y)); + else if (qid == vWaitingQueue.size() - 1) + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.x, -vecQueueDir.y)); + else + pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x)); + UpdatePedStateOnDeparture(pPed); + } vWaitingQueue.erase(vWaitingQueue.cbegin() + qid); for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) { CPed* pPed = *pPedIt; |