-
Notifications
You must be signed in to change notification settings - Fork 167
bugfix(radar): Fix incorrect 2D distance calculation in Radar::tryEvent #2368
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
base: main
Are you sure you want to change the base?
Changes from all commits
7c79bc7
0ddd87b
e79acf4
d086419
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1186,8 +1186,7 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) | |||||
| { | ||||||
|
|
||||||
| // get distance from our new event location to this event location in 2D | ||||||
| Real distSquared = m_event[ i ].worldLoc.x - pos->x * m_event[ i ].worldLoc.x - pos->x + | ||||||
| m_event[ i ].worldLoc.y - pos->y * m_event[ i ].worldLoc.y - pos->y; | ||||||
| const Real distSquared = sqr(m_event[ i ].worldLoc.x - pos->x) + sqr(m_event[ i ].worldLoc.y - pos->y); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces instead of tabs for indentation The new line uses 6 spaces for indentation, while the rest of the file (including immediately surrounding lines like the comment on line 1188 and the
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: Core/GameEngine/Source/Common/System/Radar.cpp
Line: 1189
Comment:
**Spaces instead of tabs for indentation**
The new line uses 6 spaces for indentation, while the rest of the file (including immediately surrounding lines like the comment on line 1188 and the `if` block on line 1191) uses tabs. This creates a subtle whitespace inconsistency.
```suggestion
const Real distSquared = sqr(m_event[ i ].worldLoc.x - pos->x) + sqr(m_event[ i ].worldLoc.y - pos->y);
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
|
|
||||||
| if( distSquared <= closeEnoughDistanceSq ) | ||||||
| { | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.