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