mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
sanity check to fix possible FPE
This commit is contained in:
parent
884b844d65
commit
3f35d2e960
@ -495,6 +495,9 @@ std::pair<int,int> MobManager::lerp(int x1, int y1, int x2, int y2, int speed) {
|
|||||||
int distance = hypot(x1 - x2, y1 - y2);
|
int distance = hypot(x1 - x2, y1 - y2);
|
||||||
|
|
||||||
if (distance > speed) {
|
if (distance > speed) {
|
||||||
|
if (speed == 0)
|
||||||
|
speed = 1;
|
||||||
|
|
||||||
int lerps = distance / speed;
|
int lerps = distance / speed;
|
||||||
|
|
||||||
// interpolate only the first point
|
// interpolate only the first point
|
||||||
|
Loading…
Reference in New Issue
Block a user