Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

R1DEL
Copy link
Contributor

@R1DEL R1DEL commented Jul 15, 2024

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:

  • Ran multiple scenarios to ensure the changes fix the index out of range error without introducing new issues.
  • Verified that the bot performs as expected in all tested scenarios.

@artosimonyan
Copy link
Collaborator

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

@artosimonyan artosimonyan merged commit 0efd425 into hectorgimenez:main Jul 20, 2024
@R1DEL R1DEL deleted the fix-line-of-sight-error branch July 21, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants