diff options
| author | P-Kito <kito@vortexirc.com> | 2016-07-13 16:41:33 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-02-05 16:53:53 +0100 |
| commit | 3b6694333061dc34549caf260ba44780961b27e6 (patch) | |
| tree | c402743205081a26f5b8250e9495bc6b0dd9b748 /src | |
| parent | cc42cd158c0b2ce22afdd66cb78358b623d83b1c (diff) | |
Game/Entities: Fix math problem "Disk Point Picking" in GetRandomPoint (#17577)
(cherry picked from commit 0aad705f95a4cead2e083396beead46c6e2446df)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index fcbb82708b0..da3c9319180 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1907,7 +1907,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran // angle to face `obj` to `this` float angle = (float)rand_norm()*static_cast<float>(2*M_PI); - float new_dist = (float)rand_norm()*static_cast<float>(distance); + float new_dist = (float)rand_norm() + (float)rand_norm(); + new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist); rand_x = pos.m_positionX + new_dist * std::cos(angle); rand_y = pos.m_positionY + new_dist * std::sin(angle); |
