hectorgimenez / koolo

Diablo II Resurrected bot written in Go
MIT License
80 stars 52 forks source link

Fix index out of range error in LineOfSight and ensureEnemyIsInRange #359

Closed R1DEL closed 2 months ago

R1DEL commented 3 months ago

Fix index out of range error in LineOfSight and ensureEnemyIsInRange

Changes:

  1. Added boundary checks in LineOfSight function:

    • Ensured that indices x0 and y0 are within the valid range of the d.CollisionGrid array to prevent out-of-bounds errors.
  2. Adjusted index calculation in ensureEnemyIsInRange method:

    • Modified the calculation of moveTo to ensure it does not exceed the bounds of the path array.

Testing:

artosimonyan commented 3 months ago

Thanks for the contribution, will wait for @hectorgimenez to double-check :)