mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
Prevent division by zero by also checking iWalkSpeed for 0
This commit is contained in:
parent
442d7853a5
commit
f74c40cf69
@ -632,10 +632,6 @@ void MobManager::roamingStep(Mob *mob, time_t currTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// some mobs don't move (and we mustn't divide/modulus by zero)
|
|
||||||
if (mob->idleRange == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// no random roaming if the mob already has a set path
|
// no random roaming if the mob already has a set path
|
||||||
if (mob->staticPath)
|
if (mob->staticPath)
|
||||||
return;
|
return;
|
||||||
@ -656,6 +652,10 @@ void MobManager::roamingStep(Mob *mob, time_t currTime) {
|
|||||||
int yStart = mob->spawnY - mob->idleRange/2;
|
int yStart = mob->spawnY - mob->idleRange/2;
|
||||||
int speed = mob->data["m_iWalkSpeed"];
|
int speed = mob->data["m_iWalkSpeed"];
|
||||||
|
|
||||||
|
// some mobs don't move (and we mustn't divide/modulus by zero)
|
||||||
|
if (mob->idleRange == 0 || speed == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int farX, farY;
|
int farX, farY;
|
||||||
int distance; // for short walk detection
|
int distance; // for short walk detection
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user