HomeWildfire Games

Optimise MakeGoalReachable and FindNearestNavcellInRegions (D53 outtake)
Needs VerificationrP22817

Description

Optimise MakeGoalReachable and FindNearestNavcellInRegions (D53 outtake)

By leveraging custom ordering in std::set, MakeGoalReachable and FindNearestNavcellInRegions can be optimised and the code simplified.

Differential Revision: https://code.wildfiregames.com/D1882

Event Timeline

elexis raised a concern with this commit.Sep 2 2019, 2:36 AM
elexis added a subscriber: elexis.

VS2015 shows these compile warnings, I don't know if they are false positives or apply in some edge case:

14>c:\users\myself\desktop\0ad\source\simulation2\helpers\hierarchicalpathfinder.cpp(746): warning C4701: potential
   ly uninitialized local variable 'bestI' used [C:\Users\myself\Desktop\0ad\build\workspaces\vc2015\simulation2.vc
   xproj]
14>c:\users\myself\desktop\0ad\source\simulation2\helpers\hierarchicalpathfinder.cpp(747): warning C4701: potential
   ly uninitialized local variable 'bestJ' used [C:\Users\myself\Desktop\0ad\build\workspaces\vc2015\simulation2.vc
   xproj]
/ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp
747

^

This commit now has outstanding concerns.Sep 2 2019, 2:36 AM
Krinkle added a subscriber: Krinkle.Sep 2 2019, 3:16 AM
wraitii added inline comments.Sep 2 2019, 8:48 AM
/ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp
747

In practice it's a false positive, because bestDist is INT_MAX at start and list will always be something less, but I suppose it wouldn't hurt to init them.
Thanks for reporting.

wraitii requested verification of this commit.Sep 22 2019, 11:18 AM
This commit now requires verification by auditors.Sep 22 2019, 11:18 AM