Fly, use rotating buffer over list to store last 5 positions.#20140
Merged
Conversation
teinarss
reviewed
Jul 23, 2022
pchote
reviewed
Oct 8, 2022
anvilvapre
force-pushed
the
20220718_fly_history
branch
2 times, most recently
from
October 9, 2022 12:25
8d53513 to
328f30f
Compare
Contributor
Author
|
Requested changes addressed. |
AspectInteractive2
previously approved these changes
Dec 24, 2022
AspectInteractive2
left a comment
Contributor
There was a problem hiding this comment.
This looks fine to me. I am not sure how much of a difference these changes will make but they are reasonable changes.
abcdefg30
reviewed
Jan 12, 2023
anvilvapre
force-pushed
the
20220718_fly_history
branch
from
March 12, 2023 20:57
328f30f to
09cc804
Compare
PunkPun
reviewed
Apr 4, 2023
PunkPun
left a comment
Member
There was a problem hiding this comment.
I think buffer related changes should be separated into its own commit. This also needs a rebased as it conflicts with the current codestyle (I've suggested the fix).
anvilvapre
force-pushed
the
20220718_fly_history
branch
from
May 7, 2023 22:25
09cc804 to
0b4b64f
Compare
abcdefg30
reviewed
May 10, 2023
| set | ||
| { | ||
| if (pos >= Count) | ||
| throw new ArgumentException($"Index out of bounds: {pos}"); |
Contributor
Author
There was a problem hiding this comment.
yeah, it seemed reasonable, to avoid the overhead.
anvilvapre
force-pushed
the
20220718_fly_history
branch
from
May 11, 2023 20:07
0b4b64f to
7445a8e
Compare
anvilvapre
force-pushed
the
20220718_fly_history
branch
from
May 14, 2023 22:20
7445a8e to
415a6ed
Compare
Contributor
Author
|
ping. fixups were done, apart from the bounds check in the getter, which will be unlikely and obviously tracable by the resulting exception. |
Contributor
Author
|
ping. |
PunkPun
approved these changes
Aug 2, 2023
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fly stores the last the position over the lats 5 ticks to determine the distance travelled and whether flight is stuck.
Listwith an rotating buffer. To avoid removing the head element from a list array each tick. Avoiding a ArrayCopy/Move each tick.RotatingBuffercan be reused in new contrail implementation. Could potentially also be used in input tap detection. (only used function tested)Future possible improvements:
Map.DistanceAboveTerrainis looked up more often by all flight activites/functions - during the same tick. For rectangular maps the operation is not that expensive. Functions already take many arguments - did not want to add it.