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: faction changes not allowing updated targets #1437

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

EmosewaMC
Copy link
Collaborator

fixes an issue where enemies who would have their faction changed would not update their aggro targets since they will have already been forgotten in the previous iteration. New version adds all colliding entities, but returns a trimmed list so that an enemy faction can be changed on the fly and not affect targetting for enemies who now have new enemies.
Returning a container not by reference will barely add any overhead since no copy or move is done since ive used copy elision to construct the vector in the previous stack frame instead of this one, so cost increase here is low. No reference on the id as a LWOOBJID fits in a cpu register so a reference is more expensive than just copying the value.

Tested that stromling mechs and ronin/horsemen in forbidden valley still aggro on spawn as expected.

fixes #1426

fixes an issue where enemies who would have their faction changed would not change aggro targets.

Tested that stromling mechs and ronin/horsemen in forbidden valley still aggro on spawn as expected.
Xiphoseer
Xiphoseer previously approved these changes Jan 26, 2024
Copy link
Contributor

@Xiphoseer Xiphoseer left a comment

Choose a reason for hiding this comment

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

LGTM

Would prefer to not erase in a loop and use a standard thing like https://cplusplus.com/reference/algorithm/copy_if/ instead

dGame/Entity.cpp Outdated Show resolved Hide resolved
aronwk-aaron
aronwk-aaron previously approved these changes Jan 26, 2024
@EmosewaMC EmosewaMC dismissed stale reviews from aronwk-aaron and Xiphoseer via 3a50470 January 28, 2024 05:48
Copy link
Collaborator

@Jettford Jettford left a comment

Choose a reason for hiding this comment

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

yummy code

@aronwk-aaron aronwk-aaron merged commit 2f247b1 into main Jan 29, 2024
4 checks passed
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.

BUG: Stromling Mech not attacking in avant gardens survival
4 participants