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

Added unit index to radar statement #6017

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

SingularityT3
Copy link

The radar statement now returns a unit based on the index after sorting. For example, when index is 0(and sort is distance and sortOrder is 1), the closest unit is returned. When the index is 1, the second closest unit is returned and so on. If the index is higher than the number of units nearby, the result is null.

Demo program:
logic
demo

If your pull request is not translation or serverlist-related, read the list of requirements below and check each box:

  • I have read the contribution guidelines.
  • I have ensured that my code compiles, if applicable.
  • I have ensured that any new features in this PR function correctly in-game, if applicable.

@@ -747,7 750,8 @@ public void run(LExecutor exec){
}
}

void find(Ranged b, float range, int sortDir, Team team){
void find(Ranged b, float range, int sortDir, Team team, int idx){
ObjectMap<Float, Unit> units = new ObjectMap<>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the contribution guidelines in two ways:

  1. Boxed Float used.
  2. Large allocation in main loop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now.

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.

2 participants